DNSMASQ not working across local network

1

I'm using a raspberry pi 3 and have setup an Access Point from it. Basically I use the internal wlan0 to connect to my internet and I use a USB wifi card wlan1 to server out the AP. (This works fine and im able to connect to it and get internet to other devices.

I'm attempting to use DNSMASQ for my DHCP needs and DNS needs, which both work - all my clients connecting to the AP get an IP in my range and they also get the correct DNS server (my raspberry pi).

What's not working is DNS redirection, I'm trying to redirect a website of my choice, say cnn.com to a local IP address (testing purposes).

Below is my /etc/dnsmasq.conf:

interface=wlan1
server=192.168.42.1
dhcp-range=192.168.42.10,192.168.42.50,255.255.255.0,12h

Below is my /etc/dnsmasq.d/dnsmasq.custom.conf:

interface=wlan1
dhcp-range=wlan1,192.168.42.10,192.168.42.50,6h
dhcp-option=3,192.168.42.1
dhcp-option=6,192.168.42.1
dhcp-authoritative

Below is my /etc/dnsmasq.d/mycustomfile

address=/www.cnn.com/192.168.2.173

Locally, on the Pi, this works and redirection takes place but on a laptop connected to the PI AP, it does not work.

How do I force the PI AP clients to use the DNSMASQ redirection file?

dmj12508

Posted 2017-01-13T21:59:39.607

Reputation: 11

Answers

0

Because you've told dnsmasq to only work on WLAN1 in your config files. I would suggest only having one file anyway for simplicity. Either put everything in /etc/dnsmasq.conf or in a single file in /etc/dnsmasq.d and remove the interface= line to have dnsmasq listen on all interfaces.

Alternatively, you can specify more than one interface (I think by comma separating them) or use --except-interface= to exclude a certain interface.

Darren

Posted 2017-01-13T21:59:39.607

Reputation: 2 435

ok, if I remove the interface line, that would force dnsmasq to listen to all connections? – dmj12508 – 2017-01-13T23:03:10.910

Yes, affirmative. – Darren – 2017-01-13T23:37:44.300