vlan配置以及三层交换

拓扑图:

223400608.png

vlan配置:

对于交换机A:

<switchA>system-view

[switchA]vlan 2

[switchA-vlan2]port e0/2 to e0/4

[switchA-vlan2]vlan 3

[switchA-vlan3]port e0/5 to e0/7

[switchA-vlan3]quit

[switchA]int e0/8

[switchA-interface0/8]port link-type trunk

[switchA-interface0/8]port trunk permit vlan all


对于交换机B:

<switchB>system-view

[switchB]vlan 2

[switchB-vlan2]port e0/2 to e0/4

[switchB-vlan3]quit

[switchB]int e0/8

[switchB-interface0/8]port link-type trunk

[switchB-interface0/8]port trunk permit vlan all


检验:

pcA ping pcC 通

pcB ping pcC 不同

pcA ping pcB 不同


由此可知,相同的vlan可以相互通信,不同的vlan不可以通信。


三层交换:

对于交换机A:

<switchA>system-view

[switchA]vlan 2

[switchA-vlan2]port e0/2 to e0/4

[switchA-vlan2]int vlan 2

[switchA-vlan-interface2]ip address 192.168.1.1

[switchA-vlan2]vlan 3

[switchA-vlan3]port e0/5 to e0/7

[switchA-vlan-interface3]ip address 192.168.2.1

[switchA-vlan3]quit

[switchA]int e0/8

[switchA-interface0/8]port link-type trunk

[switchA-interface0/8]port trunk permit vlan all


对于交换机B:

<switchB>system-view

[switchB]vlan 2

[switchB-vlan2]port e0/2 to e0/4

[switchB-vlan2]int vlan 2

[switchB-vlan-interface2]ip address 192.168.1.3

[switchB-vlan2]quit

[switchB]int e0/8

[switchB-interface0/8]port link-type trunk

[switchB-interface0/8]port trunk permit vlan all


检验:

pcA、pcB和pcC相互访问


你可能感兴趣的:(VLAN,交换机,三层交换)