Jump to content

Dnsmasq problem


Matthai

Recommended Posts

I am trying to set up Wifi AP on OrangePi Zero board.

 

Basically, I install and configure hostapd and dnsmasq and create a script, which does the following (it is run as sudo):

 

nmcli radio wifi off
rfkill unblock wlan
ifconfig wlan0 172.16.0.1 netmask 255.255.255.0 broadcast 172.16.1.255
service dnsmasq restart
/usr/sbin/hostapd /etc/hostapd/hostapd.conf

 

This is the /etc/dnsmasq.conf:

 

port=53

domain-needed

bogus-priv

resolv-file=/etc/dnsmasq/resolv.conf

interface=wlan0

listen-address=172.16.0.1

bind-interfaces

addn-hosts=/etc/dnsmasq/hosts.conf

dhcp-range=172.16.0.50,172.16.0.150,12h

dhcp-leasefile=/var/lib/misc/dnsmasq.leases

domain=orangepi.wifi

no-resolve

server 8.8.8.8

server 8.8.4.4

local=/orangepi.wifi/


I also have in /etc/dnsmasq/resolv.conf:

 

nameserver 127.0.0.1


And in /etc/dnsmasq/hosts.conf:

 

172.16.0.1 orangepi.wifi

172.16.0.1 www.orangepi.wifi

So... I run the script, SSID appears, and I can connect to the OrangePi Access Point. I get the IP address (within DHCP range), from OrangePiI can ping the connected device, and from the device I can ping OrangePi (ping 172.16.0.1). From the device I can ping 8.8.8.8, but if I try to ping www.google.com, DNS resolving does not work. (From OrangePi internet is working good).

 

I assumed ther eis some problem with Dnsmasq, so I installed udhcpd instead, but the problem is the same.

 

Any idea?

Link to comment
Share on other sites

Well, yes, that was my mistake, I corrected it, but it is still not working.

 

Anyway, it seems I pasted wrong config here. My /etc/dnsmasq.conf is:

# Configuration file for dnsmasq.
port=53
domain-needed
bogus-priv

resolv-file=/etc/dnsmasq/resolv.conf
no-resolv

server=8.8.8.8
server=8.8.4.4

interface=wlan0
listen-address=172.16.0.1
bind-interfaces

addn-hosts=/etc/dnsmasq/hosts.conf

dhcp-range=172.16.0.50,172.16.0.150,12h

dhcp-leasefile=/var/lib/misc/dnsmasq.leases

domain=orangepi.wifi
local=/orangepi.wifi/

 

Link to comment
Share on other sites

Of course, I am doing IP forwarding:

sudo sh -c "echo 1 > /proc/sys/net/ipv4/ip_forward"

And this:

sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
sudo iptables -A FORWARD -i eth0 -o wlan0 -m state --state RELATED,ESTABLISHED -j ACCEPT
sudo iptables -A FORWARD -i wlan0 -o eth0 -j ACCEPT

 

Link to comment
Share on other sites

Your upstream resolvers should be definef in this file using the standard convention

nameserver x.x.x.x
 

resolv-file=/etc/dnsmasq/resolv.conf
no-resolv




These lines aren't what you're looking for Remove them. They require more parameters and are for a different purpose. The server argument is for directing request for a specific domain to an alternate name server:
 

server=8.8.8.8
server=8.8.4.4



 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines