DNS Nameserver. Cannot access internet

Asked by Trevor Fernandes

A. Historical Background which might be causing the present problem.

I had upgraded to Ubuntu Desktop 18.04.06 LTS using Terminal
$ sudo do-release-upgrade -d
During the process I got the query
'Installing the upgrade can take several hours. Once the download has finished the process cannot be cancelled.
Continue [yN] Details [d]'

I got curious and pressed 'd'. I then did not know how come out and pressed (ctrl + C).
This left my laptop in somewhat of a midway state between version 16 and 18. Upgrade wanted to go to version 20

When I rebooted I problems such as (not in this particular order)
1. 'trying to upgrade ... unmet dependencies'
For this I used the forum link and ran
https://ubuntuforums.org/showthread.php?t=2416975
 and ran
$ sudo apt update
$ sudo apt full-upgrade
$ sudo apt -f install

2. Got infinite login loop. Fixed that.

3. Orange screen with no taskbar and no Beaver logo. Fixed that.

My laptop (Desktop 18.04.06 LTS) runs fine, except for the problem below
------------------------------------------------

B. Present problem

I cannot access the internet through Firefox

Here are some of the commands that I thought would be useful for you to diagnose the problem:-

margaret@Lappy:~$ systemd-resolve --status
Global
          DNSSEC NTA: 10.in-addr.arpa
                      16.172.in-addr.arpa
                      168.192.in-addr.arpa
                      17.172.in-addr.arpa
                      18.172.in-addr.arpa
                      19.172.in-addr.arpa
                      20.172.in-addr.arpa
                      21.172.in-addr.arpa
                      22.172.in-addr.arpa
                      23.172.in-addr.arpa
                      24.172.in-addr.arpa
                      25.172.in-addr.arpa
                      26.172.in-addr.arpa
                      27.172.in-addr.arpa
                      28.172.in-addr.arpa
                      29.172.in-addr.arpa
                      30.172.in-addr.arpa
                      31.172.in-addr.arpa
                      corp
                      d.f.ip6.arpa
                      home
                      internal
                      intranet
                      lan
                      local
                      private
                      test

Link 3 (wlan0)
      Current Scopes: none
       LLMNR setting: yes
MulticastDNS setting: no
      DNSSEC setting: no
    DNSSEC supported: no

Link 2 (eth0)
      Current Scopes: none
       LLMNR setting: yes
MulticastDNS setting: no
      DNSSEC setting: no
    DNSSEC supported: no
---------------------------------------------------------
margaret@Lappy:~$ sudo systemctl is-active systemd-resolved.service
active
---------------------------------------------------------
I tried doing this through Graphical User Interface (GUI). It shows it. When I change it in Terminal, with the below command, it changes in the GUI as well.
margaret@Lappy:~$ nmcli connection modify "WIFI 1" ipv4.dns "8.8.8.8,1.1.1.1"

--------------------------------------------------------
margaret@Lappy:~$ ping 8.8.8.8 -c2
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=120 time=27.7 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=120 time=25.7 ms

--- 8.8.8.8 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1001ms
rtt min/avg/max/mdev = 25.700/26.737/27.774/1.037 ms
-------------------------------------------------------
margaret@Lappy:~$ ping google.com
ping: google.com: Name or service not known
-------------------------------------------------------
margaret@Lappy:~$ nslookup 8.8.8.8
** server can't find 8.8.8.8.in-addr.arpa: SERVFAIL
------------------------------------------------------
margaret@Lappy:~$ nslookup 192.168.2.1
1.2.168.192.in-addr.arpa name = _gateway.

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
actionparsnip
Solved:
Last query:
Last reply:
Revision history for this message
actionparsnip (andrew-woodhead666) said :
#1

If you run:

echo "nameserver 8.8.8.8" | sudo tee /etc/resolv.conf > /dev/null

Do you get web access?

Note that Ubuntu 18.04 is due to go end of life (EOL) on 30th April this year so you may want to cut your losses and wipe the install off and do a clean install of Ubuntu 22.04 which is LTS. You can restore your user data from your backups

Revision history for this message
Trevor Fernandes (trevorubuntu) said :
#2

Thanks andrew-woodhead666 for the quick response.

I still do not have internet access. (Your command ran successfully. No return output).

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#3

After the command, if you run:

host bbc.co.uk

Do you get IP addresses back?

Revision history for this message
Trevor Fernandes (trevorubuntu) said :
#4

I ran the previous command (echo "nameserver 8.8.8.8" | sudo tee /etc/resolv.conf > /dev/null) again, followed by

$ host bbc.co.uk
Host bbc.co.uk not found 2(SERVFAIL)

Thanks

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#5

Have you tried rebooting your router?

Revision history for this message
Trevor Fernandes (trevorubuntu) said :
#6

Yes I tried switching it off/on. That does not work. (My MS windows connected to the router through LAN cable works fine.)

I found this video that edits the '/etc/resolv.conf' file (https://www.youtube.com/watch?v=_J0Lsmucx08).
My resolv.conf is identical to the one shown in the video except that it has one extra line below 'nameserver 127.0.0.53' it says 'options edns0'.

I commented both those lines. Following the video's instructions restarted the network-manager and voila I had internet!!!!!!

When I rebooted as expected my changes were overwritten and again no internet.

Thanks.

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#7

Yes changes to that file don't stick. What line did you add to the file and we can make it survive a reboot

Revision history for this message
Trevor Fernandes (trevorubuntu) said :
#8

I added Google's public DNS (2 lines) i.e.

nameserver 8.8.8.8
nameserver 8.8.4.4
-------------------------------
I commented the 2 lines 'nameserver 127.0.0.53' and the one below it
'options edns0'

Thanks

Revision history for this message
Best actionparsnip (andrew-woodhead666) said :
#9

If you populate the file below with the same:

/etc/resolvconf/resolv.conf.d/head

Then it should survive reboots. Make a backup copy with:

sudo cp /etc/resolvconf/resolv.conf.d/head /root/head

Then edit as you require

This should do it

Revision history for this message
Trevor Fernandes (trevorubuntu) said :
#10

Thanks actionparsnip, that solved my question.

Revision history for this message
Trevor Fernandes (trevorubuntu) said :
#11

The/etc/resolvconf/resolv.conf.d/head file below (I added 2 Google DNS nameservers.)
---------------------
# 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
# 127.0.0.53 is the systemd-resolved stub resolver.
# run "systemd-resolve --status" to see details about the actual nameservers.
nameserver 8.8.8.8
nameserver 8.8.4.4
-------------------

The /etc/resolv.conf file below (I commented 'nameserver 127.0.0.53', added 2 Google DNS nameservers, kept 'options edns0' as is.)
-----------------
# 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
# 127.0.0.53 is the systemd-resolved stub resolver.
# run "systemd-resolve --status" to see details about the actual nameservers.

#nameserver 127.0.0.53
nameserver 8.8.8.8
nameserver 8.8.4.4
options edns0
---------------

Top tip:
During the upgrade process if you are asked the query below, try and avoid pressing option 'd' (unless you know how to exit it)!

'Installing the upgrade can take several hours. Once the download has finished the process cannot be cancelled.
Continue [yN] Details [d]'