0

I've tried the solutions posted in other threads but have had no success.
I have a problem with my Pi not connecting to the internet so far I've tried wired and wireless on my home network and wireless to a mobile hotspot, it connects to all the network but I get a DNS resolution issue in the browser window whenever I try a website.

I can ssh the pi, outputs of various commands as follows:

Version:

pi@raspberrypi:~ $ cat /etc/*-release | grep VERSIOON=

VERSION="10 (buster)"

Release:

pi@raspberrypi:~ $ cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 10 (buster)"
NAME="Raspbian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"

ifconfig:

pi@raspberrypi:~ $ ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.20.215  netmask 255.255.255.0  broadcast 192.168.20.255
        inet6 fe80::6963:db0:843:ff9d  prefixlen 64  scopeid 0x20<link>
        ether b8:27:eb:cf:ec:6c  txqueuelen 1000  (Ethernet)
        RX packets 1423  bytes 227835 (222.4 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 1003  bytes 133921 (130.7 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 19178  bytes 1736822 (1.6 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 19178  bytes 1736822 (1.6 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.20.210  netmask 255.255.255.0  broadcast 192.168.20.255
        inet6 fe80::b4d5:cefa:6cf1:daed  prefixlen 64  scopeid 0x20<link>
        ether 08:6a:0a:97:62:6e  txqueuelen 1000  (Ethernet)
        RX packets 1384  bytes 357017 (348.6 KiB)
        RX errors 0  dropped 12  overruns 0  frame 0
        TX packets 153  bytes 22207 (21.6 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

Ping:

pi@raspberrypi:~ $ ping -c 4 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=57 time=65.4 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=57 time=65.1 ms
64 bytes from 8.8.8.8: icmp_seq=3 ttl=57 time=65.2 ms
64 bytes from 8.8.8.8: icmp_seq=4 ttl=57 time=65.6 ms

--- 8.8.8.8 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 7ms
rtt min/avg/max/mdev = 65.090/65.335/65.568/0.181 ms
pi@raspberrypi:~ 

IP addr show:

pi@raspberrypi:~ $ ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether b8:27:eb:cf:ec:6c brd ff:ff:ff:ff:ff:ff
    inet 192.168.20.215/24 brd 192.168.20.255 scope global noprefixroute eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::6963:db0:843:ff9d/64 scope link
       valid_lft forever preferred_lft forever
3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 08:6a:0a:97:62:6e brd ff:ff:ff:ff:ff:ff
    inet 192.168.20.210/24 brd 192.168.20.255 scope global noprefixroute wlan0
       valid_lft forever preferred_lft forever
    inet6 fe80::b4d5:cefa:6cf1:daed/64 scope link
       valid_lft forever preferred_lft forever

IP route show:

pi@raspberrypi:~ $ ip route show
default via 192.168.20.1 dev eth0 src 192.168.20.215 metric 202
default via 192.168.20.1 dev wlan0 proto dhcp src 192.168.20.210 metric 303
192.168.20.0/24 dev eth0 proto dhcp scope link src 192.168.20.215 metric 202
192.168.20.0/24 dev wlan0 proto dhcp scope link src 192.168.20.210 metric 303

resolv.conf:

pi@raspberrypi:~ $ cat /etc/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 127.0.0.1


search pihole1
  • 1
    Do you or did you use pihole? (see reference in resolv.conf) – Dirk Dec 14 '19 at 21:59
  • yes.actually i accidently installed pihole on the pi that isn't working-i mixed up the ip's,when i realised this i unistalled it and reinstalled on the correct pi, i'm wondering if inadvertantly uninstalled something necessary for dns? – mrdenmark1 Dec 14 '19 at 22:08
  • just prepend # before search pihole1' for comment the line by doing sudo nano /etc/resolv.conf. Disconnect your Internet connexion (wlan0 or eth0) , try again to reconnect. If don't work put nameserver 8.8.8.8 in /etc/resolv.conf, but uninstall pihole if it has nothing to do there. – Ephemeral Dec 14 '19 at 22:14
  • no success with either option unfortunately,after each restart resolv.conf gets overwritten back to the original configuration – mrdenmark1 Dec 14 '19 at 22:34
  • Looks like perhaps pihole dorked your resolvconf.conf settings? Have a look at /etc/resolvconf.conf, especially the name_servers line. Make it the IP of your DNS server (router?). This whole resolv.conf thing is twitchy, especially when mucked by software that doesn't clean up properly on removal. – bls Dec 14 '19 at 22:59
0

I've read the comments. It's kind of silly solution, however, follow the instructions:
1. nano /etc/resolv.conf.new
add these lines and save the file:

nameserver 8.8.8.8
nameserver 4.2.2.4

Then, add this line in "/etc/rc.local":
cp /etc/resolv.conf.new /etc/resolv.conf

Reboot the device and check it out.

| improve this answer | |
  • @m rostami, didn't fix it unfortunately – mrdenmark1 Dec 15 '19 at 9:43
  • tell me the result of thess commands: traceroute www.google.com and sudo service dnsmasq status – M. Rostami Dec 15 '19 at 9:49
  • pi@raspberrypi:~ $ traceroute www.google.com www.google.com: Temporary failure in name resolution Cannot handle "host" cmdline arg `www.google.com' on position 1 (argc 1) – mrdenmark1 Dec 15 '19 at 9:54
  • pi@raspberrypi:~ $ sudo service dnsmasq status Unit dnsmasq.service could not be found. – mrdenmark1 Dec 15 '19 at 9:55
  • 1
    It is really not a good idea to always overwrite the dynamic settings in /etc/resolv.conf from the resolver. There is a note given in that file. If you want a static resolv.conf then just disable the resolver by inserting a line resolvconf=NO in /etc/resolvconf.conf. – Ingo Dec 16 '19 at 16:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.