D. J. Bernstein
Internet publication
djbdns

How to tell a computer to respond to an IP address

Before a computer will talk to the Internet, you have to configure the computer to respond to at least one IP address. In particular, before you can set up a service on a computer, you have to configure the computer to respond to the service's IP address. This is separate from publishing the IP address of the computer.

Two computers can't respond to the same IP address. More precisely:

A single computer can respond to several IP addresses. Multiple IP addresses for a single network card are often called IP aliases.

UNIX systems generally offer three levels of IP-address configuration mechanisms:

The rest of this page shows some system-specific details.

FreeBSD details: first address

A typical use of ifconfig and route is
     ifconfig fxp0 1.8.7.200 netmask 255.255.255.0
     route add default 1.8.7.1
which means three things:

To tell the computer to do all this after each boot, add

     ifconfig_fxp0="inet 1.8.7.200 netmask 255.255.255.0"
     defaultrouter="1.8.7.1"
to /etc/rc.conf.

FreeBSD details: IP aliases

To set up a second IP address, say 1.8.7.246, type
     ifconfig fxp0 1.8.7.246 netmask 255.255.255.255 alias
and add
     ifconfig_fxp0_alias0="inet 1.8.7.246 netmask 255.255.255.255"
to /etc/rc.conf. Use alias1 for the third address, alias2 for the fourth address, etc.

For 127.* addresses, use lo0 instead of fxp0.

Debian GNU/Linux details: first address

A typical use of ifconfig and route is
     ifconfig eth0 1.8.7.200 netmask 255.255.255.0
     route add default gw 1.8.7.1
which means three things:

To tell the computer to do all this after each boot, add

     auto eth0
     iface eth0 inet static
         address 1.8.7.200
	 netmask 255.255.255.0
	 gateway 1.8.7.1
to /etc/network/interfaces.

Debian GNU/Linux details: IP aliases

To set up a second IP address, say 1.8.7.246, type
     ifconfig eth0:0 1.8.7.246 netmask 255.255.255.0
and add
     auto eth0:0
     iface eth0:0 inet static
         address 1.8.7.246
         netmask 255.255.255.0
to /etc/network/interfaces. Use :1 for the third address, :2 for the fourth address, etc.

For 127.* addresses, use lo instead of eth0.

Details for other systems

I realize that this page is incomplete; my apologies.