Hetzner dedicated server with netplan

I am trying to setup hetzner dedicated server with netplan and additional IPs
Anybody willing to share netplan for LXD bridge with additional IPs?


Can you expand a little about what you’re trying to achieve, normally LXD would create the lxdbr0 bridge, so you wouldn’t need to use netplan with it.


Well in Hetzner you got one main IP per server and addidtional IPs which you can use for vps.
From internet perspective all IPs have same macaddress.

In standard install of Lxd lxdbr0 is local network.
I want to assign additional IPs to containers in lxdbr0 (or another bridge) to make them visible outside host.
Host and containers use Ubuntu20.04 where netplan is default network manager.


The routed NIC type is well suited to that scenario. Take a look at https://linuxcontainers.org/lxd/docs/master/instances#nic-routed

You do need to configure the IPs inside the container statically (using which ever network configuration files your container’s distribution uses) or use cloud-init.

See https://blog.simos.info/how-to-get-lxd-containers-get-ip-from-the-lan-with-routed-network/

The problems with using a private bridge like lxdbr0 is are that they are not connected to the external network and that each container will get its own MAC address. This is also a problem with macvlan NICs.

The routed NIC by contrast specifically does not use its own MAC and instead uses the MAC of the host. You can also use the ipvlan NIC type, however that doesn’t allow the container to communicate with the host, only the external network.

The other option is to keep using a private bridge (lxdbr0) and then add proxy devices to your containers that listen on the host’s network interface on your external IPs and forward connections to your container’s internal IP. See https://linuxcontainers.org/lxd/docs/master/instances#type-proxy (the downside of this is that your container won’t know its got an external IP, which can cause problems with some applications).

Wow thx
It is game changer for me
It works like a charm with two IP’s on container eth0 :slight_smile:


1 Like