Include carbon to OSPF network
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
{ config, pkgs, ... }:
|
||||
{ config, pkgs, lib, ... }:
|
||||
|
||||
{
|
||||
imports =
|
||||
@@ -22,29 +22,104 @@
|
||||
networking.hostName = "carbon";
|
||||
|
||||
networking.useDHCP = false;
|
||||
# Local Router IPs
|
||||
networking.interfaces.lo.ipv6.addresses = [
|
||||
{ address = "fd00:152:152:104::1"; prefixLength = 64; }
|
||||
{ address = "fd00:152:152::1"; prefixLength = 128; } # Anycast
|
||||
];
|
||||
networking.interfaces.lo.ipv4.addresses = [
|
||||
{ address = "10.152.104.1"; prefixLength = 24; }
|
||||
{ address = "10.152.0.1"; prefixLength = 32; } # Anycast
|
||||
];
|
||||
# Network
|
||||
networking.interfaces.enp1s0.useDHCP = true;
|
||||
|
||||
networking.wireguard.enable = true;
|
||||
networking.wireguard.interfaces = {
|
||||
wg-gatekeeper = {
|
||||
ips = [
|
||||
"10.20.30.104/24"
|
||||
"2a01:4f8:c0c:15f1::8104/113"
|
||||
];
|
||||
wg-porter = {
|
||||
ips = [ "fe80::138:2/64" "169.254.138.2/24" ];
|
||||
peers = [ {
|
||||
allowedIPs = [ "0.0.0.0/0" "::/0" ];
|
||||
endpoint = "porter.net.clerie.de:50138";
|
||||
publicKey = "aP6optNE7nVk6coo+USkSDtB62rAc/isfofRML9V2HM=";
|
||||
persistentKeepalive = 25;
|
||||
} ];
|
||||
allowedIPsAsRoutes = false;
|
||||
peers = [
|
||||
{
|
||||
allowedIPs = [
|
||||
"0.0.0.0/0"
|
||||
"::/0"
|
||||
];
|
||||
endpoint = "gatekeeper.net.clerie.de:51820";
|
||||
publicKey = "2p1Jqs3bkXbXHFWE6vp1yxHIFoUaZQEARS2nJzbkuBA=";
|
||||
}
|
||||
];
|
||||
privateKeyFile = "/var/src/secrets/wireguard/wg-gatekeeper";
|
||||
privateKeyFile = "/var/src/secrets/wireguard/wg-porter";
|
||||
};
|
||||
};
|
||||
|
||||
services.bird2.enable = true;
|
||||
services.bird2.config = ''
|
||||
router id ${ (lib.head config.networking.interfaces.lo.ipv4.addresses).address };
|
||||
|
||||
ipv6 table ospf6;
|
||||
ipv4 table ospf4;
|
||||
|
||||
protocol direct {
|
||||
interface "lo";
|
||||
ipv6 {
|
||||
table ospf6;
|
||||
};
|
||||
ipv4 {
|
||||
table ospf4;
|
||||
};
|
||||
}
|
||||
|
||||
protocol kernel kernel_6 {
|
||||
ipv6 {
|
||||
table ospf6;
|
||||
export filter {
|
||||
krt_prefsrc=${ (lib.head config.networking.interfaces.lo.ipv6.addresses).address };
|
||||
accept;
|
||||
};
|
||||
import none;
|
||||
};
|
||||
}
|
||||
|
||||
protocol kernel kernel_4 {
|
||||
ipv4 {
|
||||
table ospf4;
|
||||
export filter {
|
||||
krt_prefsrc=${ (lib.head config.networking.interfaces.lo.ipv4.addresses).address };
|
||||
accept;
|
||||
};
|
||||
import none;
|
||||
};
|
||||
}
|
||||
|
||||
protocol ospf v3 ospf_6 {
|
||||
ipv6 {
|
||||
table ospf6;
|
||||
import all;
|
||||
export all;
|
||||
};
|
||||
area 0 {
|
||||
interface "wg-porter" {
|
||||
cost 80;
|
||||
type pointopoint;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
protocol ospf v3 ospf_4 {
|
||||
ipv4 {
|
||||
table ospf4;
|
||||
import all;
|
||||
export all;
|
||||
};
|
||||
area 0 {
|
||||
interface "wg-porter" {
|
||||
cost 80;
|
||||
type pointopoint;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
protocol device {
|
||||
scan time 10;
|
||||
}
|
||||
'';
|
||||
|
||||
system.stateVersion = "21.03";
|
||||
}
|
||||
|
Reference in New Issue
Block a user