Matthai Posted March 7, 2019 Posted March 7, 2019 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?
Tido Posted March 7, 2019 Posted March 7, 2019 2 hours ago, Matthai said: 172.16.0.1 netmask 255.255.255.0 broadcast 172.16.1.255 172.16.0.1 172.16.1.255 could it be that one ?
Matthai Posted March 7, 2019 Author Posted March 7, 2019 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/
Matthai Posted March 7, 2019 Author Posted March 7, 2019 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
lanefu Posted March 10, 2019 Posted March 10, 2019 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
Matthai Posted March 10, 2019 Author Posted March 10, 2019 6 hours ago, lanefu said: Your upstream resolvers should be definef in this file using the standard convention nameserver x.x.x.x In this file, you mean in /etc/dnsmasq.conf?
lanefu Posted March 10, 2019 Posted March 10, 2019 In this file, you mean in /etc/dnsmasq.conf?Put resolvers in /etc/dnsmasq/resolv.confSent from my SM-G950U using Tapatalk
Recommended Posts