6

Creating Virtual IP addresses in Ubuntu the easy way

view full story
linux-howto

http://www.liberiangeek.net – I have received multiple requests from some members of our audience on a simple-to-understand tutorial about creating virtual IP addresses in Ubuntu or other Linux distributions. There’s only one solid reason for creating virtual IP addresses on any system, and that is sharing a single network card for multiple IP services on the same system. Traditional, a single IP address is assigned to each network card, but with virtual IP scheme, you can set almost unlimited IP addresses on a single network card.   In this brief tutorial, I’ll show how to create virtual IP addresses in Ubuntu Systems and assign IP addresses to them. This should enable you to have separate IP address for each service installed on the system.   1) Open Ubuntu Terminal Program         2) Edit the network interfaces file by executing the commands below.   vi /etc/network/interfaces   3) To add virtual IP addresses, duplicate the first nic interface (eth0) by placing a colon (:) after it and a number to distinguish the virtual nic. The red text below are virtual IP addresses created by me.   # Primary Network Interface auto lo iface lo inet loopback auto etho iface etho inet dhcp   auto eth0:1 iface eth0:1 inet static address 192.168.0.1 netmask 255.255.255.0 network 192.168.0.0 broadcast 192.168.0.255 auto eth0:2 iface eth0:2 inet static address 192.168.0.2 netmask 255.255.255.0 network 192.168.0.0 broadcast 192.168.0.255 auto eth0:3 iface eth0:3 inet static address 192.168.0.3 netmask 255.255.255.0 network 192.168.0.0 broadcast 192.168.0.255   4) Restart the networking service to enable all the changes by running the command below.   /etc/init.d/networking restart   You can create as many virtual IP addresses as you wish in Ubuntu systems. Just follow the same format above in the red text to create virtual IP address.   That’s all. Come back soon. Join the forum discussion on this post — (1) Posts (HowTos)