Technical Resources for Technical People

Adding additional IP’s to DirectAdmin from different subnet/gateway

March 14th, 2012 | Posted by techblog in Linux | Virtualization

If you’re virtualizing DirectAdmin on a XenServer installation, you may wish to add additional ip addresses to the xenserver hypervisor as a gateway before proceeding. However, adding an additional IP to DirectAdmin from a different subnet gateway is also quite similar.

Using the DirectAdmin control panel to add a new ip address only works if the ip you’re adding is on the same subnet using the same gateway/settings as your main ip.

Example: Your directadmin server ip is and this is the ip your license is valid for. You may add a new ip of via the control panel and everything should work fine. (Granted that ip address is assigned to you from your provider).

However adding an ip of (or even is not going to work using this method without some manual intervention first, because it’s not on the same subnet and uses a different gateway.

You will still need to add and assign the ip via the control panel, but we first need to make sure the ip has it’s proper routing to the machine. This will have to be done manually via the command line unless DA adds this feature in some future release. (note: we’re using CentOS 5.7 and DA 1.4x)

What we’re going to do is add a new network script in /etc/sysconfig/network-scripts/. But first let’s check what interface devices we have on the system.

# ifconfig
eth0 Link encap:Ethernet HWaddr AA:BB:CC:DD:EE:FF
 inet addr: Bcast: Mask:
lo Link encap:Local Loopback
 inet addr: Mask:

Here we have our two default interface entries for the system. eth0 holds our main DA ip which is assigned in the license. And we want to add a new ip to the system which is (If you’re virtualizing hardware, you may wish to add and assign a new NIC from your hypervisor, this new ip is going to be added under a new adapter, eth1). However if you’re using a single physical/virtual NIC you’ll need to add an alias by creating eth0:1. If unsure, use an alias.

You’ll be creating a new file and adding your new virtual nic (eth1) or by adding an alias to your existing nic (eth0:1)

# nano /etc/sysconfig/network-scripts/ifcfg-eth1
# nano /etc/sysconfig/network-scripts/ifcfg-eth0:1

The alias method uses the same gateway as your main interface/ip while the new virtual/physical nic may use a different assigned gateway. (If you’re virtualizing, even the virtual nic may sometimes use the same gateway as your main nic as well, such as if you’ve followed our adding additional ip addresses to the xenserver hypervisor as a gateway article).

Before issuing an /etc/init.d/network restart or service network restart, please ensure that you have a fail safe backup in order to gain access to your box if doing this remotely. A simple spelling mistake or miss-stroke of the keyboard could keep your interfaces from loading network connectivity. Not to mention every data center may not work the same as ours.

While it’s likely if secondary interface or alias isn’t configured properly, there will be a hang/timeout when trying to bring the interface up, it could be a tense couple of minutes, but the main interface will still allow you to connect.

Once you have a working alias or interface that accepts pings from another machine you should be good to go (also make sure any iptables or firewall rules are open).

Now you can add and assign your new ip inside of DirectAdmin’s control panel. Any new or additional ip’s of different subnet would be added in the same manner using eth2, eth3 or even eth0:2, eth0:3 etc.

You can follow any responses to this entry through the RSS 2.0 You can leave a response, or trackback.

Leave a Reply

Your email address will not be published. Required fields are marked *