Tag Archives: Sub intefaces

Adding Sub-Interfaces and IP addresses on Ubuntu 14.04LTS

If you have been given your own private subnet (we still say /29) from your hosting provider and have 5 websites that need their own dedicated IP address. You will be able to add sub-interfaces onto a single NIC (network interface card), and assign each sub-interface with its own dedicated IP address from the subnet.

You will need to be either root or have an user with sudo privileges

1. Edit the interfaces file within the network folder

sudo nano /etc/network/interfaces

2. Add the additional IP addresses under eth0

# The primary network interface 10.10.10.10 - 14 are usable IP addresses
auto eth0
iface eth0 inet static
address 10.10.10.10
netmask 255.255.255.248
gateway 10.10.10.9

# The Rest of the IP addresses in the /29
auto eth0:1
iface eth0:1 inet static
address 10.10.10.11
netmask 255.255.255.248
gateway 10.10.10.9

auto eth0:2
iface eth0:2 inet static
address 10.10.10.12
netmask 255.255.255.248
gateway 10.10.10.9

3. Restart the network daemon

sudo /etc/init.d/networking restart

4. Enable the new sub-interface

sudo ifup eth0:1

This will create a NIC alias and therefore allow you add additional IP addresses. This can be done for up to 254 IP addresses

Share this:
Share