summaryrefslogtreecommitdiff
path: root/hosts
diff options
context:
space:
mode:
authorsinanmohd <sinan@sinanmohd.com>2024-01-29 21:16:25 +0530
committersinanmohd <sinan@sinanmohd.com>2024-01-29 21:25:19 +0530
commitd46fc4ccde65755a4faff6fe0a59d74dca4956e5 (patch)
tree843403923cbf5dc0c8426d667e8174602ee3ab42 /hosts
parent26dec78b3169960b2daa8d324ef7af47100337e4 (diff)
kay/network/he: add routed prefixes
Diffstat (limited to 'hosts')
-rw-r--r--hosts/kay/modules/hurricane.nix46
1 files changed, 34 insertions, 12 deletions
diff --git a/hosts/kay/modules/hurricane.nix b/hosts/kay/modules/hurricane.nix
index 7988c63..1e44e2d 100644
--- a/hosts/kay/modules/hurricane.nix
+++ b/hosts/kay/modules/hurricane.nix
@@ -3,10 +3,14 @@
let
iface = "hurricane";
remote = "216.218.221.42";
- address = "2001:470:35:72a::2";
- gateway = "2001:470:35:72a::1";
- prefixLength = 64;
- prefix = "2001:470:35:72a::/${toString prefixLength}";
+
+ clinet = "2001:470:35:72a::2";
+ server = "2001:470:35:72a::1";
+
+ addr1 = "2001:470:36:72a::";
+ prefix1 = 64;
+ addr2 = "2001:470:ee65::";
+ prefix2 = 48;
in
{
networking = {
@@ -16,8 +20,20 @@ in
};
interfaces.${iface} = {
mtu = 1440; # 1460(ppp0) - 20
- ipv6.addresses =
- [{ inherit prefixLength address; }];
+ ipv6.addresses = [
+ {
+ address = clinet;
+ prefixLength = 64;
+ }
+ {
+ address = "${addr1}1";
+ prefixLength = prefix1;
+ }
+ {
+ address = "${addr2}1";
+ prefixLength = prefix2;
+ }
+ ];
};
iproute2 = {
@@ -55,16 +71,22 @@ in
path = [ pkgs.iproute2 ];
script = ''
- echo -n "adding route ${prefix}... "
+ echo -n "adding route"
- ip -6 rule add from ${prefix} table hurricane || exit 1
- ip -6 route add default via ${gateway} dev hurricane table hurricane || exit 1
+ ip -6 rule add from ${clinet}/64 table hurricane || exit 1
+ ip -6 rule add from ${addr1}/${toString prefix1} table hurricane || exit 1
+ ip -6 rule add from ${addr2}/${toString prefix2} table hurricane || exit 1
+
+ ip -6 route add default via ${server} dev hurricane table hurricane || exit 1
'';
preStop = ''
- echo -n "deleting route $prefix... "
+ echo -n "deleting route"
+
+ ip -6 route del default via ${server} dev hurricane table hurricane || exit 1
- ip -6 route del default via ${gateway} dev hurricane table hurricane || exit 1
- ip -6 rule del from ${prefix} table hurricane || exit 1
+ ip -6 rule del from ${addr2}/${toString prefix2} table hurricane || exit 1
+ ip -6 rule del from ${addr1}/${toString prefix1} table hurricane || exit 1
+ ip -6 rule del from ${clinet}/64 table hurricane || exit 1
'';
};