路由器1上设置:
<H3C>sys
System View: return to User View with Ctrl+Z.
[H3C]user-interface vty 0 63
[H3C-line-vty0-63]authentication-mode password
[H3C-line-vty0-63]set authentication password simple wudi
[H3C-line-vty0-63]exit
[H3C]dis ip int b
*down: administratively down
(s): spoofing (l): loopback
Interface Physical Protocol IP Address Description
GE0/0 up up -- --
GE0/1 down down -- --
GE0/2 down down -- --
GE5/0 down down -- --
GE5/1 down down -- --
GE6/0 down down -- --
GE6/1 down down -- --
Ser1/0 down down -- --
Ser2/0 down down -- --
Ser3/0 down down -- --
Ser4/0 down down -- --
[H3C]int g0/0.1
[H3C-GigabitEthernet0/0.1]vlan-type dot1q vid 2
[H3C-GigabitEthernet0/0.1]ip address 192.168.10.1 255.255.255.0
[H3C-GigabitEthernet0/0.1]int g0/0.2
[H3C-GigabitEthernet0/0.2]vlan-type dot1q vid 3
[H3C-GigabitEthernet0/0.2]ip add 192.168.20.1 255.255.255.0
[H3C-GigabitEthernet0/0.2]exit
[H3C]dis history-command
int g0/0
quit
int g0/0.1
vlan-type dot1q vid 2
ip address 192.168.10.1 255.255.255.0
int g0/0.2
vlan-type dot1q vid 3
ip add 192.168.20.1 255.255.255.0
quit
dis curr
[H3C]dis ip int b
*down: administratively down
(s): spoofing (l): loopback
Interface Physical Protocol IP Address Description
GE0/0 up up -- --
GE0/0.1 up up 192.168.10.1 --
GE0/0.2 up up 192.168.20.1 --
交换机2上的设置:
[H3C]int g1/0/10
[H3C-GigabitEthernet1/0/10]port link-type trunk
[H3C-GigabitEthernet1/0/10]port trunk permit vlan all
[H3C-GigabitEthernet1/0/10]exit
[H3C]vlan 2
[H3C-vlan2]port g1/0/12
[H3C-vlan2]vlan 3
[H3C-vlan3]port g1/0/13
[H3C-vlan3]exit
[H3C]int g1/0/11
[H3C-GigabitEthernet1/0/11]port link-type trunk
[H3C-GigabitEthernet1/0/11]port trunk permit vlan all
交换机3上的设置:
<H3C>sys
System View: return to User View with Ctrl+Z.
[H3C]int g1/0/11
[H3C-GigabitEthernet1/0/11]port link-type trunk
[H3C-GigabitEthernet1/0/11]port trunk permit vlan all
[H3C-GigabitEthernet1/0/11]exit
[H3C]vlan 2
[H3C-vlan2]port g1/0/12
[H3C-vlan2]vlan 3
[H3C-vlan3]port g1/0/13
验证:
当路由器1上配置后,不同的VLAN间是可以通讯的;否则只有相同vlan才能通讯。