1

I am trying to run a Raspberrypi as a routing machine. It will be connected to wifi with wpa_supplicant.

My PC ----> Raspberry Pi ----> Wifi Router

The thing is I noticed, the RPi got from the wifi router a dynamic DNS name, which is 192.168.10.1. On my PC, I can ping 8.8.8.8, but I cannot resolve name. I have to manually change the /etc/resolv.conf so that it uses the google DNS server, then I will have internet.

my PC got the DNS server from the RPi.

nmcli dev show | grep DNS gives:

IP4.DNS[1]:                             192.168.10.1

This IP is under another sub net, my PC will not able to recognize it. So what can I do? The solution I thought is to assign the DNS server while connecting with wpa_supplicant. Can I do it?

  • If you are getting DHCP then it should include a valid DNS server, check your DHCP server's config. – ivanivan Mar 6 '18 at 14:59
  • @ivanivan Hi. the udhcpd.conf has option dns 8.8.8.8, so it looks fine. Actually all these happen after the RPi connect with the wifi router. From that moment all the dns server name become 192.168.10.1, like virus – J.R. Mar 6 '18 at 15:03
  • Not the DNS server on the Pi, but the DNS server being sent via wherever it is getting its DHCP from. Do dhclient -v wlan0 (or whatever your device name is) and see where it is getting the info from – ivanivan Mar 6 '18 at 15:11
  • @ivanivan Hi, I changed the udhcpc setting on my PC and gives it static dns server of 8.8.8.8. It still does not work...under /etc/resolv.conf there's only "nameserver 127.0.1.1". It seems something is in-correct with the wpa_supplicant. – J.R. Mar 6 '18 at 15:33
  • wpa_supplicant has nothing to do with DNS, it only handles your wifi and encryption. DNS configuration is typically handled through DHCP. You need to adjust your DHCP server configuration on the pi. – smokes2345 Mar 6 '18 at 19:49

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.