Single arm routing (router-on-a-stick) refers to the interconnection and interworking between different VLAN s (virtual LANs) isolated from each other by configuring a sub interface (or "logical interface", there is no real physical interface) on one interface of the router.
vlan10: pc1(192.168.10.10/24) vlan20: pc2(192.168.20.20/24)Experimental purpose Communication between different VLANs
1. Configure sw layer 2 switch
sw#conf t ##Enter global mode Enter configuration commands, one per line. End with CNTL/Z. sw(config)#no ip routing ##Turn off routing sw(config)#vlan 10,20 ##Creating vlan10 20 sw(config-vlan)#ex sw(config)#int f1/1 ##Access interface sw(config-if)#sw mod acc ##Create access link sw(config-if)#sw acc vlan 10 ##Put the interface in vlan sw(config-if)#int f1/2 sw(config-if)#sw mo acc sw(config-if)#sw acc vlan 20 sw(config-if)#do show vlan-sw b ##View vlan information VLAN Name Status Ports ---- -------------------------------- --------- ------------------------------- 1 default active Fa1/0, Fa1/3, Fa1/4, Fa1/5 Fa1/6, Fa1/7, Fa1/8, Fa1/9 Fa1/10, Fa1/11, Fa1/12, Fa1/13 Fa1/14, Fa1/15 10 VLAN0010 active Fa1/1 ##Put the interface in the corresponding vlan 20 VLAN0020 active Fa1/2 1002 fddi-default act/unsup 1003 token-ring-default act/unsup 1004 fddinet-default act/unsup 1005 trnet-default act/unsup sw(config-if)#int f1/0 ##Enter into f1/0 interface sw(config-if)#sw mo tr ##Set to trunk link sw(config-if)#sw tr en dot sw(config-if)#do show int f1/0 switchport ##View interface information
2. Configure R1 router
R1#conf t ##Global schema Enter configuration commands, one per line. End with CNTL/Z. R1(config)#int f0/0.1 ##Enter logical sub interface R1(config-subif)#encapsulation dot1Q 10 ##Encapsulation protocol vlan10 R1(config-subif)#ip add 192.168.10.1 255.255.255.0 ##Setting up gateway R1(config-subif)#no shut ##open R1(config-subif)#ex R1(config)#int f0/0.2 R1(config-subif)#encapsulation dot1Q 20 ##Encapsulation protocol VLAN 20 R1(config-subif)#ip add 192.168.20.1 255.255.255.0 R1(config-subif)#no shut R1(config-subif)#ex R1(config)#int f0/0 ##Enter physical interface R1(config-if)#no shut ##open R1(config-if)#end R1#show ip int b ##View interface information Interface IP-Address OK? Method Status Protocol FastEthernet0/0 unassigned YES unset up up FastEthernet0/0.1 192.168.10.1 YES manual up up FastEthernet0/0.2 192.168.20.1 YES manual up up FastEthernet0/1 unassigned YES unset administratively down down R1#sho ip route ##View routing table C 192.168.10.0/24 is directly connected, FastEthernet0/0.1 C 192.168.20.0/24 is directly connected, FastEthernet0/0.2
3. Test different vlan intermediate communication with testing machine
PC1> ip 192.168.10.10 192.168.10.1 ##Set the address and gateway of pc1 PC2> ip 192.168.20.20 192.168.20.1 ##Setting the address and gateway of pc2 PC1> ping 192.168.20.20 ##Test communication