Skip to main content
89 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
46 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,067
40 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
36 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
16 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
  • 161
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
13 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,575
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,047
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
  • 471
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

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,574
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
Accepted

systemd: who setup lo interface without ifupdown?

The loopback interface is set up in early boot (before e.g. any network servers are run). It seems there was no significant variation between distributions. Current Debian ifupdown would bring up lo ...
sourcejedi's user avatar
  • 51.1k
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 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
  • 101k
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
  • 37.2k
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
  • 101k
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

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
  • 443
5 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
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 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
  • 135
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 .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
5 votes
Accepted

Default gateway metric in systemd-networkd

You can delete the Gateway= directive from the [Network] section, and specify it in a separate [Route] section, then you can bundle it with a Metric= directive. From the official documentation: https:...
iBug's user avatar
  • 3,568
4 votes

Predictable Network Interface Names break vm migration

Surely this is a problem that cloud providers (Azure, AWS, RackSpace, Openstack) have already solved when they import vms. I think OpenStack uses cloud-init, ConfigDrive format, and provides a ...
sourcejedi's user avatar
  • 51.1k
4 votes
Accepted

Predictable Network Interface Names break vm migration

I gave up on trying to do this cleanly, and came up with the following hack. By running the following script just before shutting down the vm and migrating, the vm will have eth0 as the network ...
spuder's user avatar
  • 18.2k

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