You are not logged in.
On my laptop, I have two network interfaces, wlp2s0 (wireless) and enp1s0 (ethernet).
Often, I will connect to a network via enp1s0, disconnect from said network, and then connect to a new network via wlp2s0. Both networks have their own (different) DNS servers, which I would like to use.
Unfortunately, systemd-resolved keeps the nameservers and search domain from my enp1s0 network in my resolve.conf, even when the network has no carrier.
Is there a way I can have ONLY the nameservers and search domains from networks with a valid carrier? I did not have this problem with netctl.
It's also worth noting that neither of these networks have support for ipv6.
Relevant lines from networkctl status -a (slightly edited for privacy)
● 2: enp1s0
Link File: /usr/lib/systemd/network/99-default.link
Network File: /etc/systemd/network/ethernet-dhcp.network
Type: ether
State: no-carrier (configured)
Path: pci-0000:01:00.0
Driver: r8169
Vendor: Realtek Semiconductor Co., Ltd.
Model: RTL8101E/RTL8102E PCI Express Fast Ethernet controller
MTU: 1500
Address: fe80::3617:ebff:fe53:8253
DNS: 172.16.0.1
Domain: lan
NTP: 172.16.0.1
● 3: wlp2s0
Link File: /usr/lib/systemd/network/99-default.link
Network File: /etc/systemd/network/wireless.network
Type: wlan
State: routable (configured)
Path: pci-0000:02:00.0
Driver: iwlwifi
Vendor: Intel Corporation
Model: Wireless 3160 (Dual Band Wireless AC 3160)
MTU: 1500
Address: 10.21.5.107
fe80::a288:69ff:fe70:a67
Gateway: 10.21.0.1 (CISCO SYSTEMS, INC.)
DNS: 10.182.70.107
10.180.15.160
10.182.70.24
10.180.14.69
Domain: wireless.network
NTP: 10.180.15.160
10.182.70.107
Any my resolv.conf (symlinked from /run/systemd/resolve/resolve.conf)
# This file is managed by systemd-resolved(8). Do not edit.
#
# Third party programs must not access this file directly, but
# only through the symlink at /etc/resolv.conf. To manage
# resolv.conf(5) in a different way, replace the symlink by a
# static file or a different symlink.
nameserver 172.16.0.1
nameserver 10.182.70.107
nameserver 10.180.15.160
# Too many DNS servers configured, the following entries may be ignored.
nameserver 10.182.70.24
nameserver 10.180.14.69
search lan wireless.network
As you can see, the 172.16.0.1 nameserver comes first, despite the fact that it's on the disconnected network, which drastically slows down my DNS lookups.
Thanks.
Offline
If netctl worked fine for you why change away from it?
You can find the behavior you want with dhcpcd and optionally openresolv as well.
It also does the same for other per interface configs such as NTP, etc.
Offline
While netctl handled DNS servers better, I had some issues with how it dealt with interfaces and wpa-supplicant. Dhcpcd and openresolv are possible options that I will look into if this does not work out.
I'm simply wondering if the behavior I want is possible with systemd-resolved.
Last edited by SpyChicken (2015-11-10 09:07:37)
Offline
While netctl handled DNS servers better, I had some issues with how it dealt with interfaces and wpa-supplicant. Dhcpd and openresolv are possible options that I will look into if this does not work out.
dhcpcd.
dhcpd is a DHCP server, dhcpcd is a DHCP Client Daemon - don't confuse the two
I'm simply wondering if the behavior I want is possible with systemd-resolved.
Alas, I cannot answer that question.
Offline
Ah, I'm aware of the difference, but that c is easy to forget.
Hopefully someone will be able to give helpful advice.
Offline
Have you tried replacing “dns” with “resolve” in the “hosts:” line of /etc/nsswitch.conf ?
Offline
Have you tried replacing “dns” with “resolve” in the “hosts:” line of /etc/nsswitch.conf ?
Yes, this did not resolve my issue.
Offline
Have you tried to set proper .network files for both network interfaces in /etc/systemd/network/ ?
systemd-networkd wiki and the systemd.network man page can be helpful.
Offline