Adding IPs to Linux Distributions

  1. Generic
  2. Debian
  3. CentOS

Generic
ifconfig DEVICE IPHERE netmask NETMASK
route add default gw GATEWAY

Debian

# vi /etc/network/interfaces
> auto eth0
> iface eth0 inet static
>     address xx.xx.xxx.xx
>     netmask 255.255.255.0
>     gateway xx.xx.xxx.1
# /etc/init.d/networking restart

The gateway only needs to be defined for the first interface on a device. So, for multiple IPs on a single device, you can have as follows:

> auto eth0
> iface eth0 inet static
>     address xx.xx.xxx.xx
>     netmask 255.255.255.0
>     gateway xx.xx.xxx.1
> auth eth0:1
> iface eth0:1 inet static
>     address xx.xx.xxx.xx
>     netmask 255.255.255.0
> auth eth0:1
> iface eth0:2 inet static
>     address xx.xx.xxx.xx
>     netmask 255.255.255.0

CentOS

For CentOS 3-5 you should be using the netconfig command to add IPs and service network restart to cycle the network.