Migrate from PPA to Snap

Oh, that’s an interesting one and sadly not something we can do a whole lot about as those are directly passed to dnsmasq through its config. For other paths that are LXD config, we have logic to go look at the host path…

At least the error is somewhat clear, or it would be for us making debugging pretty easy should we get a support request or bug report.

Next problem… Even after configuring the new location of the dhcp config its not used. I still keep getting the dynamic addesses. But I don’t want to setup the IP address by configuring the container. I want it to use the hostname and the dnsmasq so its completely dynamic but still gets the IP’s that I have setup for it.


lxd 16278 1 0 15:20 ? 00:00:00 dnsmasq --strict-order --bind-interfaces --pid-file=/var/snap/lxd/common/lxd/networks/lxdbr0/dnsmasq.pid --except-interface=lo --interface=lxdbr0 --quiet-dhcp --quiet-dhcp6 --quiet-ra --listen-address=10.0.4.1 --dhcp-no-override --dhcp-authoritative --dhcp-leasefile=/var/snap/lxd/common/lxd/networks/lxdbr0/dnsmasq.leases --dhcp-hostsfile=/var/snap/lxd/common/lxd/networks/lxdbr0/dnsmasq.hosts --dhcp-range 10.0.3.2,10.0.3.254,1h --listen-address=fd42:6b45:ea69:53b3::1 --enable-ra --dhcp-range ::,constructor:lxdbr0,ra-stateless,ra-names -s lxd -S /lxd/ --conf-file=/var/snap/lxd/common/lxd/networks/lxdbr0/dnsmasq.raw -u lxd


/var/snap/lxd/common/lxd/networks/lxdbr0/dnsmasq.raw contains:
conf-file=/var/snap/lxd/common/lxd/networks/lxdbr0/dns.conf

That was added when starting lxd by the bridge:

root@oev2 ~ # lxc network show lxdbr0
config:
ipv4.address: 10.0.4.1/8
ipv4.dhcp.ranges: 10.0.3.2-10.0.3.254
ipv4.nat: "true"
ipv6.address: fd42:6b45:ea69:53b3::1/64
ipv6.nat: "true"
raw.dnsmasq: conf-file=/var/snap/lxd/common/lxd/networks/lxdbr0/dns.conf


I have cleared all old leases files before restarting lxd (and thus dnsmasq). So why does this not work anymore (it did on lxd 2.2.x).

Your config looks a bit confused between 10.0.4 and 10.0.3 above

What is confusing about it? The bridge is on ip 10.0.4.1 and dnsmasq gives out dynamic IP’s in the range of 10.0.3.2-10.0.3.254.

Is there something wrong in this? It was working on lxd 2.2.x like that :slight_smile:

Oh, sorry, didn’t see the subnet size (/8), yeah, this is fine.
What do you have in your dns.conf?

And what do you all have in /var/snap/lxd/comon/lxd/networks/lxdbr0?
I wonder if this is somehow causing problems with conflicting dhcp-host entries or something.

I changed it a bit because I read somewhere that the fixed IP’s should be in de dhcp range:


root@oev2 ~ # lxc network show lxdbr0
config:
ipv4.address: 10.10.0.1/8
ipv4.dhcp.ranges: 10.10.0.1-10.11.254.254
ipv4.nat: "true"
ipv6.address: fd42:6b45:ea69:53b3::1/64
ipv6.nat: "true"
raw.dnsmasq: conf-file=/var/snap/lxd/common/lxd/networks/lxdbr0/dns.conf
description: ""
name: lxdbr0
type: bridge
used_by:

  • /1.0/containers/kas-demo
  • /1.0/containers/test2
    managed: true
    status: Created
    locations:
  • none

dns.conf:


dhcp-host=kas-helder,10.10.16.1
dhcp-host=kas-demo.lxd,10.10.24.1


I added the domain (lxd) because I saw it when running dnsmasq by hand and checking the output:


dnsmasq-dhcp: RTR-ADVERT(lxdbr0) fd42:6b45:ea69:53b3::
dnsmasq-dhcp: 3090128979 available DHCP range: 10.10.0.1 – 10.11.254.254
dnsmasq-dhcp: 3090128979 client provides name: kas-demo
dnsmasq-dhcp: 3090128979 DHCPDISCOVER(lxdbr0) 10.10.176.91 00:16:3e:c3:2a:20
dnsmasq-dhcp: 3090128979 tags: known, lxdbr0
dnsmasq-dhcp: 3090128979 DHCPOFFER(lxdbr0) 10.10.176.91 00:16:3e:c3:2a:20
dnsmasq-dhcp: 3090128979 requested options: 1:netmask, 28:broadcast, 2:time-offset, 3:router,
dnsmasq-dhcp: 3090128979 requested options: 15:domain-name, 6:dns-server, 119:domain-search,
dnsmasq-dhcp: 3090128979 requested options: 12:hostname, 44:netbios-ns, 47:netbios-scope,
dnsmasq-dhcp: 3090128979 requested options: 26:mtu, 121:classless-static-route, 42:ntp-server
dnsmasq-dhcp: 3090128979 next server: 10.10.0.1
dnsmasq-dhcp: 3090128979 sent size: 1 option: 53 message-type 2
dnsmasq-dhcp: 3090128979 sent size: 4 option: 54 server-identifier 10.10.0.1
dnsmasq-dhcp: 3090128979 sent size: 4 option: 51 lease-time 1h
dnsmasq-dhcp: 3090128979 sent size: 4 option: 58 T1 30m
dnsmasq-dhcp: 3090128979 sent size: 4 option: 59 T2 52m30s
dnsmasq-dhcp: 3090128979 sent size: 4 option: 1 netmask 255.0.0.0
dnsmasq-dhcp: 3090128979 sent size: 4 option: 28 broadcast 10.255.255.255
dnsmasq-dhcp: 3090128979 sent size: 4 option: 3 router 10.10.0.1
dnsmasq-dhcp: 3090128979 sent size: 4 option: 6 dns-server 10.10.0.1
dnsmasq-dhcp: 3090128979 sent size: 3 option: 15 domain-name lxd
dnsmasq-dhcp: 3090128979 sent size: 8 option: 12 hostname kas-demo
dnsmasq-dhcp: 3090128979 available DHCP range: 10.10.0.1 – 10.11.254.254
dnsmasq-dhcp: 3090128979 client provides name: kas-demo
dnsmasq-dhcp: 3090128979 DHCPREQUEST(lxdbr0) 10.10.176.91 00:16:3e:c3:2a:20
dnsmasq-dhcp: 3090128979 tags: known, lxdbr0
dnsmasq-dhcp: 3090128979 DHCPACK(lxdbr0) 10.10.176.91 00:16:3e:c3:2a:20 kas-demo
dnsmasq-dhcp: 3090128979 requested options: 1:netmask, 28:broadcast, 2:time-offset, 3:router,
dnsmasq-dhcp: 3090128979 requested options: 15:domain-name, 6:dns-server, 119:domain-search,
dnsmasq-dhcp: 3090128979 requested options: 12:hostname, 44:netbios-ns, 47:netbios-scope,
dnsmasq-dhcp: 3090128979 requested options: 26:mtu, 121:classless-static-route, 42:ntp-server
dnsmasq-dhcp: 3090128979 next server: 10.10.0.1
dnsmasq-dhcp: 3090128979 sent size: 1 option: 53 message-type 5
dnsmasq-dhcp: 3090128979 sent size: 4 option: 54 server-identifier 10.10.0.1
dnsmasq-dhcp: 3090128979 sent size: 4 option: 51 lease-time 1h
dnsmasq-dhcp: 3090128979 sent size: 4 option: 58 T1 30m
dnsmasq-dhcp: 3090128979 sent size: 4 option: 59 T2 52m30s
dnsmasq-dhcp: 3090128979 sent size: 4 option: 1 netmask 255.0.0.0
dnsmasq-dhcp: 3090128979 sent size: 4 option: 28 broadcast 10.255.255.255
dnsmasq-dhcp: 3090128979 sent size: 4 option: 3 router 10.10.0.1
dnsmasq-dhcp: 3090128979 sent size: 4 option: 6 dns-server 10.10.0.1
dnsmasq-dhcp: 3090128979 sent size: 3 option: 15 domain-name lxd
dnsmasq-dhcp: 3090128979 sent size: 8 option: 12 hostname kas-demo
dnsmasq-dhcp: RTR-ADVERT(lxdbr0) fd42:6b45:ea69:53b3::
dnsmasq-dhcp: RTR-SOLICIT(lxdbr0) 00:16:3e:c3:2a:20
dnsmasq-dhcp: RTR-ADVERT(lxdbr0) fd42:6b45:ea69:53b3::
dnsmasq-dhcp: SLAAC-CONFIRM(lxdbr0) fd42:6b45:ea69:53b3:216:3eff:fec3:2a20 kas-demo
dnsmasq-dhcp: RTR-ADVERT(lxdbr0) fd42:6b45:ea69:53b3::
dnsmasq-dhcp: RTR-ADVERT(lxdbr0) fd42:6b45:ea69:53b3::


Nothing special in the lxdbr0 dir:

root@oev2 /var/snap/lxd/common/lxd/networks/lxdbr0 # ls -al
total 28
drwxr-xr-x 3 root root 4096 May 2 17:41 .
drwxr-xr-x 3 root root 4096 May 2 14:20 …
-rw-r–r-- 1 root root 772 May 2 17:40 dns.conf
drwxr-xr-x 2 root root 4096 May 2 17:41 dnsmasq.hosts
-rw-r–r-- 1 root root 150 May 2 17:41 dnsmasq.leases
-rw-r–r-- 1 root root 5 May 2 17:41 dnsmasq.pid
-rw-r–r-- 1 root root 60 May 2 17:41 dnsmasq.raw

I even removed everything (exect dns.conf) and it was all created back by lxd.

For me this no longer is an issue because I now setup fixed IP’s on every container and found out about the proxy device in lxd. I even now don’t need fixed IP’s anymore :-).

But maybe for others it would be nice if getting fixed IP’s via dnsmasq could be fixed.