[solved]Dhcp issue inside LXC container

After a long fight due to my lack of network skill, I finally got Openwrt 22.03 working inside a LXC container.
I found out a weirdness regarding dhcp server: I need to manually restart dnqmasq to offer dns addresses, so it looks like my configuration (which is almost the default one) is good.
What should i do to debug such issue?
The container is attached to a bridge without internet access
Following the logread output

Starting container

Mon May  1 21:30:08 2023 authpriv.info dropbear[1279]: Not backgrounding
Mon May  1 21:30:08 2023 user.notice : Added device handler type: bonding
Mon May  1 21:30:08 2023 user.notice : Added device handler type: 8021ad
Mon May  1 21:30:08 2023 user.notice : Added device handler type: 8021q
Mon May  1 21:30:08 2023 user.notice : Added device handler type: macvlan
Mon May  1 21:30:08 2023 user.notice : Added device handler type: veth
Mon May  1 21:30:08 2023 user.notice : Added device handler type: bridge
Mon May  1 21:30:08 2023 user.notice : Added device handler type: Network device
Mon May  1 21:30:08 2023 user.notice : Added device handler type: tunnel
Mon May  1 21:30:09 2023 daemon.notice netifd: Interface 'lan' is enabled
Mon May  1 21:30:09 2023 daemon.notice netifd: Interface 'lan' is setting up now
Mon May  1 21:30:09 2023 daemon.notice netifd: Interface 'lan' is now up
Mon May  1 21:30:09 2023 daemon.notice netifd: Interface 'wan6' is enabled
Mon May  1 21:30:09 2023 daemon.notice netifd: Interface 'loopback' is enabled
Mon May  1 21:30:09 2023 daemon.notice netifd: Interface 'loopback' is setting up now
Mon May  1 21:30:09 2023 daemon.notice netifd: Interface 'loopback' is now up
Mon May  1 21:30:09 2023 daemon.notice netifd: Network device 'lo' link is up
Mon May  1 21:30:09 2023 daemon.notice netifd: Interface 'loopback' has link connectivity
Mon May  1 21:30:09 2023 daemon.notice netifd: Network device 'eth0' link is up
Mon May  1 21:30:09 2023 daemon.notice netifd: Interface 'lan' has link connectivity
Mon May  1 21:30:09 2023 daemon.notice netifd: Interface 'wan6' has link connectivity
Mon May  1 21:30:09 2023 daemon.notice netifd: Interface 'wan6' is setting up now
Mon May  1 21:30:09 2023 daemon.err odhcp6c[1318]: Failed to send RS (Address not available)
Mon May  1 21:30:09 2023 daemon.err odhcp6c[1318]: Failed to send SOLICIT message to ff02::1:2 (Address not available)
Mon May  1 21:30:09 2023 user.notice firewall: Reloading firewall due to ifup of lan (eth0)
Mon May  1 21:30:10 2023 daemon.err odhcpd[703]: Failed to send to ff02::1%lan@eth0 (Address not available)
Mon May  1 21:30:10 2023 daemon.err odhcp6c[1318]: Failed to send SOLICIT message to ff02::1:2 (Address not available)
Mon May  1 21:30:15 2023 daemon.notice netifd: Interface 'wan6' is now up
Mon May  1 21:30:15 2023 daemon.info dnsmasq[462]: reading /tmp/resolv.conf.d/resolv.conf.auto
Mon May  1 21:30:15 2023 daemon.warn dnsmasq[462]: ignoring nameserver fe80::216:3eff:fe7a:6a9%eth0 - local interface
Mon May  1 21:30:15 2023 daemon.info dnsmasq[462]: using only locally-known addresses for test
Mon May  1 21:30:15 2023 daemon.info dnsmasq[462]: using only locally-known addresses for onion
Mon May  1 21:30:15 2023 daemon.info dnsmasq[462]: using only locally-known addresses for localhost
Mon May  1 21:30:15 2023 daemon.info dnsmasq[462]: using only locally-known addresses for local
Mon May  1 21:30:15 2023 daemon.info dnsmasq[462]: using only locally-known addresses for invalid
Mon May  1 21:30:15 2023 daemon.info dnsmasq[462]: using only locally-known addresses for bind
Mon May  1 21:30:15 2023 daemon.info dnsmasq[462]: using only locally-known addresses for lan
Mon May  1 21:30:15 2023 user.notice firewall: Reloading firewall due to ifup of wan6 (eth0)

after dnsmasq restart

Mon May  1 21:32:03 2023 daemon.info dnsmasq[462]: exiting on receipt of SIGTERM
Mon May  1 21:32:07 2023 daemon.info procd: Not starting instance dnsmasq::data, command not set
Mon May  1 21:32:07 2023 daemon.info dnsmasq[1576]: started, version 2.86 cachesize 150
Mon May  1 21:32:07 2023 daemon.info dnsmasq[1576]: DNS service limited to local subnets
Mon May  1 21:32:07 2023 daemon.info dnsmasq[1576]: compile time options: IPv6 GNU-getopt no-DBus UBus no-i18n no-IDN DHCP no-DHCPv6 no-Lua TFTP no-conntrack no-ipset no-auth no-cryptohash no-DNSSEC no-ID loop-detect inotify dumpfile
Mon May  1 21:32:07 2023 daemon.info dnsmasq[1576]: UBus support enabled: connected to system bus
Mon May  1 21:32:07 2023 daemon.info dnsmasq-dhcp[1576]: DHCP, IP range 192.168.200.100 -- 192.168.200.249, lease time 12h
Mon May  1 21:32:07 2023 daemon.info dnsmasq[1576]: using only locally-known addresses for test
Mon May  1 21:32:07 2023 daemon.info dnsmasq[1576]: using only locally-known addresses for onion
Mon May  1 21:32:07 2023 daemon.info dnsmasq[1576]: using only locally-known addresses for localhost
Mon May  1 21:32:07 2023 daemon.info dnsmasq[1576]: using only locally-known addresses for local
Mon May  1 21:32:07 2023 daemon.info dnsmasq[1576]: using only locally-known addresses for invalid
Mon May  1 21:32:07 2023 daemon.info dnsmasq[1576]: using only locally-known addresses for bind
Mon May  1 21:32:07 2023 daemon.info dnsmasq[1576]: using only locally-known addresses for lan
Mon May  1 21:32:07 2023 daemon.info dnsmasq[1576]: reading /tmp/resolv.conf.d/resolv.conf.auto
Mon May  1 21:32:07 2023 daemon.warn dnsmasq[1576]: ignoring nameserver fe80::216:3eff:fe7a:6a9%eth0 - local interface
Mon May  1 21:32:07 2023 daemon.info dnsmasq[1576]: using only locally-known addresses for test
Mon May  1 21:32:07 2023 daemon.info dnsmasq[1576]: using only locally-known addresses for onion
Mon May  1 21:32:07 2023 daemon.info dnsmasq[1576]: using only locally-known addresses for localhost
Mon May  1 21:32:07 2023 daemon.info dnsmasq[1576]: using only locally-known addresses for local
Mon May  1 21:32:07 2023 daemon.info dnsmasq[1576]: using only locally-known addresses for invalid
Mon May  1 21:32:07 2023 daemon.info dnsmasq[1576]: using only locally-known addresses for bind
Mon May  1 21:32:07 2023 daemon.info dnsmasq[1576]: using only locally-known addresses for lan
Mon May  1 21:32:07 2023 daemon.info dnsmasq[1576]: read /etc/hosts - 5 addresses
Mon May  1 21:32:07 2023 daemon.info dnsmasq[1576]: read /tmp/hosts/dhcp.cfg01411c - 1 addresses
Mon May  1 21:32:07 2023 daemon.info dnsmasq[1576]: read /tmp/hosts/odhcpd - 0 addresses
Mon May  1 21:32:07 2023 daemon.info dnsmasq-dhcp[1576]: read /etc/ethers - 0 addresses
Mon May  1 21:32:13 2023 daemon.info dnsmasq-dhcp[1576]: DHCPDISCOVER(eth0) 00:16:3e:35:78:83
Mon May  1 21:32:13 2023 daemon.info dnsmasq-dhcp[1576]: DHCPOFFER(eth0) 192.168.200.190 00:16:3e:35:78:83
Mon May  1 21:32:33 2023 daemon.info dnsmasq-dhcp[1576]: DHCPDISCOVER(eth0) 00:16:3e:35:78:83
Mon May  1 21:32:33 2023 daemon.info dnsmasq-dhcp[1576]: DHCPOFFER(eth0) 192.168.200.190 00:16:3e:35:78:83
Mon May  1 21:32:33 2023 daemon.info dnsmasq-dhcp[1576]: DHCPREQUEST(eth0) 192.168.200.190 00:16:3e:35:78:83
Mon May  1 21:32:33 2023 daemon.info dnsmasq-dhcp[1576]: DHCPACK(eth0) 192.168.200.190 00:16:3e:35:78:83 brdchp

My kind regards

1 Like

Be aware that OpenWrt running as a lxc guest is not a supported configuration<fullstop>.

OpenWrt as a router system relies on certain kernel patches (features and preconfiguration changes) and sysctl settings being present, as well as being able to load/ unload kernel modules are required, neither of this is possible in a container (but would be under full system virtualization). As a results -while you will get it to boot- it will behave erratically and may expose huge security holes due to the lxc host not providing everything exactly as required (not wished for, desired, appreciated - hard required).

1 Like

Dnsmasq normally reloads when network comes up, probably triggered by ubus.
You can try using hotplug to reload the service if the the normal trigger fails.

Good to know.
Inspired by this article i was looking for a way to save one device and have an easy and efficient backup.
Even I would ignore your warning, at the moment my system is far away to be ready for production.
I'm learning by examples and by tests and LXC containers are great for that.

Cheers

Hotplug did the trick.

Many thanks

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.