华为设备上用三成交换机实现vlan间的通信
1.三成交换机上的所有配置
r]int e0/1
[r-Ethernet0/1]port link-type trunk
[r-Ethernet0/1]port trunk permit vlan all(允许所有的vlan通过,因为华为默认vlan不通过)
Please wait........................................... Done!
[r-Ethernet0/1]vlan 10(创建vlan)
[r-vlan10]vlan 20
[r]int Vlan-interface 10(进入vlan的子接口设地址)
[r-Vlan-interface10]ip add 192.168.10.254 255.255.255.0
[r-Vlan-interface10]int Vlan-interface 20
[r-Vlan-interface20]ip add 192.168.20.254 255.255.255.0
[r-Vlan-interface20]dis ip rou
Routing Table: public net
Destination/Mask Protocol Pre Cost Nexthop Interface
127.0.0.0/8 DIRECT 0 0 127.0.0.1 InLoopBack0
127.0.0.1/32 DIRECT 0 0 127.0.0.1 InLoopBack0
192.168.10.0/24 DIRECT 0 0 192.168.10.254 Vlan-interface10
192.168.10.254/32 DIRECT 0 0 127.0.0.1 InLoopBack0
192.168.20.0/24 DIRECT 0 0 192.168.20.254 Vlan-interface20
192.168.20.254/32 DIRECT 0 0 127.0.0.1 InLoopBack0
2.交换机1上的配置
SW1]int e1/0/2
[SW1-Ethernet1/0/2]port link-type trunk
[SW1-Ethernet1/0/2]port trunk permit vlan all
Please wait........................................... Done.
[SW1-Ethernet1/0/2]int e1/0/24
[SW1-Ethernet1/0/24]port link-type trunk
[SW1-Ethernet1/0/24]port trunk permit vlan all
Please wait........................................... Done.
[SW1-Ethernet1/0/10]q
[SW1]vlan 10(创建vlan)
[SW1-vlan10]port e1/0/10(把此端口加入vlan)
[SW1-vlan10]vlan 20
[SW1-vlan20]port e1/0/20
3.交换机2上的配置
[Quidway]int e0/24
[Quidway-Ethernet0/24]port link-type trunk
[Quidway-Ethernet0/24]port trunk permit vlan all
[Quidway-Ethernet0/24]vlan 10
[Quidway-vlan10]port e0/10
[Quidway-vlan10]vlan 20
[Quidway-vlan20]port e0/20
所有的配置命令已经完成,vlan的pc机用两个真机做实验,一个配置成vlan10网段的,网关必须指向10.254.另一个配置成vlan20网段的,网关指向20.254。两台机器互相ping必须ping通才说明实现不同vlan的通信。