I'm running dnsmasq on Arch Linux on a router with 4 LAN ports for wired, wireless, DMZ and admin_interface. dnsmasq is my dhcp server for my LAN (as well as providing dns functions).
I do not always have things plugged into all 4 LAN ports. But when I reboot the device, I want it to properly come up for the ports where devices are connected, particularly the wired LAN.
My configuration is like this:
If you want dnsmasq to listen for DHCP and DNS requests only on specified interfaces (and the loopback) give the name of the interface (eg eth0) here. Repeat the line for more than one interface.
interface=eth0 interface=eth1 interface=eth2 interface=eth3
I use this config because I do not want dnsmasq running on the WAN port, which I'll call eth4 in this example.
My problem is that if I do not have the cable plugged into eth1 (for example) when the system reboots, dnsmasq does not proceed with eth0 or other valid interfaces; it fails completely as shown here:
Sep 16 14:16:10 router systemd: Starting A lightweight DHCP and caching DNS server... Sep 16 14:16:10 router dnsmasq: dnsmasq: syntax check OK. Sep 16 14:16:10 router dnsmasq: dnsmasq: unknown interface eth1 Sep 16 14:16:10 router dnsmasq: unknown interface eth1 Sep 16 14:16:10 router dnsmasq: FAILED to start up Sep 16 14:16:10 router systemd: dnsmasq.service: Main process exited, code=exited, status=2/INVALIDARGUMENT Sep 16 14:16:10 router systemd: dnsmasq.service: Failed with result 'exit-code'. Sep 16 14:16:10 router systemd: Failed to start A lightweight DHCP and caching DNS server.
After this, my LAN has no DHCP server and I am missing other critical functionality that dnsmasq provides until I manually go fix it and edit the config file with what is just a temporary (and undesireable) change. Is there a way to make dnsmasq start up with just the valid / connected interface(s) in my situation?