Answer the question
In order to leave comments, you need to log in
How to configure the host so that the IP of the Openvz container is determined correctly?
The system is running Proxmox 3.4
. The container has access to the Internet. You can connect to it at yyy120.
But for outgoing connections from it, the IP is determined by the host, not the container.
How to solve the problem?
I suspect you need to write iptables rules.
Host network settings:
auto vmbr1
iface vmbr1 inet static
address y.y.y.119
netmask 255.255.255.0
bridge_ports none
bridge_stp off
bridge_fd 0
post-up echo 1 > /proc/sys/net/ipv4/ip_forward
post-up iptables -t nat -A POSTROUTING -s 'y.y.y.119/24' -o eth0 -j MASQUERADE
# Auto gerated lo interface
auto lo
iface lo inet loopback
# Auto generated venet0 interface
auto venet0
iface venet0 inet manual
up ifconfig venet0 up
up ifconfig venet0 127.0.0.2
up route add default dev venet0
down route del default dev venet0
down ifconfig venet0 down
iface venet0 inet6 manual
up route -A inet6 add default dev venet0
down route -A inet6 del default dev venet0
auto venet0:0
iface venet0:0 inet static
address y.y.y.120
netmask 255.255.255.255
Answer the question
In order to leave comments, you need to log in
The complete working config looks like this.
auto eth0
iface eth0 inet static
address x.x.x.107
netmask 255.255.255.0
network x.x.x.0
broadcast x.x.x.255
gateway x.x.x.254
auto vmbr1
iface vmbr1 inet static
address y.y.y.119
netmask 255.255.255.0
bridge_ports none
bridge_stp off
bridge_fd 0
post-up echo 1 > /proc/sys/net/ipv4/ip_forward
post-up iptables -t nat -A POSTROUTING -s 'y.y.y.119/24' -o vmbr1 -j SNAT --to x.x.x.107
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question