1
0
nixfiles/hosts/dn42-il-gw6/configuration.nix

200 lines
4.9 KiB
Nix
Raw Permalink Normal View History

2020-12-09 22:55:56 +01:00
{ config, pkgs, lib, ... }:
{
imports =
[
./hardware-configuration.nix
../../configuration/proxmox-vm
../../configuration/dn42
];
boot.loader.grub.enable = true;
boot.loader.grub.device = "/dev/vda";
networking.hostName = "dn42-il-gw6";
networking.useDHCP = false;
2020-12-10 12:59:30 +01:00
networking.interfaces.lo.ipv6.addresses = [ { address = "fd56:4902:eca0:6::1"; prefixLength = 64; } ];
2020-12-09 22:55:56 +01:00
# IPv6 Uplink
2020-12-09 23:07:22 +01:00
networking.interfaces.ens18.ipv6.addresses = [ { address = "2001:638:904:ffc9::9"; prefixLength = 64; } ];
2020-12-09 22:55:56 +01:00
# Ildix
2020-12-09 23:07:22 +01:00
networking.interfaces.ens19.ipv6.addresses = [ { address = "fd81:edb3:71d8:ffff:2574::6"; prefixLength = 64; } ];
2020-12-09 22:55:56 +01:00
# VM Nat Netz mercury
2020-12-09 23:07:22 +01:00
networking.interfaces.ens20.ipv4.addresses = [ { address = "192.168.10.26"; prefixLength = 24; } ];
2020-12-10 13:06:43 +01:00
# OSPF Netz
2020-12-09 23:07:22 +01:00
networking.interfaces.ens21 = {};
2020-12-09 22:55:56 +01:00
2020-12-09 23:12:47 +01:00
networking.defaultGateway = { address = "192.168.10.1"; interface = "ens20"; };
networking.defaultGateway6 = { address = "2001:638:904:ffc9::1"; interface = "ens18"; };
2020-12-09 22:55:56 +01:00
networking.nameservers = [ "2001:638:904:ffcc::3" "2001:638:904:ffcc::4" "141.24.40.3" "141.24.40.4" ];
petabyte.policyrouting = {
enable = true;
rules6 = [
{ rule = "from all to fd56:4902:eca0::/48 lookup 1337"; prio = 10000; }
{ rule = "from all to all lookup 2342"; prio = 10000; }
{ rule = "from all to fd56:4902:eca0::/48 unreachable"; prio = 20000; }
{ rule = "from fd56:4902:eca0::/48 to all unreachable"; prio = 20000; }
];
};
services.bird2.enable = true;
services.bird2.config = ''
2020-12-09 23:12:47 +01:00
router id ${ (lib.head config.networking.interfaces.ens20.ipv4.addresses).address };
2020-12-09 22:55:56 +01:00
ipv6 table ospf6;
ipv6 table bgp6;
2020-12-10 13:02:01 +01:00
protocol direct {
interface "lo";
ipv6 {
table ospf6;
};
}
2020-12-09 22:55:56 +01:00
protocol static {
ipv6 {
table bgp6;
};
#route fd56:4902:eca0::/48 via "lo";
#route fd56:4902:eca0::/52 via "lo";
2020-12-09 22:55:56 +01:00
}
protocol kernel {
ipv6 {
table ospf6;
export filter {
krt_prefsrc=fd56:4902:eca0:6::1;
accept;
};
import none;
};
kernel table 1337;
}
protocol kernel {
ipv6 {
table bgp6;
export filter {
krt_prefsrc=fd56:4902:eca0:6::1;
accept;
};
import none;
};
kernel table 2342;
}
protocol ospf v3 {
ipv6 {
table ospf6;
import all;
export all;
};
area 0 {
2020-12-09 23:12:47 +01:00
interface "ens21" {
2020-12-09 22:55:56 +01:00
cost 80;
2020-12-10 13:06:43 +01:00
type broadcast;
2020-12-09 22:55:56 +01:00
};
};
}
protocol bgp gw1 {
local as 4242422574;
graceful restart on;
neighbor fd56:4902:eca0:1::1 as 4242422574;
source address fd56:4902:eca0:6::1;
ipv6 {
table bgp6;
igp table ospf6;
next hop self;
import keep filtered;
import all;
export all;
};
}
protocol bgp gw5 {
local as 4242422574;
graceful restart on;
neighbor fd56:4902:eca0:5::1 as 4242422574;
source address fd56:4902:eca0:6::1;
ipv6 {
table bgp6;
igp table ospf6;
next hop self;
import keep filtered;
import all;
export all;
};
}
template bgp ildix {
local as 4242422574;
graceful restart on;
source address fd81:edb3:71d8:ffff:2574::6;
ipv6 {
table bgp6;
igp table ospf6;
next hop self;
import keep filtered;
import filter {
if net ~ [fd00::/8{8,64}] then accept;
reject;
};
export filter {
if net ~ [fd00::/8{8,64}] then accept;
reject;
};
};
}
protocol bgp peer_ildix_clerie from ildix {
neighbor fd81:edb3:71d8:ffff::13 as 4242422953;
}
protocol bgp peer_ildix_nex from ildix {
neighbor fd81:edb3:71d8:ffff::14 as 4242422953;
2020-12-09 22:55:56 +01:00
}
# Internal
protocol bgp peer_2953_dn42_ildix_service {
local as 4242422574;
neighbor fd81:edb3:71d8:ffff:2953::1 port 1179 as 4242422953;
source address fd81:edb3:71d8:ffff:2574::6;
multihop 64;
ipv6 {
table bgp6;
igp table ospf6;
next hop keep;
add paths tx;
import filter {
reject;
};
export filter {
accept;
};
};
}
2020-12-09 22:55:56 +01:00
protocol device {
scan time 10;
}
'';
clerie.system-auto-upgrade = {
allowReboot = true;
autoUpgrade = true;
startAt = "*-*-* 07:22:00";
};
2021-02-25 17:18:00 +01:00
clerie.monitoring = {
enable = true;
id = "306";
pubkey = "5+/S3Fj0HknkKgUTgtmDhS7MoHZ2Ygsi/+eij+Gnf34=";
2022-03-22 12:16:28 +01:00
bird = true;
2021-02-25 17:18:00 +01:00
};
2020-12-09 22:55:56 +01:00
system.stateVersion = "21.03";
}