Skip to main content
96 votes
Accepted

How to configure systemd-resolved and systemd-networkd to use local DNS server for resolving local domains and remote DNS server for remote domains?

In the configuration file for local network interface (a file matching the name pattern /etc/systemd/network/*.network) we have to either specify we want to obtain local DNS server address from DHCP ...
Piotr Dobrogost's user avatar
50 votes

How exactly are NetworkManager, networkd, netplan, ifupdown2, and iproute2 interacting?

systemd-networkd when its enabled honors configurations in /etc/systemd/network Whereas NetworkManager will follow some automatic rules like it will try to connect to a wired connection if it finds ...
jdwolf's user avatar
  • 5,267
43 votes

How exactly are NetworkManager, networkd, netplan, ifupdown2, and iproute2 interacting?

I won't try to answer your entire question, but I've found a few things that helped me understand how these systems fit together. Hope this helps someone as this was very confusing to me 1 - The old ...
Elliptical view's user avatar
38 votes

Why are my cloned linux VMs fighting for the same IP

systemd-networkd uses a different method to generate the DUID than dhclient. dhclient by default uses the link-layer address while systemd-networkd uses the contents of /etc/machine-id. Since the VMs ...
wickedchicken's user avatar
21 votes
Accepted

Why are my cloned linux VMs fighting for the same IP

What about netplan configuration? There is an option dhcp-configuration that can be used as follows (excerpt from netplan examples): network: version: 2 ethernets: enp3s0: dhcp4: yes ...
brian's user avatar
  • 326
18 votes

systemd-networkd-wait-online failure

Basically the same answer as @alexei, but the option --any allows you to wait for any interface to come online. You may also benefit from the --timeout option. See the documentation for more ...
recke96's user avatar
  • 181
15 votes
Accepted

How to add a static route in systemd-networkd?

This is a bug in systemd, still present on version 240. Per the thread above, a workaround (or solution, I am not sure about the status since the bug is still open) is to add GatewayOnlink=yes in the [...
WoJ's user avatar
  • 1,663
14 votes
Accepted

How do I check DHCP lease time in systemd-networkd?

Depending on the OS; Enabling debug isn't always necessary. systemd-networkd should store the lease info under /run/systemd/netif/leases/ i.e. cat /run/systemd/netif/leases/2
Joseph Tingiris's user avatar
10 votes
Accepted

Binding to an IP address on an interface that comes and goes

If the app supports it (or if it's your app, or if you're willing to patch it), there's a setsockopt flag IP_FREEBIND in Linux 2.4+ (and FreeBSD) which allows binding a socket to an address that doesn'...
hobbs's user avatar
  • 1,133
9 votes

How do I check DHCP lease time in systemd-networkd?

I can't find authoritative documentation for this, but I think networkd's DHCP client uses the received DHCP lease duration to set valid_lft and preferred_lft on the address in kernel, and thus the ...
myxal's user avatar
  • 175
8 votes
Accepted

Set routing metrics for static IPs with systemd-networkd?

In this thread you can see the developers talking about how things work vs. how things should work: https://github.com/systemd/systemd/issues/928 They give a couple examples: Under the Route tag [...
HackSlash's user avatar
  • 491
7 votes

Debian systemd network-online.target not working?

I once found an answer on Github that solved it by continuously trying to ping a server. Only when the ping comes through, the service continues: [Service] ExecStartPre=/bin/sh -c 'until ping -c1 ...
Sam's user avatar
  • 200
7 votes

systemd-networkd-wait-online failure

Just adding to this that you can also specify a specific interface for systemd-networkd-wait-online to wait for using ExecStart=/lib/systemd/systemd-networkd-wait-online --interface=eth0 This will ...
Righteous Lightning's user avatar
7 votes

How to configure systemd-resolved and systemd-networkd to use local DNS server for resolving local domains and remote DNS server for remote domains?

Just to expand on @piotrDobrogost 's excellent answer, don't forget to config /etc/nsswitch.conf to use systemd-resolved as a DNS resolution source. Your hosts directive should look as follows for ...
F1Linux's user avatar
  • 2,764
6 votes
Accepted

Configuring a bridge interface with systemd-networkd

Check for config files in /lib/systemd/network/ or /run/systemd/network, it seems some other config file is matching your eno1 interface and starts DHCP on it
gdamjan's user avatar
  • 176
6 votes

How can I make my user services wait till the network is online?

As this topic is No1 in google search results I share an alternate solution for all who will face the same problem. In my system I added a simplified equivalent to /lib/systemd/system/systemd-networkd-...
Vitaly's user avatar
  • 61
6 votes

systemd-networkd-wait-online failure

It might be due to systemd-networkd-wait-online utility waiting for interfaces that are not going to come up (e.g. ethernet ports with unplugged cables) in some corner cases, like having two ethernet ...
alexei's user avatar
  • 473
6 votes

How do I check DHCP lease time in systemd-networkd?

Per Lennart's post here, you have to change systemd-networkd log level to debug. If you wanted to have it on all the time you could use a drop-in unit: mkdir -p /etc/systemd/system/systemd-networkd....
6 votes
Accepted

new IP address whereas DHCP lease time not out

The DHCP Discover packet includes a RFC 4361-style client identifier (option 61, also known as DUID) with systemd's Enterprise number (43793). This is because your /etc/systemd/network/dhcp.network ...
telcoM's user avatar
  • 114k
6 votes
Accepted

Is there a way to save current state of network configuration in linux into a datafile or set of ip commands like iptables-save?

Some support does exist for saving addresses, routes and rules, using iproute2's ip command. For obvious reason, this doesn't exist for links, even if one could imagine the possibility to save some ...
A.B's user avatar
  • 39.5k
6 votes

Detect if current connection is metered without NetworkManager

There is no single sure way to automatically detect that. There are some ways for the network to give a hint that it's metered, but those methods are nowhere near ubiquitously deployed. An Android ...
telcoM's user avatar
  • 114k
6 votes
Accepted

systemd.network DUID, IAID and DHCPv4 clientIdentifier

When ClientIdentifier=duid is selected for DHCPv4, the resulting DHCPv4 client identifier is 0xFF (type=DUID) + four-byte IAID + the DHCPv6 DUID (which depends on DUIDType=). The default systemd-...
grawity's user avatar
  • 15.5k
5 votes
Accepted

Proper DNS suffix setup Ubuntu 17.04?

Try using only on search line in you resolv.conf search mycompany.local devnet.mycompany.nl Secondly, your test with dig using only jira fails and that is a normal behavior! dig won't auto-complete ...
Jacques's user avatar
  • 94
5 votes
Accepted

Making hostapd work with systemd-networkd using a bridge

You were close and I was in the same situation. After years of fiddling, I finally figured out the right configuration. systemd-networkd configuration For your systemd-networkd configuration in /etc/...
Kolargol00's user avatar
5 votes

How to configure systemd-resolved and systemd-networkd to use local DNS server for resolving local domains and remote DNS server for remote domains?

If you are doing this because you have an connection configured with OpenVPN, you need to use https://github.com/jonathanio/update-systemd-resolved as per https://wiki.archlinux.org/index.php/OpenVPN#...
dols's user avatar
  • 161
5 votes

Systemd-networkd: Run script after DHCP client acquires new address

networkd-dispatcher Can be used for an even more granular control of when you want your script to execute. Depending on what state you want state your script to execute, you'll have to decide which ...
Tek's user avatar
  • 181
5 votes

How exactly are NetworkManager, networkd, netplan, ifupdown2, and iproute2 interacting?

This is a pretty detailed question. I'll break it down as much as I can: Netplan: This is a YAML network configuration abstraction for various backends. It can generate configuration files for ...
Goody's user avatar
  • 51
5 votes
Accepted

How to add static ipv6 route with systemd-networkd

You cannot have two Gateway directives in one [Route] block. From reference: https://systemd.network/systemd.network.html#%5BRoute%5D%20Section%20Options Specify several "[Route]" sections to ...
iBug's user avatar
  • 3,678
5 votes

systemd .link files not working

I'm having exactly the same problem for one interface. If it makes any difference it's a usb interface using asix driver. Two of my interfaces get renamed using the .link files, this one doesn't. ...
Tim's user avatar
  • 51

Only top scored, non community-wiki answers of a minimum length are eligible