I have a laptop running Ubuntu 16.04 connected to two different networks (in fact, I have 5 different laptop models all experiencing this). One is a wireless network the other one isn't. On these two networks I have different DNS servers.
I regularly experience that when attempting to ping or establish an ssh connection to a known host, I get a 'unknown host' error, I can run five ping commands a second apart, and sometimes all five get through, sometimes only one or two (or none). I experience the same when I use 'nslookup' on a hostname. When using SSH with an IP address, I never receive any errors. This leads me to believe that Ubuntu randomly selects which networks' DNS server to use.
So is there a way to select which networks' DNS server should be used, or have Ubuntu ask both of them, provided one of them doesn't know the host?
'ip route list' lists different metrics for the networks, with one set to 100 and one to 600.
If there is any other information that might be relevant, please let me know.
The contents of /etc/resolv.conf:
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
nameserver 127.0.1.1
search xx.yy.zz
Output of ip route list
default via 10.80.0.1 dev enp0s25 proto static metric 100
default via 10.125.64.1 dev wlo1 proto static metric 600
10.80.0.0/24 dev enp0s25 proto kernel scope link src 10.80.0.54 metric 100
10.125.64.0/19 dev wlo1 proto kernel scope link src 10.125.83.244 metric 600
10.220.2.16 via 10.80.0.1 dev enp0s25 proto dhcp metric 100
169.254.0.0/16 dev enp0s25 scope link metric 1000
192.0.2.1 via 10.125.64.1 dev wlo1 proto dhcp metric 600
user@host:~$ nmcli dev show enp0s25 | grep DNS
IP4.DNS[1]: 10.220.2.5
user@host:~$ nmcli dev show wlo1 | grep DNS
IP4.DNS[1]: 10.220.2.24
/etc/resolv.conf
nameservers 192.168.x.x 10.x.x.x 8.8.8.8
(adjust to your own needs) and test if it works now. If it works you know that your dhcp server is not set up correctly