sw1:
[sw1]vlan batch 2 to 3 创建vlan2和vlan3
[sw1]port-group group-member GigabitEthernet 0/0/2 to GigabitEthernet 0/0/3 同时进入2号与3号 接口进行操作
[sw1-port-group]port link-type access 先定义该接口为接入模式
[sw1-port-group]port default vlan 2 将2号与3号接口划分到vlan2
[sw1]port-group group-member GigabitEthernet 0/0/4 to GigabitEthernet 0/0/5
[sw1-port-group]port link-type access
[sw1-port-group]port default vlan 3 将4号与5号接口划分到vlan3
[sw1]interface GigabitEthernet0/0/6 (与sw2建立trunk干道)
[sw1-GigabitEthernet0/0/6]port link-type trunk 先定义为trunk模式
[sw1-GigabitEthernet0/0/6]port trunk allow-pass vlan 2 to 3 定义其可以允许通过的vla为2和3
[sw1]interface GigabitEthernet0/0/1 (与路由器建立trunk干道)
[sw1-GigabitEthernet0/0/1]port link-type trunk 先定义为trunk模式
[sw1-GigabitEthernet0/0/1]port trunk allow-pass vlan 2 to 3 定义其可以允许通过的vla为2和3
sw2:
[sw2]vlan batch 2 to 3 创建vlan2和vlan3
[sw2]interface GigabitEthernet0/0/2
[sw2-GigabitEthernet0/0/2]port link-type access
[sw2-GigabitEthernet0/0/2]port default vlan 2 将2号接口划分到vlan2
[sw2]interface GigabitEthernet0/0/3
[sw2-GigabitEthernet0/0/3]port link-type access
[sw2-GigabitEthernet0/0/3]port default vlan 3 将3号接口划分到vlan3
[sw1]interface GigabitEthernet0/0/1
[sw1-GigabitEthernet0/0/1]port link-type trunk 先定义为trunk模式
[sw1-GigabitEthernet0/0/1]port trunk allow-pass vlan 2 to 3 定义其可以允许通过的vla为2和3
r1:
[r1]int g0/0/0.1 创建子接口
[r1-GigabitEthernet0/0/0.1]dot1q termination vid 2 定义管理vlan编号
[r1-GigabitEthernet0/0/0.1]ip add 192.168.1.254 24 配置IP地址
[r1-GigabitEthernet0/0/0.1]arp broadcast enable 开启子接口ARP
[r1]int g0/0/0.2
[r1-GigabitEthernet0/0/0.1]dot1q termination vid 3
[r1-GigabitEthernet0/0/0.1]ip add 192.168.2.254 24
[r1-GigabitEthernet0/0/0.1]arp broadcast enable
[r1]dhcp enable 开启dhcp服务
[r1]ip pool 1 建立1号地址池
[r1-ip-pool-1]network 192.168.1.0 m 24 设置管理网段
[r1-ip-pool-1]gateway-list 192.168.1.254 设置网关IP
[r1-ip-pool-1]dns-list 114.114.114.114 设置dns服务器
[r1-GigabitEthernet0/0/0.1]dhcp select global 在对应接口开启DHCP功能
[r1]dhcp enable 开启dhcp服务
[r1]ip pool 2 建立2号地址池
[r1-ip-pool-2]network 192.168.2.0 m 24 设置管理网段
[r1-ip-pool-2]gateway-list 192.168.2.254 设置网关IP
[r1-ip-pool-2]dns-list 114.114.114.114 设置dns服务器
[r1-GigabitEthernet0/0/0.2]dhcp select global 在对应接口开启DHCP功能