Friday, January 8, 2010

Creating network aliases for single network interface

First some assumptions:
  • network interface is aliased to eth0
  • eth0 assigned to 192.168.1.1
Here's how you assign more than one IP to a single network interface in Ubuntu/Debian:
# ifconfig eth0:0 192.168.1.2 up
That's it.  Wait for a while for the interface to become active and you'll be able to configure services to serve from that IP.  To make the change permanent, edit the /etc/network/interfaces file and add the following lines:
auto eth0:0
iface eth0:0 inet static
        address 192.168.1.2
        netmask 255.255.255.0
        gateway 192.168.1.0


No comments: