forked from M-Labs/it-infra
nixbld: add backup internet connection
This commit is contained in:
parent
60aacb6a1b
commit
5729c4998a
|
@ -6,6 +6,7 @@
|
|||
|
||||
let
|
||||
netifWan = "enp4s0";
|
||||
netifWanBackup = "enp11s0";
|
||||
netifLan = "enp5s0f1";
|
||||
netifWifi = "wlp6s0";
|
||||
netifSit = "henet0";
|
||||
|
@ -94,7 +95,22 @@ in
|
|||
allowedUDPPorts = [ 53 67 500 4500 ];
|
||||
trustedInterfaces = [ netifLan ];
|
||||
};
|
||||
interfaces."${netifWan}".useDHCP = true;
|
||||
useDHCP = false;
|
||||
interfaces."${netifWan}".useDHCP = true; # PCCW - always wants active DHCP lease or cuts you off
|
||||
interfaces."${netifWanBackup}" = { # HKBN - no DHCP with static IP service
|
||||
ipv4.addresses = [{
|
||||
address = "202.77.7.238";
|
||||
prefixLength = 30;
|
||||
}];
|
||||
ipv4.routes = [
|
||||
{
|
||||
address = "0.0.0.0";
|
||||
prefixLength = 0;
|
||||
via = "202.77.7.237";
|
||||
options.table = "2";
|
||||
}
|
||||
];
|
||||
};
|
||||
interfaces."${netifLan}" = {
|
||||
ipv4.addresses = [{
|
||||
address = "192.168.1.1";
|
||||
|
@ -112,6 +128,11 @@ in
|
|||
prefixLength = 24;
|
||||
options.table = "1";
|
||||
}
|
||||
{
|
||||
address = "192.168.1.0";
|
||||
prefixLength = 24;
|
||||
options.table = "2";
|
||||
}
|
||||
];
|
||||
};
|
||||
interfaces."${netifWifi}" = {
|
||||
|
@ -243,7 +264,16 @@ in
|
|||
};
|
||||
};
|
||||
|
||||
systemd.services.custom-network-setup = {
|
||||
systemd.services.network-custom-route-backup = {
|
||||
wantedBy = [ "network.target" ];
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
RemainAfterExit = true;
|
||||
ExecStart = "${pkgs.iproute2}/bin/ip rule add from 202.77.7.238/30 table 2";
|
||||
ExecStop = "${pkgs.iproute2}/bin/ip rule del table 2";
|
||||
};
|
||||
};
|
||||
systemd.services.network-custom-route-alt = {
|
||||
wantedBy = [ "network.target" ];
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
|
|
Loading…
Reference in New Issue