Lab #3a – Routing vlans with 1 nic on Ubuntu Linux

Posted: October 27, 2011 in Routing, Ubuntu Linux
Tags: ,

Purpose:

We want create a router with Ubuntu Linux that can route packet over two vlans.

 

Topology:

Routing vlans with 1 nic

Requirements:

  • The router: Ubuntu Linux virtual machine with 1 nic.
  • Clients: 2 OpenBSD virtual machine.
  • Switch: Cisco 2960 (24 ports 10/100/1000)

Tasks for switch configuration:

Configure the port 10, 20 and 24 as follow:

.

.

interface GigabitEthernet0/10

description CLIENT01

switchport access vlan 10

switchport mode access

spanning-tree portfast

.

.

interface GigabitEthernet0/20

description CLIENT02

switchport access vlan 20

switchport mode access

spanning-tree portfast

.

.

interface GigabitEthernet0/24

description TRUNK TO ROUTER

switchport mode trunk

.

.

Tasks for router configuration:

Install vlan support with “apt-get” command.

Lab 3a  Ubuntu Router  Installazione supporto vlan

Edit the file “/etc/network/interfaces” on the Ubuntu Linux router and configure the vlans.

Lab 3a  Ubuntu Router  Configurazione vlan

Edit the file “/etc/sysctl.conf on the Ubuntu Linux router and enable ip forwarding: change the value of “net.ipv4.ip_forward” from 0 to 1. When the router reboot, the ip forwarding remain enabled.

Enable ip forwarding “on the fly” with “sysctl” command.

Load “8021q” kernel module; after a reboot the module is loaded automatically.

Lab 3a  Ubuntu Router  Caricamento modulo 8021q

Refresh network setting with “/etc/init.d/networking restart” command.

Lab 3a  Ubuntu Router  Refresh impostazioni rete

Tasks for clients configuration:

Identify your nic: in my virtual machine the nic is “vic0″. Edit the file “/etc/hostname.vic0″ and set the ip address on the first client.Edit the file “/etc/mygate” and set the default gateway on the first client.Refresh network setting with “sh /etc/netstart vic0″ command.Edit the file “/etc/hostname.vic0″ and set the ip address on the second client.Edit the file “/etc/mygate” and set the default gateway on the second client.Refresh network setting with “sh /etc/netstart vic0″ command.

Test:

Make a simple test from the first client.

Make a simple test from the second client.

Enjoy your Ubuntu router!

About these ads
Comments
  1. Wow! This could be one particular of the most helpful blogs Weve ever arrive across on this subject. Actually Great. Im also an expert in this topic therefore I can understand your hard work.

  2. thank you for your article,My problem has been resolved.

  3. very good post, i surely enjoy this web site, persist with it

  4. It’s a nice blog you have over here! It’s very usefull information for me and I just want to thank you for that! If you post more threads as this one, I’ll follow your blog active!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s