aboutsummaryrefslogtreecommitdiff
path: root/nixos/machine/adm-omnia.nix
blob: 088481f4fb01decd2c5ce2586098d0936744c962 (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
88
{
  config,
  lib,
  pkgs,
  ...
}:
with lib; {
  config = {
    cynerd = {
      router = {
        enable = true;
        wan = "pppoe-wan";
        lanIP = config.cynerd.hosts.adm.omnia;
      };
      wifiAP.adm = {
        enable = true;
        ar9287.interface = "wlp3s0";
        qca988x.interface = "wlp2s0";
      };
      openvpn.oldpersonal = false;
      monitoring.speedtest = true;
    };

    networking.useDHCP = false;
    systemd.network = {
      networks = {
        "end2" = {
          matchConfig.Name = "end2";
          #networkConfig = {
          #  DHCP = "ipv6";
          #  IPv6AcceptRA = "yes";
          #  DHCPPrefixDelegation = "yes";
          #};
          #dhcpPrefixDelegationConfig = {
          #  UplinkInterface = ":self";
          #  SubnetId = 0;
          #  Announce = "no";
          #};
          linkConfig.RequiredForOnline = "routable";
        };
        "lan-brlan" = {
          matchConfig.Name = "lan[1-4]";
          networkConfig.Bridge = "brlan";
          bridgeVLANs = [
            {
              bridgeVLANConfig = {
                EgressUntagged = 1;
                PVID = 1;
              };
            }
            {bridgeVLANConfig.VLAN = 2;}
          ];
        };
        "lan0-guest" = {
          matchConfig.Name = "lan0";
          networkConfig.Bridge = "brlan";
          bridgeVLANs = [
            {
              bridgeVLANConfig = {
                EgressUntagged = 2;
                PVID = 2;
              };
            }
          ];
        };
      };
    };

    services.pppd = {
      enable = true;
      peers."wan".config = ''
        plugin pppoe.so end2
        ifname pppoe-wan
        lcp-echo-interval 1
        lcp-echo-failure 5
        lcp-echo-adaptive
        +ipv6
        defaultroute
        defaultroute6
        usepeerdns
        maxfail 1
        user O2
        password 02
      '';
    };
    systemd.services."pppd-wan".after = ["sys-subsystem-net-devices-end2.device"];
  };
}