Skip to content

Instantly share code, notes, and snippets.

@quixoten
Last active August 11, 2017 17:22
Show Gist options
  • Save quixoten/ca5daf90f52ea9598fe98e988174dd4f to your computer and use it in GitHub Desktop.
Save quixoten/ca5daf90f52ea9598fe98e988174dd4f to your computer and use it in GitHub Desktop.
Systemd Networkd Problem

Working Example

nat0.network file only, nat0.netdev is absent

 ~  cat /etc/systemd/network/nat0.network 
[Match]
Name=nat0

[Network]
DHCP=no
Address=10.0.0.1/24
 ~  sudo ip addr show nat0
Device "nat0" does not exist.
 ~  sudo ip link add nat0 type bridge
 ~  sudo ip addr show nat0
8: nat0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN group default qlen 1000
    link/ether 3e:11:73:ad:f5:f1 brd ff:ff:ff:ff:ff:ff
    inet 10.0.0.1/24 brd 10.0.0.255 scope global nat0
       valid_lft forever preferred_lft forever
    inet6 fe80::3c11:73ff:fead:f5f1/64 scope link 
       valid_lft forever preferred_lft forever

The nat0 gets the static ip defined in nat0.network and VMs added to it work correctly.

Failing Example

Creating the nat0 interface with a nat0.netdev file

 ~  cat /etc/systemd/network/nat0.netdev
[NetDev]
Name=nat0
Kind=bridge
 ~  sudo ip link del nat0
 ~  sudo ip addr show nat0
Device "nat0" does not exist.
 ~  sudo systemctl restart systemd-networkd.service
 ~  sudo ip addr show nat0
9: nat0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
    link/ether c2:a5:54:9f:8c:c5 brd ff:ff:ff:ff:ff:ff
 ~  sudo ip link set nat0 up
 ~  sudo ip addr show nat0  
9: nat0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
    link/ether c2:a5:54:9f:8c:c5 brd ff:ff:ff:ff:ff:ff

The nat0 interface gets created, but is permanently DOWN.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment