I have my laptop connected to a wifi network that is 192.168.1.0/24
. I then have that wifi adapter bridged to br0
. I then connect a tap-to-tap tunnel tap1
onto a network that is 10.40.0.0/14
.
My wifi network has a DNS server at 192.168.1.254
while the remote network has a DNS server at 10.40.0.2
. When the tap-to-tap tunnel comes up, I delete its default route so that only traffic to that network will go over the tunnel and general Internet traffic goes over the usual wifi link. But I want to use the remote network's DNS server so that I can still look up local names on the remote network.
nmcli device show wlan0
says this (I've removed various irrelevant bits for brevity, mostly ip6 and routing information):
GENERAL.DEVICE: wlan0
GENERAL.TYPE: wifi
GENERAL.STATE: 100 (connected)
GENERAL.CONNECTION: channel-six
IP4.ADDRESS[1]: 192.168.1.82/24
IP4.GATEWAY: 192.168.1.254
IP4.DNS[1]: 192.168.1.254
IP4.DNS[2]: 10.40.0.2
IP4.DOMAIN[1]: lan
This says that this device has both DNS servers assigned to it. But nmcli con show channel-six
says this:
connection.id: channel-six
connection.uuid: 34402de9-ec2d-4a4e-a223-9bea7fc5b517
...
ipv4.dns: 10.40.0.2
ipv4.dns-search: --
ipv4.dns-options: ""
ipv4.dns-priority: 0
So why is NetworkManager using the local DNS server? How can I change it?
The local DNS is being picked up from DHCP. This can be fixed like this:
The
modify
command can also have--temporary
added to make this a temporary change. Thecon up
is necessary to apply the change.