How to configure a Private IP for an OpenVZ VPS

1. Enter the OpenVZ hardware node.

2. To allow the VE to access the rest of the LAN, we must enable forwarding and masquerading, as all activity on the LAN must look like it is coming directly from host (with its IP address).

-------------------------------
[host-node]# echo 1 > /proc/sys/net/ipv4/ip_forward
[host-node]# iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
--------------------------------

3. Type the command "vzlist" and find the CTID of the VM in question.

4. Use the following command to add ip address to the VM.

-----------------------------
[host-node]# vzctl set CTID --ipadd private_ip --save

eg:- [host-node]# vzctl set 101 --ipadd 192.168.2.1 --save
-----------------------------

5. Restart the VM

[host-node]# vzctl restart CTID

eg:- vzctl restart 101

6. Test the IP address by pinging from the host.

Thank you.

Comments

  1. Very Good Article, Lot of good information, working on my website right now!
    VPS

    ReplyDelete

Post a Comment

Popular posts from this blog

SVN: File remains in conflict

HowTo: Enable extended logging for exim

12 tweakings for WHM/cPanel to speed up WordPress