summaryrefslogtreecommitdiff
path: root/hosts/vidhar/network/default.nix
blob: 5822e74634f13370ec223b3906c44791c1d3fbb9 (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
{ pkgs, ... }:
{
  imports = [ ./dsl.nix ./bifrost ./dhcp ];

  config = {
    networking = {
      hostName = "vidhar";
      domain = "yggdrasil";
      search = [ "yggdrasil" ];

      useDHCP = false;
      useNetworkd = true;

      interfaces."lan" = {
        ipv4.addresses = [
          { address = "10.141.0.1"; prefixLength = 24; }
        ];
      };
      interfaces."mgmt" = {
        ipv4.addresses = [
          { address = "10.141.1.1"; prefixLength = 24; }
        ];
      };
      interfaces."dmz01" = {
        ipv4.addresses = [
          { address = "10.141.2.1"; prefixLength = 24; }
        ];
      };

      vlans = {
        mgmt = {
          id = 2;
          interface = "eno2";
        };
        lan = {
          id = 3;
          interface = "eno2";
        };
        dmz01 = {
          id = 4;
          interface = "eno2";
        };
      };

      firewall.enable = false;
      nftables = {
        enable = true;
        rulesetFile = ./ruleset.nft;
      };
    };

    services.resolved = {
      llmnr = "false";
    };

    systemd.services."systemd-networkd-wait-online".enable = false;

    environment.etc."dnssec-trust-anchors.d/root.key".source = "${pkgs.dns-root-data}/root.key";

    systemd.network.networks = {
      "eno1" = {
        matchConfig.Name = "eno1";
        linkConfig = {
          ActivationPolicy = "down";
        };
      };
      "eno2" = {
        matchConfig.Name = "eno2";
        networkConfig.LinkLocalAddressing = "no";
      };
    };
  };
}