Files
nixos/hosts/fw.cloonar.com/modules/networking.nix
2023-12-01 00:13:21 +01:00

89 lines
1.9 KiB
Nix

{ ... }: {
boot.kernel.sysctl = {
# if you use ipv4, this is all you need
"net.ipv4.conf.all.forwarding" = true;
# If you want to use it for ipv6
"net.ipv6.conf.all.forwarding" = false;
};
systemd.network = {
wait-online.anyInterface = true;
inks = {
"10-wan" = {
matchConfig.PermanentMACAddress = "a8:b8:e0:00:43:c1";
linkConfig.Name = "wan";
linkConfig.RequiredForOnline = "routable";
};
"20-lan" = {
matchConfig.PermanentMACAddress = "a8:b8:e0:00:43:c2";
linkConfig.Name = "lan";
};
"30-server" = {
matchConfig.PermanentMACAddress = "a8:b8:e0:00:43:c3";
linkConfig.Name = "server";
};
};
};
networking = {
useDHCP = false;
nameservers = [ "9.9.9.9" "149.112.112.112" ];
# Define VLANS
vlans = {
multimedia = {
id = 3;
interface = "enp5s0";
};
smart = {
id = 4094;
interface = "enp5s0";
};
guest = {
id = 100;
interface = "enp5s0";
};
};
interfaces = {
# Don't request DHCP on the physical interfaces
lan.useDHCP = false;
server.useDHCP = false;
enp5s0.useDHCP = false;
# Handle the VLANs
wan.useDHCP = true;
lan = {
ipv4.addresses = [{
address = "10.42.96.1";
prefixLength = 24;
}];
};
server = {
ipv4.addresses = [{
address = "10.42.97.1";
prefixLength = 24;
}];
};
multimedia = {
ipv4.addresses = [{
address = "10.42.99.1";
prefixLength = 24;
}];
};
smart = {
ipv4.addresses = [{
address = "10.42.100.1";
prefixLength = 24;
}];
};
guest = {
ipv4.addresses = [{
address = "10.42.254.1";
prefixLength = 24;
}];
};
};
};
}