Since we are in VPS management service, sometimes we need to add or remove an IP address in the VPS.
Prerequisites
You need Node Server access for these (then only you can manage those VPS), that too SSH root access. The VPS should be either OpenVZ or Virtuozzo.
Steps
Say we are logged into the Node Server. There we are going to list all the Containers existing on the Hardware Node. By default, only running Containers are shown.
[root@linuxvps1 ~]# vzlist -a CTID  NPROC STATUS  IP_ADDR    HOSTNAME 100   18 running 100.20.11.111 WEB.EXAMPLE.COM 101   63 running 100.20.12.203 - 102   169 running 100.20.92.182 server2.example.com 103   81 running 100.20.56.169 test.example.net 78965 236 running 100.20.77.204 server1.example.com
Lets consider the VPS with ID 78965 needs the new IP 100.20.80.200 to be added. So the command will be :
[root@linuxvps1 ~]# vzctl set 78965 --ipadd 100.20.80.200 Adding IP address(es): 100.20.80.200 WARNING: Settings were not saved. On next start the original values will be applied. Use --save to save the settings in the configuration file.
Save the Settings (this command will do the purpose instead of the above one)
[root@linuxvps1 ~]# vzctl set 78965 --save --ipadd 100.20.80.200 Adding IP address(es): 100.20.80.200 Saved parameters for Container 78965.
Thats it, now login to WHM and access ‘Change Site’s IP Address’. Select the website and change the IP address from the drop down list.
To remove an IP from the VPS
[root@linuxvps1 ~]# vzctl set 78965 --save --ipdel 100.20.80.200 Deleting IP address(es): 100.20.80.200 Saved parameters for Container 78965.
Mission Accomplished !
For any further help, do contact our VPS management team ð