proxmox in dc with public ips / share one ip between two VMs

yaboc

Renowned Member
Nov 13, 2012
85
2
73
hi

i installed proxmox in DC and got 5 usable IPs. this is fine but i wonder if there's a way to share host WAN IP (1 of 5) between 2 or more LXC containers.

i created a bridge vmbr0 to a WAN port eno1
i also created another bridge vmbr1 not connected to any port for internal network. (11.12.13.1 255.255.255.0)

i spent the better part of the day researching the firewall in proxmox and really like the idea of it and how it works.

i've already created host and 2 other LXC with their private and public IPs and pinging on the private network 11.12.13.0/24 works.

now how would i got about creating LXC container that for example shares host's IP (i guess i'd like to NAT it)
i don't know what I should enter in the ethX that's hoked up to the WAN bridge vmbr0. If i leave it blank it breaks the existing internal connectivity.

if anyone could point me to something that'd allow me to get it to work i'd really appreciate that.
thanks
 
i created a bridge vmbr0 to a WAN port eno1
i also created another bridge vmbr1 not connected to any port for internal network. (11.12.13.1 255.255.255.0)


now how would i got about creating LXC container that for example shares host's IP (i guess i'd like to NAT it)


Can be solved by connecting containers to vmbr1 and NAT connection from there to WAN as follows:

Code:
iptables -t nat -A POSTROUTING -o vmbr0 -s 11.12.13.0/24 -j MASQUERADE
 
dont use masquerade use SNAT cause you have a fixed ip
masquerade is only good for dynamic ips because it has to check continiously if the ip has changed.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!