Sunday, December 18, 2011

Router on a Stick With GNS3


Advertisement

Advertisement
"Router on a stick" is a common introductory networking pattern that utilizes 2 or more hosts (on separate VLANs) and a switch with a trunk port to a router. This is a common introductory scenario utilized in the CCNA and CCNP training materials. It is also likely utilized in a number of it training courses for internetworking technologies.

To demonstrate a simple Cisco router on a stick configuration, I utilize a Cisco c3725 configured as a switch, two linux hosts, and a Cisco c7200 router to act as the gateway between the networks. The host named 172Host has the IP address 172.16.1.2/24 and its connected switch port is on VLAN 1. VLAN 2 host the 192Host with IP address 192.168.0.2/24. The c7200 has two subinterfaces on fa0/0: FastEthernet 0/0.1 with IP address 172.16.0.1/24 and FastEthernet 0/0.2 with IP address 192.168.0.1/24. The FastEthernet 0/0 interface is connected to the FastEthernet 1/2 port on the switch and this port is configured for trunking (using 802.1q encapsulation).


172Host and 192Host are Linux systems, the important pieces of the configuration are shown below (this can be verified using the ifconfig -a and the route command). This includes setting the IP address and default gateway.

root@192Host:~# ifconfig eth0 192.168.0.2 mask 255.255.255.0
root@192Host:~# route add default gw 192.168.0.1 eth0

root@172Host:~# ifconfig eth0 172.16.0.2 mask 255.255.255.0
root@172Host:~# route add default gw 172.16.0.1 eth0 
 
The important pieces of the configuration on R1 and S1 are shown below,
PRef
 
!!!!!!!!!!!!!
! On S1     !
!!!!!!!!!!!!! 
!
interface FastEthernet1/0
!
interface FastEthernet1/1
 switchport access vlan 2
!
interface FastEthernet1/2
 switchport mode trunk
!
!!!!!!!!!!!!!
! On R1     !
!!!!!!!!!!!!!
interface FastEthernet0/0
 no ip address
 duplex auto
 speed auto
!
interface FastEthernet0/0.1
 encapsulation dot1Q 1 native
 ip address 172.16.0.1 255.255.255.0
!
interface FastEthernet0/0.2
 encapsulation dot1Q 2
 ip address 192.168.0.1 255.255.255.0
!
  
After the configuration is complete, a full inter-VLAN routing solution is complete and 172Host and 192Host can successfully ping each other.

root@172Host:~# ping -c 4 192.168.0.2
PING 192.168.0.2 (192.168.0.2): 56 data bytes
64 bytes from 192.168.0.2: seq=0 ttl=63 time=18.025 ms
64 bytes from 192.168.0.2: seq=1 ttl=63 time=24.678 ms
64 bytes from 192.168.0.2: seq=2 ttl=63 time=21.445 ms
64 bytes from 192.168.0.2: seq=3 ttl=63 time=17.711 ms

--- 192.168.0.2 ping statistics ---
4 packets transmitted, 4 packets received, 0% packet loss
round-trip min/avg/max = 17.711/20.464/24.678 ms

root@192Host:~# ping -c 4 172.16.0.2
PING 172.16.0.2 (172.16.0.2): 56 data bytes
64 bytes from 172.16.0.2: seq=0 ttl=63 time=17.665 ms
64 bytes from 172.16.0.2: seq=1 ttl=63 time=14.784 ms
64 bytes from 172.16.0.2: seq=2 ttl=63 time=22.809 ms
64 bytes from 172.16.0.2: seq=3 ttl=63 time=18.777 ms

--- 172.16.0.2 ping statistics ---
4 packets transmitted, 4 packets received, 0% packet loss
round-trip min/avg/max = 14.784/18.508/22.809 ms
 
 
See Also,
Connect GNS3 and Hyper-V
Emulating a Managed Switch with Dynamips/GNS3
The Road to the CCIE

No comments:

Post a Comment