7

I would like to use systemd-networkd to configure my networking on Ubuntu.

I added an /etc/systemd/netwoek/host0.network file

[Match]
Name=host0

[Network]
Address=10.5.1.1/24
Gateway=10.5.1.254

to configure my host0:

# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: host0@if14428: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether d6:fa:2e:69:dd:30 brd ff:ff:ff:ff:ff:ff link-netnsid 0
    inet 169.254.229.86/16 brd 169.254.255.255 scope link host0
       valid_lft forever preferred_lft forever
    inet6 fe80::d4fa:2eff:fe69:dd30/64 scope link
       valid_lft forever preferred_lft forever

But, as seen above it is not configured with 10.5.1.1 despite restarting systemd-networkd, enabling it, rebooting. Each time the address is from APIPA (as if there was no DHCP, which is not configured there).

In no other places is networking configured (notably in /etc/network/interfaces, which is empty)

  • Did you look at the output of networkctl yet? What about systemctl status systemd-networkd? – Daniel B Jul 26 '17 at 11:08
15

From https://coreos.com/os/docs/latest/network-config-with-networkd.html :

Enable debugging manually

mkdir -p /etc/systemd/system/systemd-networkd.service.d/

Create Drop-In /etc/systemd/system/systemd-networkd.service.d/10-debug.conf with following content:

[Service]
Environment=SYSTEMD_LOG_LEVEL=debug

And restart systemd-networkd service:

systemctl daemon-reload
systemctl restart systemd-networkd
journalctl -b -u systemd-networkd
| improve this answer | |
  • 2
    systemctl edit systemd-networkd is slightly faster as it creates automatically the needed folder and doesn't need daemon-reload. – Max Oct 31 '19 at 13:35
  • For some reason I had to reboot before debugging was activated for systemd-networkd. Just mentioning it in case someone else struggles. (Yes, I tried reloading and restarting - multiple times.) Running systemd 243. – hansfn Dec 9 '19 at 10:10
0

The previous answers are great to find out what is running and what isn't, and restarting the service.

I'd add (from How to enable if it's disabled):

systemctl enable <your.service.here>

e.g. systemd-networkd

Also, I'm not sure what Name=host0 matches. I guess something, since it shows up in 2: host0@if14428 under ip addr. But using and interface name, or MAC address, as it appears in ip link is a safer bet.

| improve this answer | |
  • host0 is in fact an interface name -- it's the default name on systemd-nspawn containers for the "inside" half of a veth pair. – user1686 Jul 21 '18 at 16:28
  • this is a useless answer, if i were you i'd remove it – nhed Aug 15 '19 at 0:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.