config-perso/machines/kat-r86s/router.nix

77 lines
1.8 KiB
Nix
Raw Normal View History

2024-03-15 10:46:02 +01:00
{config, lib, pkgs, ...}: {
2024-03-26 16:06:08 +01:00
boot.kernel.sysctl."net.ipv4.ip_forward" = true;
2024-03-15 10:46:02 +01:00
2024-05-06 15:00:43 +02:00
# networking.nat = {
# enable = true;
# internalInterfaces = [ "enp2s0" ];
# externalInterface = "enp1s0";
# };
2024-03-26 16:06:08 +01:00
networking.interfaces.enp2s0 = {
useDHCP = false;
ipv4.addresses = [{ address = "192.168.42.1"; prefixLength = 24; }];
2024-03-15 10:46:02 +01:00
};
2024-03-26 16:06:08 +01:00
2024-05-14 19:18:30 +02:00
# networking.interfaces.enp3s0 = {
# useDHCP = false;
# ipv4.addresses = [{ address = "192.168.222.1"; prefixLength = 24; }];
# ipv6.addresses = [{ address = "fd26:baf9:d250:8000::ffff"; prefixLength = 64; }];
# };
2024-05-06 15:00:43 +02:00
2024-03-15 10:46:02 +01:00
services.dnsmasq = {
enable = true;
settings = {
2024-05-14 19:18:30 +02:00
interface = [ "vlan-admin" ];
2024-03-15 10:46:02 +01:00
bind-dynamic = true;
dhcp-option = "3,0.0.0.0";
2024-05-06 15:00:43 +02:00
dhcp-range = "192.168.222.100,192.168.222.254,255.255.255.0,infinite";
2024-03-15 10:46:02 +01:00
};
};
2024-05-14 19:18:30 +02:00
systemd.network = {
enable = true;
networks = {
"10-enp3s0" = {
name = "enp3s0";
networkConfig = {
VLAN = [ "vlan-admin" "vlan-user-test" ];
LinkLocalAddressing = false;
LLDP = false;
EmitLLDP = false;
IPv6AcceptRA = false;
IPv6SendRA = false;
};
};
"10-vlan-admin" = {
name = "vlan-admin";
address = [
"fd26:baf9:d250:8000::ffff/64"
"192.168.222.1/24"
];
};
"10-vlan-user-test" = {
name = "vlan-user-test";
networkConfig = {
DHCP = "ipv4";
};
};
};
netdevs = {
"10-vlan-admin" = {
netdevConfig = {
Name = "vlan-admin";
Kind = "vlan";
};
vlanConfig.Id = 3000;
};
"10-vlan-user-test" = {
netdevConfig = {
Name = "vlan-user-test";
Kind = "vlan";
};
vlanConfig.Id = 4000;
};
};
};
2024-03-15 10:46:02 +01:00
}