Quantcast
Viewing latest article 7
Browse Latest Browse All 7

InterVLAN Routing with Internet Access on Ubuntu

Image may be NSFW.
Clik here to view.
topology

Scenario:

  • Router: Ubuntu Server with 1 network card.
  • Clients:  WindowsXP in VLAN10,Windows7 in VLAN20.
  • Internet: Internet Router on VLAN30
  • Switch: Cisco 2960
Cisco 2960 Switch Configuration:
interface FastEthernet0/12
description CONNECTED TO UBUNTU ROUTER
switchport mode trunk
!
!
interface FastEthernet0/1
description WINXP
switchport access vlan 10
switchport mode access
!
!
interface FastEthernet0/2
description Win7
switchport access vlan 20
switchport mode access
!
!
interface FastEthernet0/24
description Internet Router
switchport access vlan 30
switchport mode access

Ubuntu Router Configuration:

To install the vlan support on ubuntu, use this command:

sudo apt-get install vlan

Image may be NSFW.
Clik here to view.
1

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

sudo nano /etc/network/interfaces

Image may be NSFW.
Clik here to view.
1

Image may be NSFW.
Clik here to view.
2

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

sudo nano /etc/sysctl.conf

Image may be NSFW.
Clik here to view.
2

Change net.ipv4.ip_forward from 0 to 1:

Image may be NSFW.
Clik here to view.
3

Load “8021q” kernel module:

sudo modprobe 8021q

Image may be NSFW.
Clik here to view.
4

Restart the Networking service:

sudo /etc/init.d/networking restart

Image may be NSFW.
Clik here to view.
5

Verify the vlan configuration:

sudo cat /proc/net/vlan/config

Image may be NSFW.
Clik here to view.
6

In order to provide internet access to Vlan 10 and 20 client(s), we need to do NAT on Vlan 30 interface, on which we have configured the Gateway:

sudo iptables -t nat -A POSTROUTING -o vlan30 -j MASQUERADE

Image may be NSFW.
Clik here to view.
3

Verify the routing information on Ubuntu:

sudo route -n

Image may be NSFW.
Clik here to view.
4

Test from WinXP:

Image may be NSFW.
Clik here to view.
5

Image may be NSFW.
Clik here to view.
6

Image may be NSFW.
Clik here to view.
7

Test from Win7:

Image may be NSFW.
Clik here to view.
8

Image may be NSFW.
Clik here to view.
9

Image may be NSFW.
Clik here to view.
10

Hope this will help you!

Please Remember me in your prayers!

[contact-form]
Image may be NSFW.
Clik here to view.
Image may be NSFW.
Clik here to view.

Viewing latest article 7
Browse Latest Browse All 7

Trending Articles