blob: 2316c8885e3759b16048f60fb59ab3ae67bb2cf6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
{ config, lib, pkgs, ... }:
with lib;
let
pppInterface = config.networking.pppInterface;
in {
options = {
networking.pppInterface = mkOption {
type = types.str;
default = "dsl";
};
};
config = {
networking.vlans = {
telekom = {
id = 7;
interface = "eno2";
};
};
services.pppd = {
enable = true;
peers.telekom.config = ''
nodefaultroute
ifname ${pppInterface}
lcp-echo-failure 1
lcp-echo-interval 1
maxfail 0
mtu 1492
mru 1492
plugin rp-pppoe.so
name telekom
user 002576900250551137425220#0001@t-online.de
telekom
debug
'';
};
systemd.services."pppd-telekom".serviceConfig = lib.mkForce {
ExecStart = "${lib.getBin pkgs.ppp}/sbin/pppd call telekom nodetach nolog +ipv6";
Restart = "always";
RestartSec = 5;
RuntimeDirectory = "pppd";
RuntimeDirectoryPreserve = true;
};
sops.secrets."pap-secrets" = {
format = "binary";
sopsFile = ./pap-secrets;
path = "/etc/ppp/pap-secrets";
};
environment.etc = {
"ppp/ip-up" = {
text = ''
#!${pkgs.runtimeShell}
${pkgs.iproute}/bin/ip route add default via "$5" dev "${pppInterface}" metric 512
'';
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" = {
matchConfig = {
Name = "dsl";
};
networkConfig = {
LinkLocalAddressing = "no";
DNS = [
"1.1.1.1" "1.0.0.1"
];
};
};
};
}
|