ads2

Thursday, 3 January 2013

Inter vlan routing on gns3 | Router on stick configuration

Network devices in different VLANs cannot communicate with one another without a router to route traffic between the VLANs. In most network environments, VLANs are associated with individual networks or subnetworks. There are two ways to communicate different VLANs with each other.
      1. Inter vlan 
      2. Switch virtual interface SVI 

How inter VLAN works: 

Inter VLAN communicate different VLANs via sub interfaces that we have create on router for each VLANs. When Host A in VLAN 10 needs to communicate with Host B in VLAN 10, it sends a packet addressed to that host. Switch A forwards the packet directly to Host B, without sending it to the router.
When Host A in VLAN 10 sends a packet to Host B in VLAN 20, Switch forwards the packet to the router, which receives the traffic on the VLAN 10 interface sub interface and forwards this to sub interface for VLAN 20.
To implement interVLAN on gns3 I use the follow simple topology. In which R1 have two sub interfaces int f0/0.10 and int f0/0.20 for VLANs 10 and 20 respectively. And we use only two PC, one belong to VLAN 10 and other to 20.   
 
 
Configuration for Router R1:
R2(config)#interface f0/0
R2(config-if)#no shutdown
R2(config-subif)#interface f0/0.20
R2(config-subif)#encapsulation dot1Q 20
R2(config-subif)#ip address 20.1.1.1 255.255.255.0
R2(config-subif)#interface f0/0.10
R2(config-subif)#encapsulation dot1Q 10
R2(config-subif)#ip address 10.1.1.1 255.255.255.0
Configuration for Switch:
SW#vlan database
SW(vlan)#vlan 10 name office1
SW(vlan)#vlan 20 name office2
SW(vlan)#exit
SW(config)#interface f1/0
SW(config-if)#no shutdown
SW(config-if)#switchport mode trunk
SW(config-if)#interface f0/0
SW(config-if)#no shutdown
SW(config-if)# switchport mode access
SW(config-if)# switchport access vlan 10
SW(config-if)#interface f0/1
SW(config-if)#no shutdown
SW(config-if)#switchport mode access
SW(config-if)# switchport access vlan 20
Configuration for Qemu1
tc@box:$ sudo su 
root@box:$ Ifconfig eth0 10.1.1.2 netmask 255.255.255.0
root@box:$ Route add default gw 10.1.1.1 eth0
Configuration for Qemu2
tc@box:$ sudo su 
root@box:$ Ifconfig eth0 20.1.1.2 netmask 255.255.255.0
root@box:$ Route add default gw 20.1.1.1 eth0
Results:
Ping from qemu1 to qemu2 is successful and voice versa


No comments:

Post a Comment