2

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[1]: Starting A lightweight DHCP and caching DNS server...
Sep 16 14:16:10 router dnsmasq[876]: dnsmasq: syntax check OK.
Sep 16 14:16:10 router dnsmasq[879]: dnsmasq: unknown interface eth1
Sep 16 14:16:10 router dnsmasq[879]: unknown interface eth1
Sep 16 14:16:10 router dnsmasq[879]: FAILED to start up
Sep 16 14:16:10 router systemd[1]: dnsmasq.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
Sep 16 14:16:10 router systemd[1]: dnsmasq.service: Failed with result 'exit-code'.
Sep 16 14:16:10 router systemd[1]: 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?

  • 1
    except-interface? – Arkadiusz Drabczyk Sep 16 '18 at 20:34
  • BTW, I'm not sure that dnsmasq fails to start because cable is not connected - possibly eth1 interface does not exist all when dnsmasq wants to use it. – Arkadiusz Drabczyk Sep 16 '18 at 20:47
  • @ArkadiuszDrabczyk If I plug the cable in, dnsmasq starts. Unplug it, I get the errors shown. I had tried 'except-interface' in the past and I do not remember why I gave up on it. But I tried it again just now and it appears it may work. I will test further. Thank you. – MountainX Sep 16 '18 at 20:55
  • 1
    @ArkadiuszDrabczyk this cable-unplugged fragility may be related to my udev rules which rename the interfaces (or to something else unique about my system). I thought it was typical behavior, but if it is not, I will look into it further. – MountainX Sep 16 '18 at 20:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.