From 2be8ddd04ef400c1e9106626e7fcbc505e52ebc1 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Mon, 15 Nov 2021 11:25:58 +0059 Subject: vidhar: ... --- hosts/vidhar/default.nix | 54 ++++++++++++++++++++++++++++++++++++------------ hosts/vidhar/dsl.nix | 11 ---------- 2 files changed, 41 insertions(+), 24 deletions(-) diff --git a/hosts/vidhar/default.nix b/hosts/vidhar/default.nix index 7657c4a8..d9d44070 100644 --- a/hosts/vidhar/default.nix +++ b/hosts/vidhar/default.nix @@ -158,19 +158,47 @@ "eno2".networkConfig.LinkLocalAddressing = "no"; "telekom".networkConfig.LinkLocalAddressing = "no"; }; - services.dhcpd6 = { - enable = true; - configFile = pkgs.writeText "dhcpd6.conf" '' - interface dsl { - send ia-pd 0; - }; - - id-assoc pd 0 { - prefix-interface eno1 { - sla-id 0; - }; - }; - ''; + systemd.services."dhcpcd-telekom" = { + wantedBy = [ "multi-user.target" "network-online.target" ]; + bindsTo = [ "pppd-telekom.service" ]; + after = [ "pppd-telekom.service" ]; + wants = [ "network.target" ]; + before = [ "network-online.target" ]; + + path = with pkgs; [ dhcpcd nettools openresolv ]; + unitConfig.ConditionCapability = "CAP_NET_ADMIN"; + + stopIfChanged = false; + + serviceConfig = let + dhcpcdConf = pkgs.writeText "dhcpcd.conf" '' + duid + persistent + vendorclassid + + nooption domain_name_servers, domain_name, domain_search + option classless_static_routes + option interface_mtu + + option host_name + option rapid_commit + require dhcp_server_identifier + slaac private + + noipv6rs # disable routing solicitation + allowinterfaces dsl + interface dsl + ipv6rs # enable routing solicitation for WAN adapter + ia_na 1 # request an IPv6 address + ia_pd 1 eno1/0 # request a PD and assign it to the LAN + ''; + in { + Type = "forking"; + PIDFile = "/run/dhcpcd.pid"; + ExecStart = "@${pkgs.dhcpcd}/sbin/dhcpcd dhcpcd --config ${dhcpcdConf}"; + ExecReload = "${pkgs.dhcpcd}/sbin/dhcpcd --rebind"; + Restart = "always"; + }; }; services.timesyncd.enable = false; diff --git a/hosts/vidhar/dsl.nix b/hosts/vidhar/dsl.nix index 2316c888..1651284c 100644 --- a/hosts/vidhar/dsl.nix +++ b/hosts/vidhar/dsl.nix @@ -59,17 +59,6 @@ in { ''; mode = "0555"; }; - "ppp/ipv6-up" = { - text = '' - #!${pkgs.runtimeShell} - ${pkgs.procps}/bin/sysctl net/ipv6/conf/$1/use_tempaddr=1 - ${pkgs.procps}/bin/sysctl net/ipv6/conf/$1/forwarding=1 - ${pkgs.procps}/bin/sysctl net/ipv6/conf/$1/autoconf=1 - ${pkgs.procps}/bin/sysctl net/ipv6/conf/$1/accept_ra=1 - ${pkgs.ndisc6}/bin/rdisc6 $1 - ''; - mode = "0555"; - }; }; systemd.network.networks."dsl" = { -- cgit v1.2.3