diff options
| author | Gregor Kleen <gkleen@yggdrasil.li> | 2025-10-17 09:43:18 +0200 |
|---|---|---|
| committer | Gregor Kleen <gkleen@yggdrasil.li> | 2025-10-17 09:43:18 +0200 |
| commit | 1b8f24425c25de5d86fc0de7561ea3a7f7dad491 (patch) | |
| tree | a9a0c64d2a9a4cd85d9a05ac71653d40c6d89fea | |
| parent | 3ccc7c541b295d30936e8b6991458d27630b3522 (diff) | |
| download | nixos-1b8f24425c25de5d86fc0de7561ea3a7f7dad491.tar nixos-1b8f24425c25de5d86fc0de7561ea3a7f7dad491.tar.gz nixos-1b8f24425c25de5d86fc0de7561ea3a7f7dad491.tar.bz2 nixos-1b8f24425c25de5d86fc0de7561ea3a7f7dad491.tar.xz nixos-1b8f24425c25de5d86fc0de7561ea3a7f7dad491.zip | |
...
| -rw-r--r-- | hosts/vidhar/network/pppoe.nix | 72 |
1 files changed, 35 insertions, 37 deletions
diff --git a/hosts/vidhar/network/pppoe.nix b/hosts/vidhar/network/pppoe.nix index 381658dc..56c8f3b4 100644 --- a/hosts/vidhar/network/pppoe.nix +++ b/hosts/vidhar/network/pppoe.nix | |||
| @@ -43,6 +43,7 @@ in { | |||
| 43 | stopIfChanged = true; | 43 | stopIfChanged = true; |
| 44 | 44 | ||
| 45 | serviceConfig = { | 45 | serviceConfig = { |
| 46 | ExecStart = lib.mkForce "${getBin config.services.pppd.package}/sbin/pppd call telekom up_sdnotify nolog"; | ||
| 46 | PIDFile = "/run/pppd/${pppInterface}.pid"; | 47 | PIDFile = "/run/pppd/${pppInterface}.pid"; |
| 47 | }; | 48 | }; |
| 48 | restartTriggers = with config; [ | 49 | restartTriggers = with config; [ |
| @@ -53,46 +54,43 @@ in { | |||
| 53 | }; | 54 | }; |
| 54 | 55 | ||
| 55 | environment.etc = { | 56 | environment.etc = { |
| 56 | "ppp/ip-pre-up".source = let | 57 | "ppp/ip-pre-up".source = pkgs.resholve.writeScript "ip-pre-up" { |
| 57 | app = pkgs.writeShellApplication { | 58 | interpreter = pkgs.runtimeShell; |
| 58 | name = "ip-pre-up"; | 59 | inputs = [ pkgs.iproute2 pkgs.ethtool ]; |
| 59 | runtimeInputs = with pkgs; [ iproute2 ethtool ]; | 60 | execer = [ |
| 60 | text = '' | 61 | "cannot:${lib.getExe' pkgs.iproute2 "ip"}" |
| 61 | ethtool -K telekom tso off gso off gro off | 62 | "cannot:${lib.getExe' pkgs.iproute2 "tc"}" |
| 63 | ]; | ||
| 64 | } '' | ||
| 65 | ethtool -K telekom tso off gso off gro off | ||
| 62 | 66 | ||
| 63 | ip link del "ifb4${pppInterface}" || true | 67 | ip link del "ifb4${pppInterface}" || true |
| 64 | ip link add name "ifb4${pppInterface}" type ifb | 68 | ip link add name "ifb4${pppInterface}" type ifb |
| 65 | ip link set "ifb4${pppInterface}" up | 69 | ip link set "ifb4${pppInterface}" up |
| 66 | 70 | ||
| 67 | tc qdisc del dev "ifb4${pppInterface}" root || true | 71 | tc qdisc del dev "ifb4${pppInterface}" root || true |
| 68 | tc qdisc del dev "${pppInterface}" ingress || true | 72 | tc qdisc del dev "${pppInterface}" ingress || true |
| 69 | tc qdisc del dev "${pppInterface}" root || true | 73 | tc qdisc del dev "${pppInterface}" root || true |
| 70 | 74 | ||
| 71 | tc qdisc add dev "${pppInterface}" handle ffff: ingress | 75 | tc qdisc add dev "${pppInterface}" handle ffff: ingress |
| 72 | tc filter add dev "${pppInterface}" parent ffff: basic action ctinfo dscp 0x0000003f 0x00000040 action mirred egress redirect dev "ifb4${pppInterface}" | 76 | tc filter add dev "${pppInterface}" parent ffff: basic action ctinfo dscp 0x0000003f 0x00000040 action mirred egress redirect dev "ifb4${pppInterface}" |
| 73 | tc qdisc replace dev "ifb4${pppInterface}" root cake memlimit 128Mb overhead 35 mpu 74 regional diffserv4 bandwidth ${toString (builtins.floor (177968 * 0.95))}kbit | 77 | tc qdisc replace dev "ifb4${pppInterface}" root cake memlimit 128Mb overhead 35 mpu 74 regional diffserv4 bandwidth ${toString (builtins.floor (177968 * 0.95))}kbit |
| 74 | tc qdisc replace dev "${pppInterface}" root cake memlimit 128Mb overhead 35 mpu 74 regional nat diffserv4 wash bandwidth ${toString (builtins.floor (41216 * 0.95))}kbit | 78 | tc qdisc replace dev "${pppInterface}" root cake memlimit 128Mb overhead 35 mpu 74 regional nat diffserv4 wash bandwidth ${toString (builtins.floor (41216 * 0.95))}kbit |
| 75 | ''; | 79 | ''; |
| 76 | }; | 80 | "ppp/ip-up".source = pkgs.resholve.writeScript "ip-up" { |
| 77 | in "${app}/bin/${app.meta.mainProgram}"; | 81 | interpreter = pkgs.runtimeShell; |
| 78 | "ppp/ip-up".source = let | 82 | inputs = [ pkgs.iproute2 ]; |
| 79 | app = pkgs.writeShellApplication { | 83 | execer = [ "cannot:${lib.getExe' pkgs.iproute2 "ip"}" ]; |
| 80 | name = "ip-up"; | 84 | } '' |
| 81 | runtimeInputs = with pkgs; [ iproute2 ]; | 85 | ip route add default via "$5" dev "${pppInterface}" metric 512 |
| 82 | text = '' | 86 | ''; |
| 83 | ip route add default via "$5" dev "${pppInterface}" metric 512 | 87 | "ppp/ip-down".source = pkgs.resholve.writeScript "ip-down" { |
| 84 | ''; | 88 | interpreter = pkgs.runtimeShell; |
| 85 | }; | 89 | inputs = [ pkgs.iproute2 ]; |
| 86 | in "${app}/bin/${app.meta.mainProgram}"; | 90 | execer = [ "cannot:${lib.getExe' pkgs.iproute2 "ip"}" ]; |
| 87 | "ppp/ip-down".source = let | 91 | } '' |
| 88 | app = pkgs.writeShellApplication { | 92 | ip link del "ifb4${pppInterface}" |
| 89 | name = "ip-down"; | 93 | ''; |
| 90 | runtimeInputs = with pkgs; [ iproute2 ]; | ||
| 91 | text = '' | ||
| 92 | ip link del "ifb4${pppInterface}" | ||
| 93 | ''; | ||
| 94 | }; | ||
| 95 | in "${app}/bin/${app.meta.mainProgram}"; | ||
| 96 | }; | 94 | }; |
| 97 | 95 | ||
| 98 | systemd.network.networks.${pppInterface} = { | 96 | systemd.network.networks.${pppInterface} = { |
