public-cof: Switch to systemd-network
This commit is contained in:
parent
f410aa4c75
commit
bd22c63ec4
1 changed files with 25 additions and 32 deletions
|
@ -1,44 +1,37 @@
|
|||
{ lib, ... }:
|
||||
let mkAddress = addr: let
|
||||
splitted = lib.splitString "/" addr;
|
||||
elemAt = builtins.elemAt splitted;
|
||||
in
|
||||
{ address = (elemAt 0); prefixLength = lib.toInt (elemAt 1); };
|
||||
in {
|
||||
|
||||
{
|
||||
networking = {
|
||||
hostName = "public-cof";
|
||||
|
||||
# Default IPv4 exit route
|
||||
defaultGateway = {
|
||||
address = "";
|
||||
interface = "ens20";
|
||||
};
|
||||
localCommands = "ip route add default dev ens20 metric 10";
|
||||
useNetworkd = true;
|
||||
|
||||
useDHCP = false;
|
||||
interfaces.ens18 = {
|
||||
useDHCP = true;
|
||||
ipv6.addresses = [{
|
||||
address = "2001:470:1f13:187:c08e:feff:fe4d:f5f5";
|
||||
prefixLength = 64;
|
||||
}];
|
||||
};
|
||||
interfaces.ens19 = {
|
||||
useDHCP = false;
|
||||
ipv4.addresses = [{
|
||||
address = "10.1.1.21";
|
||||
prefixLength = 22;
|
||||
}];
|
||||
firewall = { enable = true; allowedTCPPorts = [ 22 ]; };
|
||||
};
|
||||
|
||||
systemd.network.networks = {
|
||||
"10-ens18" = {
|
||||
name = "ens18";
|
||||
address = [ "2001:470:1f13:187:c08e:feff:fe4d:f5f5/64" ];
|
||||
|
||||
DHCP = "ipv4";
|
||||
|
||||
dhcpV4Config.RouteMetric = 10;
|
||||
};
|
||||
|
||||
interfaces.ens20 = {
|
||||
# 1st is for public-cof
|
||||
# 2nd is for IPv4 → IPv6 proxy in v6proxy/
|
||||
ipv4.addresses = map mkAddress [ "45.13.104.27/32" "45.13.104.29/32" ];
|
||||
"10-ens19" = {
|
||||
name = "ens19";
|
||||
address = [ "10.1.1.21/22" ];
|
||||
|
||||
DHCP = "ipv4";
|
||||
};
|
||||
|
||||
firewall.allowedTCPPorts = [ 22 ];
|
||||
firewall.enable = true;
|
||||
"10-ens20" = {
|
||||
name = "ens20";
|
||||
address = [ "45.13.104.27/32" "45.13.104.29/32" ];
|
||||
|
||||
DHCP = "ipv4";
|
||||
};
|
||||
};
|
||||
|
||||
services.nginx.defaultListenAddresses = [ "[::0]" "45.13.104.27" ];
|
||||
|
|
Loading…
Reference in a new issue