Hi there,
I’m trying to setup a router using nixos.
I want to use systemd-networkd to configure the network interfaces.
As I move from an arch linux I’m familiar with the networkd config but how is the ‘nixos way’ to create the config files for systemd?
These are used to configure the interface on a working setup (not nixos).
First, set a name for the interface
cat /etc/systemd/network/10-wan0.link
[Match]
Path=pci-0000:02:00.0
[Link]
Name=wan0
Second, config the interface
cat /etc/systemd/network/20-wan0.network
[Match]
Name=wan0
[Network]
ConfigureWithoutCarrier=yes
Address=<ip of this interface>
[Route]
Gateway=<ip of gateway>
This is the part to configure my device in configuration.nix
.
It only generates the .link
file. The .network
file for systemd-networkd is missing.
systemd.network.links = {
"10-wan0" = {
matchConfig.Path="pci-000:02:00.0";
linkConfig.Name="wan0";
};
};
systemd.network = {
networks.wan0 = {
enable = true;
name = "wan0";
networkConfig = {
ConfigureWithoutCarrier="yes";
};
address = [ "<ip of this interface>/<netmask>" ];
gateway = [ "<IP of gateway" ];
};
};
What am I missing here to configure the network device properly using systemd-networkd
?