基于dhcp协议的vlan配置实验

实验步骤:

  1. 全部pc使用 dhcp协议

  1. 给sw1 sw2 sw3 配置vlan 2 vlan3

<sw1>undo terminal monitor 关闭系统调试信息

[sw1]vlan batch2 3 创建vlan 2 vlan3

[sw1]int e0/0/2

[sw1-Ethernet0/0/2]port link-type access 更改接口的链路类型

[sw1-Ethernet0/0/2]port default vlan 2 将接口加入到相应的vlan中

[sw1]int e0/0/3

[sw1-Ethernet0/0/3]port link-type access 更改接口的链路类型

[sw1-Ethernet0/0/3]port default vlan 3 将接口加入到相应的vlan中

[sw1]int e0/0/1

[sw1-Ethernet0/0/1]port link-type trunk更改接口的链路类型

[sw1-Ethernet0/0/1]port trunk allow-pass vlan 2 3 在trunk链路上放通vlan 2 与vlan 3

[sw2]vlan batch2 3

[sw2]int e 0/0/3

[sw2-Ethernet0/0/3]portl ink-type access

[sw2-Ethernet0/0/3]port default vlan 2

[sw2-Ethernet0/0/3]q

[sw2]int e 0/0/4

[sw2-Ethernet0/0/4]port link-type access

[sw2-Ethernet0/0/4]port default vlan 3

[sw2-Ethernet0/0/4]q

[sw2]int e 0/0/2

[sw2-Ethernet0/0/2]port link-type trunk

[sw2-Ethernet0/0/2]port link-type trunk

[sw2-Ethernet0/0/2]port trunk allow-pass vlan 2 3

[sw2-Ethernet0/0/2]q

[sw2]int e 0/0/1

[sw2-Ethernet0/0/1]port link-type trunk

[sw2-Ethernet0/0/1]port trunk allow-pass vlan 2 3

[sw3]vlan batch2 3

[sw3]int e0/0/2

[sw3-Ethernet0/0/2]portl ink-type access

[sw3-Ethernet0/0/2]port default vlan 2

[sw3-Ethernet0/0/2]q

[sw3]int e0/0/3

[sw3-Ethernet0/0/3]port link-type access

[sw3-Ethernet0/0/3]port default vlan 3

[sw3-Ethernet0/0/3]q

[sw3]int e0/0/1

[sw3-Ethernet0/0/1]portlink-type trunk

[sw3-Ethernet0/0/1]porttrunk allow-pass vlan 2 3

  1. 路由器配置

3.1配置接口

[R2]int g0/0/1.1 进入虚拟接口

[R2-GigabitEthernet0/0/1.1]ip add 192.168.1.254 24 为虚拟接口配置IP地址

[R2-GigabitEthernet0/0/1.1]dot1q termination vid 2 为接口指定配置vlan

[R2-GigabitEthernet0/0/1.1]arp broadcast enable 启用arp 协议广播

[R2-GigabitEthernet0/0/1.1]q

[R2]intg0/0/1.2

[R2-GigabitEthernet0/0/1.2]ip add 192.168.2.254 24

[R2-GigabitEthernet0/0/1.2]dot1q termination vid 3

[R2-GigabitEthernet0/0/1.2]arp broadcast enable

[R2-GigabitEthernet0/0/1.2]q

[R2]intg0/0/0.1

[R2-GigabitEthernet0/0/0.1]ip add 192.168.3.254 24

[R2-GigabitEthernet0/0/0.1]dot1q termination vid 2

[R2-GigabitEthernet0/0/0.1]arp broadcast enable

[R2-GigabitEthernet0/0/0.1]q

[R2]intg0/0/0.2

[R2-GigabitEthernet0/0/0.2 ]ip add 192.168.1.254 24

[R2-GigabitEthernet0/0/0.2]dot1q termination vid 3

[R2-GigabitEthernet0/0/0.2]arp broadcast enable

[R2-GigabitEthernet0/0/0.2]q

3.2DHCP配置

[R2]dhcp enable 启用DHCP

[R2]ip pool a 创建IP地址池 a

[R2-ip-pool-a]network 192.168.1.0 mask 24 给地址池分配网段

[R2-ip-pool-a]gateway-list192.168.1.254 给地址池配置网关

[R2-ip-pool-a]dns-list114.114.114.114 8.8.8.8 给地址池 配置dns服务器

[R2-ip-pool-a]q

[R2]int g0/0/1.1 进入虚拟接口

[R2-GigabitEthernet0/0/1.1]dhcp select global 接口启用DHCP协议

[R2-GigabitEthernet0/0/1.1]q

[R2]ip pool b

[R2-ip-pool-b]network192.168.2.0 mask 24

[R2-ip-pool-b]gateway-list192.168.2.254

[R2-ip-pool-b]dns-list114.114.114.114 8.8.8.8

[R2-ip-pool-b]q

[R2]int g0/0/1.2

[R2-GigabitEthernet0/0/1.2]dhcpselect global

[R2-GigabitEthernet0/0/1.2]q

[R2]ip pool c

[R2-ip-pool-c]network192.168.3.0 mask 24

[R2-ip-pool-c]gateway-list192.168.3.254

[R2-ip-pool-c]dns-list114.114.114.114 8.8.8.8

[R2-ip-pool-c]q

[R2]int g0/0/0.1

[R2-GigabitEthernet0/0/0.1]dhcpselect global

[R2-GigabitEthernet0/0/0.1]q

[R2]ip pool d

[R2-ip-pool-d]network 192.168.4.0 mask 24

[R2-ip-pool-d]gateway-list192.168.4.254

[R2-ip-pool-d]dns-list114.114.114.114 8.8.8.8

[R2-ip-pool-d]q

[R2]int g0/0/0.2

[R2-GigabitEthernet0/0/0.2]dhcpselect global

[R2-GigabitEthernet0/0/0.2]q

查看各个pc的网络

  • 2
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值