[r1]dhcp enable //开启DHC0功能P
[r1-GigabitEthernet0/0/0]int g 0/0/0.1
[r1-GigabitEthernet0/0/0.1]ip add 192.168.1.1 24
[r1-GigabitEthernet0/0/0.1]dhcp select interface //接口地址池
[r1-GigabitEthernet0/0/0.1]dhcp server dns-list 8.8.8.8
[r1-GigabitEthernet0/0/0.1]dot1q termination vid 2 //开启子接口处理802.1Q数据帧的能力
[r1-GigabitEthernet0/0/0.1]arp broadcast enable //开启伪广播
[r1-GigabitEthernet0/0/2]ip add 192.168.2.1 24
[r1-GigabitEthernet0/0/2]dhcp select interface
[r1-GigabitEthernet0/0/2]dhcp server dns-list 8.8.8.8
[sw1]vlan batch 2 to 6
[sw2]vlan batch 2 to 6
[sw3]vlan batch 2 to 6
[sw1-GigabitEthernet0/0/1]port hybrid tagged vlan 2
[sw1-GigabitEthernet0/0/1]port hybrid untagged vlan 3 to 6
[sw1-GigabitEthernet0/0/2]port hybrid tagged vlan 2 to 6
[sw1-GigabitEthernet0/0/3]port link-type access
[sw1-GigabitEthernet0/0/3]port link-type access
[sw1-GigabitEthernet0/0/3]port default vlan 2
[sw1-GigabitEthernet0/0/4]port hybrid untagged vlan 3
[sw1-GigabitEthernet0/0/4]port hybrid pvid vlan 3
[sw1-GigabitEthernet0/0/4]port hybrid untagged vlan 3 to 6
[sw2-GigabitEthernet0/0/1]port hybrid tagged vlan 2 to 6
[sw2-GigabitEthernet0/0/2]port hybrid tagged vlan 2 to 6
[sw2-GigabitEthernet0/0/3]port link-type access
[sw2-GigabitEthernet0/0/3]port default vlan 2
[sw2-GigabitEthernet0/0/4]port hybrid pvid vlan 4
[sw2-GigabitEthernet0/0/4]port hybrid untagged vlan 3 to 5
[sw3-GigabitEthernet0/0/1]port hybrid tagged vlan 2 to 6
[sw3-GigabitEthernet0/0/2]port hybrid pvid vlan 5
[sw3-GigabitEthernet0/0/2]port hybrid untagged vlan 3 to 5
[sw3-GigabitEthernet0/0/3]port hybrid pvid vlan 6
[sw3-GigabitEthernet0/0/3]port hybrid untagged vlan 3 6
因为PC2、4、5、6处于同一网段,PC1、3处于同一网段
因此不能给每个vlan设置一个子接口网关
且PC1、3处于同一个VLAN,所以可以用一个子接口统一管理
而PC2、4、5、6分别处于不同的VLAN不能使用同一个子接口(dot1q termination vid x),但使用多个子接口又违背了要处于同一个网段的要求
所以只能用路由器的物理接口g0/0/0进行管理并且在SW1的g0/0/1接口把VLAN 2 to 6设为不携带标签转发