9

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.

7
  • What is your default nameserver @igor at present? What is your network adapter? You are NOT directly allowed to edit /etc/resolv.conf! you may have to symlink to /run/systemd/resolve/resolv.conf which would contain your default nameserver. Please check.
    – Marmayogi
    Mar 25, 2019 at 13:49
  • See the man page for it. It lists the sources on how resolv.conf is recreated. From memory: dhclient, networkmanager, dnsmasq.
    – Rinzwind
    Mar 25, 2019 at 13:54
  • @Marmayogi my DNS is 192.168.11.1, the same one is in /run/systemd/resolve/resolv.conf. Will you, please, read here. This is my post, which is the reason I need those changes in resolv.conf. I do not have connection to the network when nameserver is set to 127.0.0.53.
    – Igor
    Mar 25, 2019 at 17:15
  • After performing my answer, edit your question and show me host www.ebay.com and ping 8.8.8.8.
    – heynnema
    Mar 25, 2019 at 17:50
  • Try ip link show command and find out your Wi-Fi adapter 'state up' and running. Note down you WiFi adpter name such as wlp5s0. Does the command systemd-resolve --status wlp5s0 display your default dns server? (Please don't forget to replace wlp5s0 with your own wifi adapter name). What I understand @Igor is your primary focus is getting login screen for your Wi-Fi connection.
    – Marmayogi
    Mar 26, 2019 at 3:43

4 Answers 4

5

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.

5
  • is there any way to inform UBUNTU team about this situation? It is sertainly not normal.
    – Igor
    Mar 27, 2019 at 7:01
  • This is how things are @Igor. During my attempt to install Oracle 18c, I had faced plenty of problems with 127.0.0.53 and finally solved using this simple symlink solution. Even Centos 7, you will find similar issues. However, what exactly is to complain with Ubuntu team? What is in your mind?
    – Marmayogi
    Mar 27, 2019 at 10:49
  • Last UBUNTU I tried was 15. It worked well. I tested it on this network as well - no problems. Debian 8.6 & 9.8 work fine. They have different way of networking handling. I am pretty sure, that when I install the system, I must be able to use networking from the box, but not looking for the problem solution. Do you agree, @Marmayogi? Whatever people say of Microsoft, but nobody would ever have this kind of issue.
    – Igor
    Mar 27, 2019 at 12:03
  • Two points... the systemd-resolve --status command already showed the correct DNS server, your original symlink used stub-resolv.conf, and re-symlinking to /run/systemd/resolve/resolv.conf also showed the correct DNS server... the problem with your symlink is that you may have problems with VPN and DNS leaks. Best to use the symlink in my answer.
    – heynnema
    Mar 29, 2019 at 12:56
  • Ok, I will do that. Thank you. It is not so convenient, though. Actually when setting up VPN it is necessary to alter network configuration. This is not my case now. I needed to get UBUNTU on the internet. Another thing is I do not have /run/resolvconf/resolv.conf file on my system. It is UBUNTU 18.10
    – Igor
    Mar 31, 2019 at 18:12
4
  1. First... remove your edits from /etc/network/interfaces.

  2. Next, we delete your static /etc/resolv.conf file and replace it with the original symlink...

In terminal...

cd /etc # change directory

sudo rm -i resolv.conf # delete static file

sudo ln -s /run/resolvconf/resolv.conf /etc/resolv.conf # recreate symlink

Now DO NOT manually edit this file!

  1. Finally, set your DNS servers here...

Set DNS Automatic to OFF. Enter comma-separated DNS IP addresses.

enter image description here

7
  • @Igor Did you remove your edits from /etc/network/interfaces? Did you enter the values that I've circled in RED? Edit your question and show me a screenshot of the IPv4 tab so I can see your settings.
    – heynnema
    Mar 25, 2019 at 17:43
  • It looks like the image has been blocked. I will try to find a way to open. I did edit 'interfaces' file and saw the results. But it is original now. OS is clean installed.
    – Igor
    Mar 25, 2019 at 19:53
  • 1
    this happened to work better sudo ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf. There is no need to change network configuration manually. I have it already working.
    – Igor
    Mar 29, 2019 at 11:24
  • @Igor but you may have a problem if you're going to use VPN.
    – heynnema
    Mar 29, 2019 at 12:51
  • Thank you @heynnema, I did not know that. In case I have a problem, I will go your way.
    – Igor
    Mar 29, 2019 at 19:38
1

td;dr

/etc/resolv.conf should not be edited by users

> cat /etc/resolv.conf # Ubutnu 18
# This file is managed by man:systemd-resolved(8). Do not edit.
#
# This is a dynamic resolv.conf file for connecting local clients to the
# internal DNS stub resolver of systemd-resolved. This file lists all
# configured search domains.
#
# Run "systemd-resolve --status" to see details about the uplink DNS servers
# currently in use.

Network Manger has changed to "netplan" in Ubuntu 18
netplan's tool for managing DNS is systemd-resolve

* on the fly configuration *
1. check
sudo systemd-resolve --status eth0
eth0 is your interface

if there were no DNS servers, set it
2. set
sudo systemd-resolve --interface eth0 --set-dns 1.1.1.1
(you can add more using multiple --set-dns option)

* for persistent configuration *
Take look at ...
cat /etc/netplan/*.yaml

And example of a yaml file

network:
  version: 2
  renderer: networkd
  ethernets:
    ens3:
      dhcp4: no
      addresses:
        - 192.168.121.199/24
      gateway4: 192.168.121.1
      nameservers:
          addresses: [8.8.8.8, 8.8.4.4]

See more
1. how-to-set-dns-nameservers-on-ubuntu-18-04
2. netplan

Also you can install "resolveconf" which is simpler
plus none of these are best, if your are managing a Server.
For Server take look at FreeBSD tool: relayd
or PowerDNS tool: dnsdist

0

I used resolv.conf to set nameserver and search because of VPN but it wasn't right solution even before Ubuntu 18 (because it is not used only for VPN but for all connections). Better solution is using openvpn-systemd-resolved and this solution works for me.

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.