2022-07-20 09:20:39 +02:00
|
|
|
|
{ config, pkgs, lib, ... }:
|
2022-07-16 21:32:14 +02:00
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
imports =
|
|
|
|
|
[ # Include the results of the hardware scan.
|
|
|
|
|
./hardware-configuration.nix
|
|
|
|
|
./voip.nix
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
# Use the systemd-boot EFI boot loader.
|
|
|
|
|
boot.loader.systemd-boot.enable = true;
|
|
|
|
|
boot.loader.efi.canTouchEfiVariables = true;
|
|
|
|
|
|
|
|
|
|
networking.hostName = "yate";
|
|
|
|
|
|
|
|
|
|
boot.kernel.sysctl = {
|
|
|
|
|
"net.ipv4.conf.all.forwarding" = true;
|
|
|
|
|
"net.ipv6.conf.all.forwarding" = true;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
networking.useNetworkd = true;
|
2022-07-17 23:10:29 +02:00
|
|
|
|
services.resolved.dnssec = "false";
|
2022-07-16 21:32:14 +02:00
|
|
|
|
systemd.network = {
|
|
|
|
|
networks."10-ens18" = {
|
|
|
|
|
matchConfig = {
|
|
|
|
|
Name = "ens18";
|
|
|
|
|
};
|
|
|
|
|
address = [
|
|
|
|
|
"10.42.10.6/24"
|
|
|
|
|
"2a01:4f8:1c0c:8221::6/64"
|
|
|
|
|
];
|
|
|
|
|
gateway = [
|
|
|
|
|
"10.42.10.1"
|
|
|
|
|
"2a01:4f8:1c0c:8221::1"
|
|
|
|
|
];
|
|
|
|
|
dns = [
|
|
|
|
|
"10.42.10.8"
|
|
|
|
|
"2a01:4f8:1c0c:8221::8"
|
|
|
|
|
];
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
links."20-vlan132" = {
|
|
|
|
|
matchConfig.MACAddress = "4e:9e:f3:3e:ed:36";
|
|
|
|
|
linkConfig.Name = "vlan132";
|
|
|
|
|
};
|
|
|
|
|
networks."20-vlan132" = {
|
|
|
|
|
matchConfig = {
|
|
|
|
|
Name = "vlan132";
|
|
|
|
|
};
|
|
|
|
|
address = [ "10.42.132.1/24" ];
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
links."20-vlan133" = {
|
|
|
|
|
matchConfig.MACAddress = "86:3c:c7:51:c4:82";
|
|
|
|
|
linkConfig.Name = "vlan133";
|
|
|
|
|
};
|
|
|
|
|
networks."20-vlan133" = {
|
|
|
|
|
matchConfig = {
|
|
|
|
|
Name = "vlan133";
|
|
|
|
|
};
|
|
|
|
|
address = [ "10.42.133.1/24" ];
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
services.kea.dhcp4 = {
|
|
|
|
|
settings = {
|
|
|
|
|
interfaces-config = {
|
|
|
|
|
interfaces = [ "vlan133" ];
|
|
|
|
|
};
|
|
|
|
|
subnet4 = [
|
|
|
|
|
{
|
|
|
|
|
id = 133;
|
|
|
|
|
subnet = "10.42.133.1/24";
|
|
|
|
|
pools = [
|
|
|
|
|
{
|
|
|
|
|
pool = "10.42.133.100 - 10.42.133.240";
|
|
|
|
|
}
|
|
|
|
|
];
|
|
|
|
|
option-data = [
|
|
|
|
|
{
|
|
|
|
|
name = "routers";
|
|
|
|
|
data = "10.42.133.1";
|
|
|
|
|
}
|
|
|
|
|
{
|
|
|
|
|
name = "domain-name-servers";
|
|
|
|
|
data = "10.42.10.8";
|
|
|
|
|
}
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
];
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2022-07-20 09:20:39 +02:00
|
|
|
|
networking.firewall.enable = false;
|
|
|
|
|
networking.nftables = {
|
|
|
|
|
enable = true;
|
|
|
|
|
ruleset = let
|
|
|
|
|
tcpPorts = lib.concatStringsSep ", " (map toString config.networking.firewall.allowedTCPPorts);
|
2022-07-24 17:42:43 +02:00
|
|
|
|
udpPorts = lib.concatStringsSep ", " (map toString config.networking.firewall.allowedUDPPorts);
|
2022-07-20 09:20:39 +02:00
|
|
|
|
in ''
|
|
|
|
|
table inet filter {
|
|
|
|
|
chain input {
|
|
|
|
|
type filter hook input priority 0; policy drop;
|
|
|
|
|
|
|
|
|
|
iifname lo accept
|
|
|
|
|
ct state {established, related} accept
|
|
|
|
|
|
|
|
|
|
ip6 nexthdr icmpv6 icmpv6 type { destination-unreachable, packet-too-big, time-exceeded, parameter-problem, nd-router-advert, nd-neighbor-solicit, nd-neighbor-advert } accept
|
|
|
|
|
ip protocol icmp icmp type { destination-unreachable, router-advertisement, time-exceeded, parameter-problem } accept
|
|
|
|
|
|
|
|
|
|
ip6 nexthdr icmpv6 icmpv6 type echo-request accept
|
|
|
|
|
ip protocol icmp icmp type echo-request accept
|
|
|
|
|
|
|
|
|
|
tcp dport 22 accept
|
|
|
|
|
tcp dport { ${tcpPorts} } accept
|
2022-07-24 17:42:43 +02:00
|
|
|
|
udp dport { ${udpPorts} } accept
|
2022-07-20 09:20:39 +02:00
|
|
|
|
|
|
|
|
|
iif {vlan132, vlan133} accept
|
|
|
|
|
|
2022-07-25 09:26:14 +02:00
|
|
|
|
ip saddr { 10.42.10.9 } accept
|
|
|
|
|
ip6 saddr { 2a01:4f8:1c0c:8221::9 } accept
|
2022-07-20 09:20:39 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
chain forward {
|
|
|
|
|
type filter hook forward priority 0; policy drop;
|
|
|
|
|
|
|
|
|
|
ct state {established, related} accept
|
|
|
|
|
iif {vlan132, vlan133} accept
|
|
|
|
|
|
|
|
|
|
ip6 nexthdr icmpv6 icmpv6 type { destination-unreachable, packet-too-big, time-exceeded, parameter-problem, nd-router-advert, nd-neighbor-solicit, nd-neighbor-advert } accept
|
|
|
|
|
ip protocol icmp icmp type { destination-unreachable, router-advertisement, time-exceeded, parameter-problem } accept
|
|
|
|
|
|
|
|
|
|
ip6 nexthdr icmpv6 icmpv6 type echo-request accept
|
|
|
|
|
ip protocol icmp icmp type echo-request accept
|
|
|
|
|
|
|
|
|
|
ip saddr 10.42.201.0/24 accept
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2022-07-16 21:32:14 +02:00
|
|
|
|
# This value determines the NixOS release from which the default
|
|
|
|
|
# settings for stateful data, like file locations and database versions
|
|
|
|
|
# on your system were taken. It‘s perfectly fine and recommended to leave
|
|
|
|
|
# this value at the release version of the first install of this system.
|
|
|
|
|
# Before changing this value read the documentation for this option
|
|
|
|
|
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
|
|
|
|
|
system.stateVersion = "22.05"; # Did you read the comment?
|
|
|
|
|
|
|
|
|
|
}
|