Ubuntu 18.04 not recognizing hostnames from router
Solution 1:
This seems to related to this issue:
https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/1624320
On a fresh install, /etc/resolv.conf
is linked to /run/systemd/resolve/stub-resolv.conf
instead of /run/systemd/resolve/resolv.conf
.
Updating it per https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/1624320/comments/8 fixed it.
Solution 2:
Here is what happen: systemd-resolved do not resolve local domain names if the names are not fully qualified names like mate.local
As told in a doc about Systemd-networkd, a good fix is to trim the /etc/nsswitch.conf
file
sudo nano /etc/nsswitch.conf
Modify the hosts line
# /etc/nsswitch.conf
#
# Example configuration of GNU Name Service Switch functionality.
# If you have the `glibc-doc-reference' and `info' packages installed, try:
# `info libc "Name Service Switch"' for information about this file.
passwd: compat systemd
group: compat systemd
shadow: compat
gshadow: files
# ---- MODIFY THIS LINE ------------------------------------------------
# hosts: files mdns4_minimal [NOTFOUND=return] dns myhostname
# ---- TO --------------------------------------------------------------
hosts: files mdns4_minimal dns myhostname
# ---- THATS ALL -------------------------------------------------------
networks: files
protocols: db files
services: db files
ethers: db files
rpc: db files
netgroup: nis
Explanation:
Hostname resolving search first in files (/etc/hosts
), then with avahi (zeroconf), then ask to dns server. And do not more stop if avahi does not find a local name as [NOTFOUND=return]
forced. Hope its clear.
restart service
sudo systemctl restart systemd-resolved
Solution 3:
A workaround given in this bug report comment solved it for my Ubuntu 18.04 LTS installation.
Disable and stop the systemd-resolved service:
sudo systemctl disable systemd-resolved.service
sudo systemctl stop systemd-resolved
Then put the following line in the [main] section of your /etc/NetworkManager/NetworkManager.conf:
dns=default
Delete the symlink /etc/resolv.conf
rm /etc/resolv.conf
Restart network-manager
sudo service network-manager restart