Route IP to LXC Container

chip

Member
Jun 10, 2017
1
0
6
60
Hi together,

currently I'm trying to migrate to proxmox 4. I successfully converted my OpenVZ container to LXC.

Now I need to point my failover IP to this LXC container. The failover IP is without a dedicated MAC address, which means my proxmox host must route the IP to the LXC container itself.

What I have done so far is to connect the failover IP to eth0 which is already working:
Code:
ip addr add xxx.xxx.xxx.xxx/32 dev eth0

But how can I route the IP to my LXC container?
 
What I have done so far is to connect the failover IP to eth0 which is already working:
Code:
ip addr add xxx.xxx.xxx.xxx/32 dev eth0

But how can I route the IP to my LXC container?


Assuming failover IP is 55.66.77.88 and the local container IP is 192.168.10.11 set in Proxmox host

Code:
iptables -t nat -A PREROUTING -d 55.66.77.88 -j DNAT --to-destination 192.168.10.11
iptables -t nat -A POSTROUTING -s 192.168.10.11 -j SNAT --to-source 55.66.77.88


Should work in most cases (i.e. when the protocol works with a NAT).