Ubuntu – How to make persistent changes to /etc/resolv.conf Ubuntu 18.10

18.10dnsnetworkingresolv.conf

My resolv.conf file has 'nameserver 127.0.0.53'.
I need to replace it with different value or add another nameserver.

I erased symlink, replaced it with file.
Now it is managed by Network Manager,
but 127.0.0.53 is restored upon reboot.

I need to keep changes, I made.

If I configure network interface in 'interfaces' file,
it becomes 'UNMANAGED' in Network Manager. It's configuration has no effect, though.

This question is related HERE.

Guys, If it is not so much trouble, will you, please, read.

Before I perform any 'ping' or 'host', I have to get through that LOGIN procedure.

My main problem is there. What I am trying to do here is to create a kind of work around.

Adding ANY nameserver except 127.0.0.53 or 0.0.0.0 into resolv.conf makes that thing working.
Network DNS is 192.168.11.1. I inserted 192.168.0.1 and it worked. You name it – it goes. But changing settings in Network Manager has no effect at all.

@heynnema, I did those settings in IPV4 tab before I rose the question, but unfortunately, they did not work.
/etc/network/interfaces file is intact,
UBUNTU 18.10 is clean installed.
I edited the file for the sake of creating a router in DEBIAN, and I saw how it worked. I do not want it to be the same way here.

@Marmayogi my DNS is 192.168.11.1, the same one is in /run/systemd/resolve/resolv.conf. I was surprised to see it there.

Yes, @Marmayogi, my goal is to get that screen.
On UNITY 18.04 this file does not exist, but it does not change much.

/etc/netplan/01-network-manager-all.yaml
# Let NetworkManager manage all devices on this system
network:
version: 2
renderer: NetworkManager  

ip link show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: enp5s0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc fq_codel state DOWN mode DEFAULT group default qlen 1000
    link/ether bc:ae:c5:35:85:e6 brd ff:ff:ff:ff:ff:ff
3: wlp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DORMANT group default qlen 1000
    link/ether 48:5d:60:c5:91:0b brd ff:ff:ff:ff:ff:ff

systemd-resolve --status wlp3s0
Link 3 (wlp3s0)
  Current Scopes: DNS
   LLMNR setting: yes
MulticastDNS setting: no
DNSOverTLS setting: no
    DNSSEC setting: no
    DNSSEC supported: no
Current DNS Server: 192.168.11.1
     DNS Servers: 192.168.11.1
      DNS Domain: ~.
                  crew.local  

Yes @Marmayogi, this is the only thing I want working for now. This solution seems aukward to me, though. There was a symlink, as you can see in other post. I removed it, hoping that I would get things working for me.

@Marmayogi, you did a Great job, creating that step by step instruction.

Your solution is GENIUS, not decent!

I tested. Login successful, internet works.

@heynnema,
/run/resolvconf/resolv.conf does not exist on UBUNTU 18.10.
What would you advise in this situation?

System is installed clean from ISO, downloaded from UBUNTU.COM.

Best Answer

I am reproducing section "1.11.2. Configure /etc/resolv.conf file" from my answer Part-I Preinstallation: How to install Oracle 18c (Enterprise Edition) on Ubuntu 18.04?

To display what network interfaces are available in the system, issue the following command:

$ ip link show

enter image description here Figure-39: The WiFi network adapter wlp5s0 is active, up and running.

Network configuration file /etc/netplan/.yaml should be checked for configuration details. To display the contents of the file, issue the following command:

$ cat /etc/netplan/01-network-manager-all.yaml

enter image description here Figure-40: Network Manager file 01-network-manager-all.yaml is not configured yet.

Find out whether /etc/resolv.conf is a static file or symlink by the following command:

$ ls -l /etc/resolv.conf

enter image description here Figure-41: File /etc/resolv.conf is a symlink pointing to stub file 'stub-resolv.conf'.

In fact, @igor, the symlink what you removed from other post was really the link to stub file stub-resolv.conf.

After severed the symlink between /etc/resolv.conf and stub-resolv.conf which carried the nameserver 127.0.0.53, /etc/resolv.conf was left alone and it was you who made /etc/resolv.conf as a static file!

The fact is, @Igor, you were not really offered any solution by that act of severance.

Now, display contents of /etc/resolv.conf by the command:

$ cat /etc/resolv.conf enter image description here Figure-42: The contents of symlink '/etc/resolv.conf' having 127.0.0.53 as nameserver.

The dns shown by /etc/resolv.conf, is 127.0.0.53 but not the default nameserver configured for dhcp.

Issue the following command to find out the default dns server:

$ systemd-resolve --status wlp5s0

enter image description here Figure-43: The default DNS server for WiFi network adapter is 192.168.43.1.

Display contents of /run/systemd/resolve/resolv.conf, by the command:

$ cat /run/systemd/resolve/resolv.conf

enter image description here Figure-44: The contents of '/run/systemd/resolve/resolv.conf' indicating default nameserver.

From figure-44, you can observe that /run/systemd/resolve/resolv.conf is the one which really is carrying the default name server 192.168.43.1.

Issue the following command to change the symlink /etc/resolv.conf to point default dns server 192.168.43.1 instead of 127.0.0.53.

$ sudo ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf

$ ls -l /etc/resolv.conf

enter image description here Figure-45: File /etc/resolv.conf is a symlink pointing to default nameserver.

After setting up sysmlink as shown in figure-45, you must make sure that your Wi-Fi is connected, up and running, by issuing the following command:

$ nmcli device

enter image description here Figure-45-a: Wi-Fi network interface adapter 'wlp5s0' is connected, up and running.

Conclusion:

Under the circumstances, the symlink is the not only best answer you got but also a decent and acceptable solution.

Related Question