summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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} = {