Create Virtual Network Adapters in Ubuntu 12.04 (Precise Pangolin)

By default if you have only network interface in Ubuntu, you can only assign one IP address to it. You can not assign multiple IP addresses to one network card. This brief tutorial is going to show you how to create multiple virtual network interfaces in Ubuntu that so you can assign multiple virtual IP addresses. One good reason to do this is if you’re in a LAB environment and want to test multiple programs and services using separate IP addresses, then you need to create a virtual nic card and virtual IP addresses and assign each application its own unique address.

Objectives:

  • Create multiple virtual IP network cards in Ubuntu 12.04 (Precise Pangolin)
  • Enjoy!

To get started, press Ctrl – Alt – T on your keyboard to open Terminal. When terminal opens, run the commands below to edit the network interface file.

sudo gedit /etc/network/interfaces

 

virtual_networks_precise

 

Then add the lines shown below into the file and save it.

auto eth0iface eth0 static     address 192.168.x.x     netmask 255.255.x.x     gateway 291.168.x.xauto eth0:0    (take the physical nic eth0 and add a colon followed by a #)iface eth0:0 static    address 192.168.xx.xx    netmask 255.255.xx.xx    gateway 192.168.xx.xx

 

virtual_networks_precise_1

 

The first thing to remember when creating a virtual network card is, take the one nic card (eth0) and add a colon followed by a number. eg. (eth0:0, eth0:1, eth0:2). The number represents a unique nic. You can create as many as you want.

Also, since each nic must be in a separate network, you must assign a different network address to each network card. eg. (192.168.0.0  , 192.168.1.0, 192.168.2.0)

 

Restart your computer and see the changes.

virtual_networks_precise_2

 

Enjoy!

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>