Using static IPs with LXD

Hi Simos, thank you, interesting… I’ll have a play around… I want to ssh into various containers on the same host, so I suspect I’ll need to have different ports for ssh on each container…

You either use different ports for each container.

Or, you can set up a bastion host for SSH. You can google for the bastion host and get some nice tutorials.

1 Like

Great, thank you…

The default expiration time for the “managed” lxdbr0 is actually 1h, check the output of:

lxc network get lxdbr0 ipv4.dhcp.expiry

If you check the parameters with which a dnsmasq instance is started you’ll notice the lease expiration set as part of the “--dhcp-range” parameter. According to dnsmasq man pages the parameter accepts a value of “infinite” so this should work for an infinite lease expiration time:

lxc network set lxdbr0 ipv4.dhcp.expiry=infinite

I presume that @stgraber might come up with some edge cases where using this is not advisable or cases when LXD might reinitialize /var/snap/lxd/common/lxd/networks/lxdbr0/dnsmasq.leases leading to loss of “infinite” leases.

1 Like