Wednesday, June 12, 2013

InterVLAN Routing using Ubuntu with 1 Interface


Scenario:


  • Router: Ubuntu Server with 1 network card.

  • Clients: 2 WindowsXP in VLAN10,1 Ubuntu and 1 CentOS in VLAN20.

  • Switch: Cisco 2960


Cisco 2960 Switch Configuration:

interface FastEthernet0/1
description CONNECTED TO UBUNTU ROUTER
switchport mode trunk
!
!
!
interface FastEthernet0/5
description WINXP-1
switchport access vlan 10
switchport mode access
!
interface FastEthernet0/6
description WINXP-2
switchport access vlan 10
switchport mode access
!
!
!
interface FastEthernet0/15
description UBUNTU CLIENT
switchport access vlan 20
switchport mode access
!
interface FastEthernet0/16
description CentOS CLIENT
switchport access vlan 20
switchport mode access

Ubuntu Router Configuration:

To install the vlan support on ubuntu, use this command:
sudo apt-get install vlan



Now we shall configure the vlans on Ubuntu router by editing the /etc/network/interfaces:
sudo nano /etc/network/interfaces





To enable ip forwarding, edit /etc/sysctl.conf file:
sudo nano /etc/sysctl.conf



Change net.ipv4.ip_forward from 0 to 1:



Load “8021q” kernel module:



(Optional): If the Ubuntu router didn’t load the 8021q kernel module at boot time, then use this command to add the module to the kernel on boot:
sudo su -c 'echo "8021q" >> /etc/modules'



Restart the Networking service:
sudo /etc/init.d/networking restart



Use the ifconfig command to check the newly created vlan interfaces:
ifconfig



Verify the vlan configuration:
sudo cat /proc/net/vlan/config



Test from WinXP-1:



Test from WinXP-2:



Test from Ubuntu Client:





Test from CentOS Client:





Hope this will help you!

No comments:

Post a Comment