How to Bind IP's to a Debian/Ubuntu Linux Server

From Ubiquity Server Wiki

Jump to: navigation, search

To bind additional IP's that have been provisioned for you to a Debian or Ubuntu server, simply follow the following procedure.


1. Edit the network interfaces configuration file: nano /etc/network/interfaces
2. Add the following lines to the end of the file, replacing x with the next unused number (starting at 0): auto eth0:x - and omitting the brackets

iface eth0:x inet static
address [IP Address]
netmask [Network Mask]
  • An example for multiple IP addresses (first three usable in a /29 with a netmask of 255.255.255.248):
auto eth0
iface eth0 inet static
address 192.168.0.2
netmask 255.255.255.248
gateway 192.168.0.1 

auto eth0:0
iface eth0:0 inet static
address 192.168.0.3
netmask 255.255.255.248
gateway 192.168.0.1 

auto eth0:1
iface eth0:1 inet static
address 192.168.0.4
netmask 255.255.255.248
gateway 192.168.0.1
  • You'll notice that the eth0:x value increased for next IP assigned to the interface and that the last numerical value in the address line which would be the next available IP.


3. Save the file by pressing Ctrl+X, hitting Y to confirm, and Enter to save.
4. Then restart the network:

/etc/init.d/networking restart
  • If you have any questions concerning what netmask to use, you can find netmask listings at the following link:
http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing
  • That's per standard CIDR notation and doesn't apply universally as you may have addresses assigned to a VLAN, in which case you'd use a different netmask, most likely 255.255.255.0. When in doubt, please feel free to inquire with our support team.