创建VLAN10 20,将PC分别加入到VLAN10 20
[sw2]vlan batch 10 20
[sw1]int e0/0/1
[sw1-Ethernet0/0/1]port link-type access
[sw1-Ethernet0/0/1]port default vlan 10
[sw1-Ethernet0/0/1]int e 0/0/2
[sw1-Ethernet0/0/2]port link-type access
[sw1-Ethernet0/0/2]port default vlan 20
[sw1-Ethernet0/0/2]int e0/0/3
[sw1-Ethernet0/0/3]port link-type trunk
[sw1-Ethernet0/0/3]port trunk allow-pass vlan 10 20
创建VLAN30 40,将PC分别加入到VLAN30 40
[sw2]vlan batch 30 40
[sw2]int e0/0/1
[sw2-Ethernet0/0/1]port link-type access
[sw2-Ethernet0/0/1]port default vlan 30
[sw2-Ethernet0/0/1]int e0/0/2
[sw2-Ethernet0/0/2]port link-type access
[sw2-Ethernet0/0/2]port default vlan 40
[sw2-Ethernet0/0/2]int e0/0/3
[sw2-Ethernet0/0/3]port link-type trunk
[sw2-Ethernet0/0/3]port trunk allow-pass vlan 30 40
R1上设置单臂路由(子接口设IP,去标签,ARP广播)
[R1]int g0/0/0.1
[R1-GigabitEthernet0/0/0.1]ip address 192.168.10.254 24
[R1-GigabitEthernet0/0/0.1]dot1q termination vid 10
[R1-GigabitEthernet0/0/0.1]arp broadcast enable
[R1-GigabitEthernet0/0/0.1]int g0/0/0.2
[R1-GigabitEthernet0/0/0.2]ip address 192.168.20.254 24
[R1-GigabitEthernet0/0/0.2]dot1q termination vid 20
[R1-GigabitEthernet0/0/0.2]arp broadcast enable
设置路由表
[R1]ip route-static 192.168.30.0 24 192.168.50.2
[R1]ip route-static 192.168.40.0 24 192.168.50.2
R2上设置单臂路由(子接口设IP,去标签,ARP广播)
[r2]int g0/0/0.2
[r2-GigabitEthernet0/0/0.2]ip address 192.168.40.254 24
[r2-GigabitEthernet0/0/0.2]dot1q termination vid 40
[r2-GigabitEthernet0/0/0.2]arp broadcast enable
[r2]int g0/0/0.1
[r2-GigabitEthernet0/0/0.1]ip address 192.168.30.254 24
[r2-GigabitEthernet0/0/0.1]dot1q termination vid 40
[r2-GigabitEthernet0/0/0.1]arp broadcast enable
[r2-GigabitEthernet0/0/0.2]int g0/0/1
[r2-GigabitEthernet0/0/1]ip address 192.168.50.2 24
设置路由表
[r2] ip route-static 192.168.10.0 24 192.168.50.1
[r2]ip route-static 192.168.20.0 24 192.168.50.1
效果验证
原文地址:http://blog.51cto.com/14159400/2344788