summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2023-03-06 10:53:12 +0100
committerGregor Kleen <gkleen@yggdrasil.li>2023-03-06 10:53:12 +0100
commit43bc14032d39a06f04d302977aa72558ee5a91e6 (patch)
tree649a412980736274c02abe71bf0031f55bc3bb0c
parent3206ce36cb1232e176715973c9bd443fd462b54b (diff)
downloadnixos-43bc14032d39a06f04d302977aa72558ee5a91e6.tar
nixos-43bc14032d39a06f04d302977aa72558ee5a91e6.tar.gz
nixos-43bc14032d39a06f04d302977aa72558ee5a91e6.tar.bz2
nixos-43bc14032d39a06f04d302977aa72558ee5a91e6.tar.xz
nixos-43bc14032d39a06f04d302977aa72558ee5a91e6.zip
vidhar: cake
-rw-r--r--hosts/vidhar/network/dsl.nix45
1 files changed, 38 insertions, 7 deletions
diff --git a/hosts/vidhar/network/dsl.nix b/hosts/vidhar/network/dsl.nix
index 5b7c5ac7..7a1dab58 100644
--- a/hosts/vidhar/network/dsl.nix
+++ b/hosts/vidhar/network/dsl.nix
@@ -59,13 +59,44 @@ in {
59 }; 59 };
60 60
61 environment.etc = { 61 environment.etc = {
62 "ppp/ip-up" = { 62 "ppp/ip-pre-up".source = let
63 text = '' 63 app = pkgs.writeShellApplication {
64 #!${pkgs.runtimeShell} 64 name = "ip-pre-up";
65 ${pkgs.iproute2}/bin/ip route add default via "$5" dev "${pppInterface}" metric 512 65 runtimeInputs = with pkgs; [ iproute2 ethtool ];
66 ''; 66 text = ''
67 mode = "0555"; 67 ethtool -K telekom tso off gso off gro off
68 }; 68
69 tc qdisc replace dev "${pppInterface}" root cake pppoe-ptm nat bandwidth 35mbit
70
71 modprobe ifb
72 ip link del "ifb4${pppInterface}" || true
73 ip link add name "ifb4${pppInterface}" type ifb
74 tc qdisc del dev "${pppInterface}" ingress || true
75 tc qdisc add dev "${pppInterface}" handle ffff: ingress
76 tc qdisc replace dev "ifb4${pppInterface}" root cake pppoe-ptm bandwidth 93mbit
77 ip link set "ifb4${pppInterface}" up
78 tc filter add dev "${pppInterface}" parent ffff: matchall action mirred egress redirect dev "ifb4${pppInterface}"
79 '';
80 };
81 in "${app}/bin/${app.meta.mainProgram}";
82 "ppp/ip-up".source = let
83 app = pkgs.writeShellApplication {
84 name = "ip-up";
85 runtimeInputs = with pkgs; [ iproute2 ];
86 text = ''
87 ip route add default via "$5" dev "${pppInterface}" metric 512
88 '';
89 };
90 in "${app}/bin/${app.meta.mainProgram}";
91 "ppp/ip-down".source = let
92 app = pkgs.writeShellApplication {
93 name = "ip-down";
94 runtimeInputs = with pkgs; [ iproute2 ];
95 text = ''
96 ip link del "ifb4${pppInterface}"
97 '';
98 };
99 in "${app}/bin/${app.meta.mainProgram}";
69 }; 100 };
70 101
71 systemd.network.networks.${pppInterface} = { 102 systemd.network.networks.${pppInterface} = {