1
0

Add host dn42-ildix-clerie

This commit is contained in:
clerie 2020-12-14 19:11:20 +01:00
parent 832ad41743
commit dcc370c9e7
2 changed files with 144 additions and 0 deletions

View File

@ -0,0 +1,121 @@
{ config, pkgs, lib, ... }:
{
imports =
[
./hardware-configuration.nix
../../configuration/common
../../configuration/proxmox-vm
];
boot.loader.grub.enable = true;
boot.loader.grub.version = 2;
boot.loader.grub.device = "/dev/vda";
networking.hostName = "dn42-ildix-clerie";
networking.useDHCP = false;
# VM Nat Netz mercury
networking.interfaces.ens18.ipv4.addresses = [ { address = "192.168.10.27"; prefixLength = 24; } ];
# Ildix
networking.interfaces.ens19.ipv6.addresses = [ { address = "fd81:edb3:71d8:ffff::13"; prefixLength = 64; } ];
# Route to dn42-ildix-service
networking.interfaces.ens19.ipv6.routes = [ { address = "fd81:edb3:71d8::"; prefixLength = 48; via = "fd81:edb3:71d8:ffff:2953::1"; } ];
networking.defaultGateway = { address = "192.168.10.1"; interface = "ens18"; };
networking.nameservers = [ "2001:638:904:ffcc::3" "2001:638:904:ffcc::4" "141.24.40.3" "141.24.40.4" ];
# Open Firewall for BGP
networking.firewall.allowedTCPPorts = [ 179 ];
# Open Fireall for OSPF
networking.firewall.extraCommands = ''
ip6tables -A INPUT -p ospfigp -j ACCEPT
iptables -A INPUT -p ospfigp -j ACCEPT
'';
services.bird2.enable = true;
services.bird2.config = ''
router id ${ (lib.head config.networking.interfaces.ens18.ipv4.addresses).address };
protocol direct {
interface "ens19";
ipv6 {
table master6;
};
}
filter import_dn42 {
if net ~ [fd81:edb3:71d8::/48{48,128}] then reject;
if net ~ [fd00::/8{8,64}] then accept;
reject;
}
filter export_dn42 {
if net ~ [fd81:edb3:71d8:ffff::/64{64,128}] then reject;
if net ~ [fd00::/8{8,64}] then accept;
reject;
}
template bgp bgp_peer {
local as 4242422953;
graceful restart on;
rs client;
source address fd81:edb3:71d8:ffff::13;
ipv6 {
table master6;
next hop keep;
import keep filtered;
import filter import_dn42;
export filter export_dn42;
};
}
protocol bgp peer_3012_dn42_c_1 from bgp_peer {
neighbor fd81:edb3:71d8:ffff:3012::2 as 4242423012;
}
protocol bgp peer_3012_dn42_c_2 from bgp_peer {
neighbor fd81:edb3:71d8:ffff:3012::3 as 4242423012;
}
protocol bgp peer_2574_dn42_il_gw5 from bgp_peer {
neighbor fd81:edb3:71d8:ffff:2574::5 as 4242422574;
}
protocol bgp peer_2574_dn42_il_gw6 from bgp_peer {
neighbor fd81:edb3:71d8:ffff:2574::6 as 4242422574;
}
protocol bgp peer_3929_v0tti_dn42 from bgp_peer {
neighbor fd81:edb3:71d8:ffff:3929::1 as 4242423929;
}
# Internal
protocol bgp peer_2953_dn42_ildix_service {
local as 4242422953;
graceful restart on;
neighbor fd81:edb3:71d8:ffff:2953::1 as 4242422953;
source address fd81:edb3:71d8:ffff::13;
ipv6 {
table master6;
next hop keep;
import keep filtered;
import filter {
if net ~ [fd81:edb3:71d8::/48{48,128}] then bgp_path.prepend(4242422953);
if net ~ [fd81:edb3:71d8::/48{48,64}] then accept;
reject;
};
export filter {
if net ~ [fd00::/8{8,64}] then accept;
reject;
};
};
}
protocol device {
scan time 10;
}
'';
system.stateVersion = "21.03";
}

View File

@ -0,0 +1,23 @@
# Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{
imports =
[ (modulesPath + "/profiles/qemu-guest.nix")
];
boot.initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "virtio_pci" "sr_mod" "virtio_blk" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/95b1b405-5aa4-4ce8-9563-b8308b3ce129";
fsType = "ext4";
};
swapDevices = [ ];
}