Systemd-neworkd configuration

I’m new to systemd-networkd, and I’m trying to configure some static IPs and routing rules. I see from the clear linux guide that I should add my configurations to a file called /etc/systemd/network/70-static.network

Does the file need to be called 70-static.network? In non-Clear Linux online material about networkd, it seems like the file can be called different names like “static.network” or “20-static.network” or “10-eth0-static.network”.

Also, if I have multiple network interfaces that I need to configure, should I put all the configurations in the 70-static.network file? Or, should I make separate files for each network interface (and if so, what naming convention do I use)?

You should define a separate .network file for each interface.

70-static.network is just an example file name. The examples you gave will work too as long as the extension is .network.

The prefix number just helps load the network configurations in a specific order if needed. This is common convention with systemd configuration files.

From the systemd.network man page:

All configuration files are collectively sorted and processed in lexical order

2 Likes

Pay attention to the numbers, they set the sort order they get load in. The lower the number the sooner it gets loaded, think init startup and shutdown scripts.

Just be sure you are running systemd-networkd as your network manager.

In the past month CL added NetworkManger as an other network manager for Ethernet. You can find more info executing man stateless

1 Like

From man stateless;

Network interface management
Clear Linux has switched the network interface management model to be fully managed by NetworkManager when installed on real hardware. Previously, Ethernet interfaces were managed by systemd-networkd whereas Wi-Fi and others were managed by NetworkManager. Clear Linux cloud images continue to use systemd-networkd.
When updating from previous versions of Clear Linux, the installation will be reconfigured to continue with systemd-networkd managing the Ethernet interfaces. Since the connectivity could be lost during the procedure, physical access to the system is required.

To switch to NetworkManager for all the interfaces, the user should disable and stop systemd-networkd:
sudo systemctl disable systemd-networkd sudo systemctl stop systemd-networkd

Then, remove the file /etc/NetworkManager/conf.d/systemd-networkd-unmanaged.conf

Finally, restart NetworkManager;
sudo systemctl restart NetworkManager


The above text seems to imply that if you’re using Clear Linux on a NUC or laptop, you should likely use NetworkManager to manage you network. If you’re in a VM or similar, use systemd-networkd.

3 Likes

Welcome to the forum, Jeremiah.

Thanks for sharing your systemd solutions :wink:

1 Like