I am writing this tutorial to refresh my mind ( I am not configuring the machine right now ), so forgive me if the explanations are not clear and structured.
After successfully installed the OpenVZ, you need to configure the IP for the containers. If you are using the built in “Venet” you will end up making the host as the gateway. In the other words if you traceroute to your container IP, it will going through your host then to your container. Here are the sample of the scenario :
Host IP : 22.214.171.124
Container 1 : 126.96.36.199
Container 2 : 188.8.131.52
Basically if you use the venet, if you traceroute to the Container 1 the result should be : Your ISP –> 184.108.40.206 –> 220.127.116.11 so the IP of the Host is showed up. Same if you try to traceroute to the second container. Thus, my solution to overcome this problem are :
Make a bridge using brctl command
Use the Veth instead of Venet
Put all the Veth into the bridge
Assign the Host IP to the bridge
If you are not ASSIGN the host IP to the bridge, you can’t access the host machine. I followed the guidelines from this link http://wiki.openvz.org/Using_veth_and_brctl_for_protecting_HN_and_saving_IP_addresses
Here is my /etc/rc.local configuration looks like :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
I’ll update this post if I need to configure another VPS Server.