0

We have used dnsmasq to set up a wifi to ethernet router on raspbian jessie. I have configured eth0 for static IP address using dhcpcd.conf file and it is given as follows.

interface eth0
static ip_address 192.168.42.1/24
static routers=192.168.42.1
static domain_name_servers=192.168.42.1

But this assigns IP address only when a device is attached to it. At the time of development, I didn't connect a device.

dnsmasq.conf file for the router look like as follows.

interface=eth0
listen-address=192.168.42.1

# Bind to the interface to make sure we aren't sending things
# elsewhere

bind-interfaces
server=8.8.8.8 # Forward DNS requests to Google DNS
domain-needed # Don't forward short names

# Never forward addresses in the non-routed address spaces.
bogus-priv
# Assign IP addresses between 192.168.42.2 and 192.168.42.100 with a
# 12 hours lease time

dhcp-range=192.168.42.2,192.168.42.100,12h

Then I tried to start dnsmasq and it was a failure. dnsmasq failed to start because the eth0 has no IP.

I have connected a device to eth0 port and again tried to start dnsmasq and it worked now.

But on each reboot, I need to start the dnsmasq manually. After the research on google, I found that commenting the line bind-interfaces will help. So I commented the line and dnsmasq start to work at boot.

According to the man page, I understand that it is used for multiple interfaces, isn't it?

Actually, I didn't know what bind-interface do? How they affect my router? Can you anyone help me with examples to understand the usage of bind-interface?

  • Remove the static routers=192.168.42.1 static domain_name_servers=192.168.42.1You state you are setting up "a wifi to ethernet router" have you configured routing and masquerade – Milliways Mar 8 at 6:27
  • 1
    You do not need to specify bind-interfaces You should not need listen-address either – Milliways Mar 8 at 6:32
  • @Milliways yes i defined nat rules. Can you explain with reason? Why don't need static_router and domain_name_server? If I didn't provided bind-interface , it will listen on all ip addresses, is that any problem? – vishnu m c Mar 8 at 7:24
  • I do not claim to be an expert on routers, but have never needed to set this on an Access Point. It was a suggestion to try. It is the job of the DHCP server to specify these parameters. I suggest you read man dnsmasq – Milliways Mar 8 at 7:45
  • Ok i will try that, But when i use /etc/network/interfaces file, there was no problem with dnsmasq. – vishnu m c Mar 8 at 8:24

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.