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 172.16.1.123 and this is the ip your license is valid for. You may add a new ip of 172.16.1.124 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 172.16.17.124 (or even 10.10.30.11) 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:172.16.1.123 Bcast:172.16.1.255 Mask:255.255.255.0 ...
lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 ...
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 10.10.10.3. (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
DEVICE=eth1 BOOTPROTO=static ONBOOT=yes HWADDR=AA:BB:CC:DD:EE:FF IPADDR=10.10.10.3 NETMASK=255.255.255.252 GATEWAY=10.10.10.1
# nano /etc/sysconfig/network-scripts/ifcfg-eth0:1
DEVICE=eth0:1 BOOTPROTO=none ONBOOT=yes IPADDR=10.10.10.3 NETMASK=255.255.255.252
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.
Leave a Reply