Pi 3B+ / dnsmasq.conf Question

Well hi there Kiddos! :smiley:

This evening, I finally had a few minutes to set up my old Raspberry Pi 3B+ to provide a wifi bridge option to my upstairs home server lab. While I could have easily purchased a simple wall plug, ethernet to wifi bridge I decided to go the route of reducing e-waste (already owned) and learning (never done before).

Instructions I used where from Make Tech Easier, and those can be found here:

Overall, this was so, so simple that I would provide this as a NixCraft rating of ā€œMedium Difficultyā€ and complete in 20 minutes (maximum). Also, rating of fun at: HIGH! :smiley:

However, there was a snag and I wanted to bring this to the communities attention for helping me learn why this is the case, please.

Within the instructions, the user is requested to make changes to /etc/dnsmasq.conf and to input the parameters:

interface=eth0
listen-address=192.168.220.1
bind-interfaces
server=8.8.8.8
domain-needed
bogus-priv
dhcp-range=192.168.220.50,192.168.220.150,12h

This went fine and dandy all the way to the end when I did my first system test - before a reboot. The server lab picked up the NIC options and started to connect without issue. Then I did the init 6 test. Upon the [ OK ] prompts I noticed at the end that I got a [ FAILED ] related to dnsmasq.service.

Going into the Pi, I did a simple systemctl status dnsmasq.service and found that the service was FAILED as a status. Doing a simple sudo systemctl start dnsmasq.service and later an enable, the system started without issue. But, having a failed at first - I didnā€™t trust that the service was proper, so I did another init 6 and BOOM - it failed again.

Doing a search on this, I came across another post with a user having similar but with a much more complicated reason. The answer recommendation was to remove/comment out in /etc/dnsmasq.conf - bind-interfaces .

I did so, started to run init 6 & init 0 tests and - 100% fine.

My question to you all is why would the instructions request a bind-interfaces in the conf file? I checked other instructions and they too shared to bind-interfaces. Iā€™m not sure if they are copying each other but I am lead to believe this is NOT the case; that there is a reason but that I just donā€™t know and understand why.

Thatā€™s where you come my detectives :stuck_out_tongue: If someone has a moment (and has made it this far - YOU GET A COOKIE) can you please help educate me on why this entry was shared and what it could be used for if kept?

Thank you all so much and I hope you are all well, happy, and safe :slight_smile:

-z, --bind-interfaces
On systems which support it, dnsmasq binds the wildcard address, even when it is
listening on only some interfaces. It then discards requests that it shouldnā€™t
reply to. This has the advantage of working even when interfaces come and go and
change address. This option forces dnsmasq to really bind only the interfaces it is
listening on. About the only time when this is useful is when running another
nameserver (or another instance of dnsmasq) on the same machine. Setting this
option also enables multiple instances of dnsmasq which provide DHCP service to run
in the same machine.

When the service fails is there anything connected to the LAN? If so, what are the network settings for the NIC on that device?

1 Like

Good afternoon Ethanol,

Thanks for that reply and information. That made a lot of sense and really helped me better understand this hiccup.

There is an Ethernet cord plugged into the Pi3B+ at time of boot with the failure reported. Please excuse my misunderstanding here; to make sure I am most accurate: network settings on server lab (using the pi for network via the bridge) or the Pi3B+?

Iā€™ll happily do some investigations on this and will uncomment the bind-interfaces entry in the dnsmasq.conf file to find that information. :slight_smile:

Thank you!

That was straight from the dnsmasq man page. As far as your setup is concerned, only having one DHCP service running, they recommend not using --bind-interfaces.

I donā€™t understand enough to speculate why it would fail with that option enabled. If there was some sort of obvious mis-configuration on the Pi or your server it should fail with or without --bind-interfaces donā€™t you think?

1 Like