Thursday, January 22, 2009

A quick example of how to configure on Debian both a static and a dynamic (DHCP) IP address using single interface.

Your interfaces file should look like this:


# 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
allow-hotplug eth0
auto eth0
iface eth0 inet dhcp

auto eth0:1
iface eth0:1 inet static
address 192.168.31.81
netmask 255.255.255.0
network 192.168.31.0
gateway 192.168.31.254