My NetworkManager is not writing to /var/run/networkmanager/resolv.conf
and NetworkManager not populating resolv.conf is not the answer to my situation, because I don't use resolvconf
. More details below:
I switched managing my ethernet from /etc/network/interfaces
to NetworkManager, which somehow never writes to /var/run/networkmanager/resolv.conf
:
$ nmcli d
DEVICE TYPE STATE CONNECTION
eth0 ethernet connected Wired connection 1
lo loopback unmanaged --
$ ls /var/run/NetworkManager/resolv.conf
ls: cannot access '/var/run/NetworkManager/resolv.conf': No such file or directory
$ ls /var/run/nm-dns-dnsmasq.conf
ls: cannot access '/var/run/nm-dns-dnsmasq.conf': No such file or directory
That never bothered me when I'm using /etc/network/interfaces
, but now that I'm using NetworkManager, I need it to update my resolv.conf
.
Here is my NetworkManager.conf
:
cat /etc/NetworkManager/NetworkManager.conf
[main]
plugins=ifupdown,keyfile
dns=dnsmasq
[ifupdown]
managed=false
[device]
wifi.scan-rand-mac-address=no
Some answers say I should have dns=dnsmasq
in there, but some say I should not. All in all, I'm still confused how to have NetworkManager updating /var/run/networkmanager/resolv.conf
.
Update, further info:
$ resolvectl status | grep DNS
-su: resolvectl: command not found
$ dpkg -l '*dns*' | grep 'ii *dns'
ii dns-root-data 2018013001 all DNS root data including root zone
ii dnsmasq 2.79-1 all Small caching DNS proxy and DHCP/
ii dnsmasq-base 2.79-1 amd64 Small caching DNS proxy and DHCP/
ii dnsutils 1:9.11.3+dfs amd64 Clients provided with BIND
$ dpkg -l '*resolv*' | grep ii || echo no resolvconf
no resolvconf
$ ls -al /etc/resolv.conf
-rw-r--r-- 1 root root 79 2019-03-03 18:42 /etc/resolv.conf
$ host 8.8.8.8
8.8.8.8.in-addr.arpa domain name pointer google-public-dns-a.google.com.
$ host www.ebay.com
www.ebay.com is an alias for slot9428.ebay.com.edgekey.net.
slot9428.ebay.com.edgekey.net is an alias for e9428.b.akamaiedge.net.
e9428.b.akamaiedge.net has address 104.93.181.25
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.1 LTS
Release: 18.04
Codename: bionic
Update2.
- This is not a vanilla Ubuntu installation, but my customized installation from fresh (not an upgrade from previous version). I remove
resolvconf
myself, because I was using/etc/network/interfaces
, and didn't want my/etc/resolv.conf
to be changing all the time. Maybe that's the culprit and NetworkManager can't work withoutresolvconf
? - My full intention is to "Replace systemd-resolved with dnsmasq" (which I practiced using 18.04 LiveCD, which has the
resolvconf
), and use it for my LAN DNS server. Em, maybe in that case I don't need NetworkManager changing my/etc/resolv.conf
all the time.
Anyway, here are the info for further investigation:
$ dpkg -l '*resolv*'
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-==============-============-============-=================================
un resolvconf <none> <none> (no description available)
$ cat /run/resolvconf/resolv.conf
cat: /run/resolvconf/resolv.conf: No such file or directory
$ cat /run/systemd/resolve/resolv.conf
# This file is managed by man:systemd-resolved(8). Do not edit.
. . .
nameserver 64.71.255.204
nameserver 64.71.255.198
search hitronhub.home
$ cat /etc/netplan/*.yaml
# Let NetworkManager manage all devices on this system
network:
version: 2
renderer: NetworkManager
ethernets:
eth0:
addresses: [192.168.0.11/24, 192.168.0.10/24]
gateway4: 192.168.0.1
$ ps auxc | grep resolv
systemd+ 23890 0.0 0.0 70608 1520 ? Ss Mar01 0:00 systemd-resolve
$ sudo lsof -i tcp:53
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
systemd-r 23890 systemd-resolve 13u IPv4 47127798 0t0 TCP 127.0.0.53:domain (LISTEN)
dnsmasq 29822 dnsmasq 5u IPv4 47935969 0t0 TCP 192.168.0.10:domain (LISTEN)
dnsmasq 29822 dnsmasq 7u IPv4 47935971 0t0 TCP 192.168.0.11:domain (LISTEN)
dnsmasq 29822 dnsmasq 9u IPv4 47935973 0t0 TCP localhost.myhost.org:domain (LISTEN)
dnsmasq 29822 dnsmasq 11u IPv6 47935975 0t0 TCP [fe80::xxxx]:domain (LISTEN)
dnsmasq 29822 dnsmasq 13u IPv6 47935977 0t0 TCP [2607:fea8:xxxx]:domain (LISTEN)
dnsmasq 29822 dnsmasq 15u IPv6 47935979 0t0 TCP [fd00:xxxx]:domain (LISTEN)
dnsmasq 29822 dnsmasq 17u IPv6 47935981 0t0 TCP ip6-localhost:domain (LISTEN)
resolvectl status | grep DNS
Welcome to Ask Ubuntu.dpkg -l *dns* | grep ii
anddpkg -l *resolv* | grep ii
andls -al /etc/resolv.conf
andhost 8.8.8.8
andhost www.ebay.com
. Report back to @heynnemaresolvectl: command not found
for that.cat /run/resolvconf/resolv.conf
andcat /run/systemd/resolve/resolv.conf
andcat /etc/netplan/*.yaml
andps auxc | grep resolv
. Have you made any modifications to any network software here? Uninstalled something? Show this command again... with no modifications...dpkg -l *resolv*
, Why no resolvconf?