how to prevent dnsmasq from completely failing when one of the configured interfaces is unplugged?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
2
down vote

favorite












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?










share|improve this question



















  • 1




    except-interface?
    – Arkadiusz Drabczyk
    Sep 16 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 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 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 at 20:57














up vote
2
down vote

favorite












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?










share|improve this question



















  • 1




    except-interface?
    – Arkadiusz Drabczyk
    Sep 16 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 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 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 at 20:57












up vote
2
down vote

favorite









up vote
2
down vote

favorite











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?










share|improve this question















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?







router dnsmasq






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Sep 16 at 20:33

























asked Sep 16 at 20:28









MountainX

4,7112369119




4,7112369119







  • 1




    except-interface?
    – Arkadiusz Drabczyk
    Sep 16 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 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 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 at 20:57












  • 1




    except-interface?
    – Arkadiusz Drabczyk
    Sep 16 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 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 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 at 20:57







1




1




except-interface?
– Arkadiusz Drabczyk
Sep 16 at 20:34




except-interface?
– Arkadiusz Drabczyk
Sep 16 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 at 20:47




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 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 at 20:55




@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 at 20:55




1




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 at 20:57




@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 at 20:57















active

oldest

votes











Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f469436%2fhow-to-prevent-dnsmasq-from-completely-failing-when-one-of-the-configured-interf%23new-answer', 'question_page');

);

Post as a guest



































active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes















 

draft saved


draft discarded















































 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f469436%2fhow-to-prevent-dnsmasq-from-completely-failing-when-one-of-the-configured-interf%23new-answer', 'question_page');

);

Post as a guest













































































Popular posts from this blog

How to check contact read email or not when send email to Individual?

Bahrain

Postfix configuration issue with fips on centos 7; mailgun relay