Monday, 3 December 2012

How To Add Private IP in OpenVZ VPS

First we need to configure a private IP and its route in VPS Node and ensure that private network is available on Node. Then follow the steps below.

1) Add private IP to VPS.

 vzctl set <VEID> --ipadd <private IP> --save
 vzctl set 100 --ipadd --save

2) Add routing rules as follows.

 ip ro add <private network range> via <gateway of private IP>
 ip ro add via

Here we are using the VEs own private IP as the gw to work the private IP in VPS, no need to use its original gateway(like, it wont work.