I'm working on migrating a server again today and we decided that we want to put some of the services on 1 IP and the others on another so if we ever need to move one set of services over the IP can follow. This is the machine that is running Ubuntu 8.04 Server.
It turns out this is a pretty simple thing to do. First, edit your interfaces file:sudo nano -w /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet dhcp
Then add in a few new lines below the eth0 section to create a new virtual interface:
auto eth0:0Then restart your networking:
iface eth0:0 inet static
address 10.10.10.200
netmask 255.255.255.0
$ sudo /etc/init.d/networking restart
And there you have it, your new virtual interface with your new IP.
$ ifconfig
eth0 Link encap:Ethernet HWaddr 00:1d:09:15:74:af
inet addr:10.10.10.122 Bcast:10.10.10.255 Mask:255.255.255.0
inet6 addr: fe80::21d:9ff:fe15:74af/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:52 errors:0 dropped:0 overruns:0 frame:0
TX packets:42 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:9780 (9.5 KB) TX bytes:5388 (5.2 KB)
Interrupt:17
eth0:0 Link encap:Ethernet HWaddr 00:1d:09:15:74:af
inet addr:10.10.10.200 Bcast:10.10.10.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interrupt:17
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:38081 errors:0 dropped:0 overruns:0 frame:0
TX packets:38081 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:1614360 (1.5 MB) TX bytes:1614360 (1.5 MB)
Thanks go to NukeSilo.com for getting me started and the Debian guide on Network configuration for all the details.