2012-06-12

How-to add a permanent network interface alias on Ubuntu 10.04 and higher

1. Add network interface alias by adding following into /etc/network/interfaces:
# Alias interface
auto eth0:0
iface eth0:0 inet static
  address 192.168.1.1
  netmask 255.255.255.0

2. Create a new file and place it in /etc/network/if-up.d/:
#!/bin/bash

if [ "$IFACE" = "eth0" ]; then
        /sbin/ifup --force eth0:0
fi

3. Restart network via Network Manager or command line:
sudo /etc/init.d/networking restart