单臂路由试验
拓扑:
说明:
单臂路由是为了降低成本,在R1的FA0/0口创建子接口。分别封装进VLAN10和20。在SW1上创建VLAN10,20,将PC1划分到VLAN 10,PC2划分到VLAN 20,FA1/5划分进TRUNK,PC1的网关是FA0/0.1的ip。PC2的网关是FA0/0.2的ip
SW1:
Router>en
Router#conf t
Router(config)#host SW1
SW1#vlan da
SW1(vlan)#vlan 10
VLAN 10 added:
Name: VLAN0010 (创建vlan)
SW1(vlan)#vlan 20
VLAN 20 added:
Name: VLAN0020
SW1(vlan)#exi...
SW1#conf t
SW1(config)#int fa1/11
SW1(config-if)#sw mo ac
SW1(config-if)#switchport access vlan 10
SW1(config-if)#exi
SW1(config)#int fa1/12
SW1(config-if)#sw mo ac
SW1(config-if)#sw ac vlan 20
SW1(config-if)#exi
SW1(config)#int fa1/5
SW1(config-if)#switchport trunk encapsulation do
SW1(config-if)#sw mode trunk
R1:
Router>en
Router#conf t
Router(config)#host R1
R1(config)#int fa0/0
R1(config-if)#no sh
R1(config-if)#exi
R1(config)#int fa0/0.1 (创建子接口)
R1(config-subif)#ip add 10.1.1.254 255.255.255.0
R1(config-subif)#exi
R1(config)#ip routing
R1(config)#int fa0/0.1
R1(config-subif)#encapsulation do 10 (封装进vlan 10)
R1(config-subif)#ip add 10.1.1.254 255.255.255.0
R1(config-subif)#no sh
R1(config-subif)#int fa0/0.2
R1(config-subif)#encapsulation dot1Q 20
R1(config-subif)#ip add 10.1.2.254 255.255.255.0
R1(config-subif)#no sh
PC1:
Router>en
Router#conf t
PC1(config)#int fa0/0
PC1(config-if)#ip add 10.1.1.1 255.255.255.0
PC1(config)#no ip routing
PC1(config)#ip default-gateway 10.1.1.254
PC1(config)#int fa0/0
PC1(config-if)#no sh
PC2
Router>en
Router#conf t
Router(config)#HOST PC2
PC2(config)#no ip routing
PC2(config)#int fa0/0
PC2(config-if)#ip add 10.1.2.1 255.255.255.0
PC2(config-if)#no sh
PC2(config)#ip default-gateway 10.1.2.254
测试:
PC1#ping 10.1.1.254
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.1.1.254, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 24/292/1248 ms
PC1#ping 10.1.2.254
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.1.2.254, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 44/55/72 ms
PC1#ping 10.1.2.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.1.2.1, timeout is 2 seconds:
..!!!