I need help:
I have a dedicated baremetal server on Hetzner, with 6 public IPs assigned to
enp35s0, and 6 LXD containers and I want each container to use one of the public IPs. One LXC will share IP with host, ofcource, but the rest 5 must have each own public IP and do not send or receive anything via host’s primary IP, only using it’s own.
I tried several manuals but nothing worked fine.
Macvlan method didn’t work at all. (Maybe I’ve done something wrong…)
While alias + iptables masquarade method allowed me to ssh to container via it’s public IP, the container itself continues to use the main host’s IP as adefault. (
links https://whatsmyip.com shows host’s primary IP, not container’s one)
I believe macvlan doesn’t work on hetzner because they restrict the network port to only be allowed one MAC address. Although worth confirming that with them.
Others on this forum have successfully used the
routed NIC type with hetzner to pass external IPs into their containers.
lxc config device add CTNAME eth0 nic nictype=macvlan parent=YOURNIC hwaddr=MAC
Replace MAC with your hetzner public ip mac address.
It works by default with DHCP.
Keep in mind you can only have 1 per container per MAC address though with macvlan, and it may prevent host communication. Unless you can get Heztner to allow multiple MACs.
Yeah, that is possible.
Each IP address can have its own mac address.
Thank you, @TomvB. I’l try this method.
Will also try. Thank you @tomp.
I will write if it worked or not for me.
I’ve tried it and it worked!