Earlier I’ve posted an article describing how to add multiple ip addresses on a single network device.
Even though you can add IP addresses on Direct Admin using it’s GUI, unfortunately the GUI fails if the netmask or the gateway is different. So if you have a server running Direct Admin with the IP address 10.10.10.5 and you want to add a new IP address like 192.168.16.7 then you’ll run into some problems.
To deal with it, we can add the IP’s manually. You can either add the IP’s to a new device, or an alias to a present device.
Let’s first learn what device we’re using.
ifconfig
This will probably return something like “eth0” which is he device.
If you’d like to add your new IP as an alias to this one, simple create the file below:
vi /etc/sysconfig/network-scripts/ifcfg-eth0:1
DEVICE=eth0:1 BOOTPROTO=none ONBOOT=yes IPADDR=192.168.10.7 NETMASK=255.255.255.248
Note that there’s no Gateway specified here, so if you’d like to add an IP address with a different gateway, create the file below (with your own settings ofcouse)
vi /etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE=eth1 BOOTPROTO=static ONBOOT=yes HWADDR=AA:BB:CC:DD:EE:FF IPADDR=192.168.10.7 NETMASK=255.255.255.248 GATEWAY=192.168.10.1
After this, just restart your network service. (Don’t forget that if you do anything wrong, you probably won’t be able to reach your server over network)
service network restart