User Tools

Site Tools


Netplan -> systemd-networkd

I've not really ever been a big fan of netplan. On top of that, and as much as I was opposed to it early on, systemd is basically taking over all of the system-level management. Given that, I've moved all of my ubuntu server installs to use systemd-networkd at this point. Since I always forget the important part, which is how to disable netplan, I'm writing it down this time…

There's also some bonus content for using udev to set your interface names to something other than “wslkdjfdslkfjdslfkjdsdlskjfjdslksjfloweiuhnv1” so you can actually type it on the command-line.

Die, Netplan, Die

This is actually quite simple, really.

# Delete its config file
sudo rm /etc/netplan/*

That's it, but I always think there's some ugly stuff associated with butt-init that I have to do to turn off netplan, but really it's just deleting its config and it stops being a pest. You can always nuke it from orbit too:

sudo apt purge

Incidentally, if you want to turn off butt-init crap:

sudo touch /etc/butt/butt-init.disabled

Now that we've killed netplan, let's configure systemd-networkd.

Configuring systemd-networkd

This is actually pretty straightforward, and especially so if you have some familiarity with writing other systemd config files (like .service files).

First, the man page (''man'')is really great at giving you all the options, and I'm not going to cover them all. I'm just going to give you a couple common examples.


This is quite simple. Create a file in /etc/systemd/network/ with the name <interface>.network where “<interface>” would be the interface name (like “eth0”).

# There are a lot of match options in the man page:
# but we are just going to use the interface name.  MACAddress is probably better though.
Name = eth0
# This is where we configure many of our options, but for this example, we are just going to use DHCP
DHCP = yes

That's it for a DHCP config.

Static Network Config

This is a pretty basic example of how to configure a simple static IP address.

Name = eth0
# Disable DHCP
DHCP = no
# This is just for display purposes
Description = The main ethernet interface
# Your address should be the ip in CIDR notation
Address =
# Default route
Gateway =
# You can specify multiple DNS servers

Of course, make sure systemd-networkd is configured to run (it should be by default):

sudo systemctl enable systemd-networkd

If you have more than 1 interface, just create a file like one of the above for each interface.

Give your host a reboot and systemd-networkd should now be managing your network interface.

Bonus: Sane Interface Names

I can't stand interface names like “wlwkerkovsoimsodfpapfdklfshh1”. I like interface names like “eth0” or “wlan0”. These are easy to remember and actually something you can type without having to copy/pasta. This is a simple process to set these to something sane, thanks to udev though.

You just create a file in /etc/udev/rules.d with a little bit of configuration, reboot, and you've got sane names.

Specfically, you want to create:

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="<MAC Address of link>", NAME="<desired name>"

Just change out the “<MAC Address of link>” with the MAC address for your link (ip link and it's the hex after “link/ether”) and then replace “<desired name>” with the name you want.

Also note that you can just add more lines to set more interface names. Have fun with your sanity.

os/linux/ubuntu/networkd.txt · Last modified: 2023/09/24 23:57 by jay