Search This Blog

Sunday, April 4, 2010

Bind multiple IPs to a single interface in Ubuntu...

I had came across a situation, where I had to assign more than one IP to a single interface to my Ubuntu host...so here are all the things that I did...

1. Backup the 'interfaces' file, before you make something crappy with the original one :P
user@localhost:~$ sudo cp /etc/network/interfaces /root/interfaces.backup
user@localhost:~$



2. Edit the 'interfaces' file and change is like...
user@localhost:~$ sudo nano /etc/network/interfaces
user@localhost:~$ cat /etc/network/interfaces
auto eth0
auto eth0:0
auto eth0:1

iface eth0 inet static
address 192.168.1.1
netmask 255.255.255.248
gateway 192.168.1.254

iface eth0:0 inet static
address 192.168.1.2
netmask 255.255.255.248
gateway 192.168.1.254

iface eth0:1 inet static
address 192.168.1.3
netmask 255.255.255.248
gateway 192.168.1.254



save it, and close the file.

3. Restart the network service...
user@localhost:~$ sudo /etc/init.d/networking restart


..............Done!!!

No comments:

Post a Comment