-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfiguration.nix
More file actions
168 lines (162 loc) · 3.37 KB
/
configuration.nix
File metadata and controls
168 lines (162 loc) · 3.37 KB
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
{
config,
lib,
pkgs,
...
}:
let
wanIface = "enp3s0f0";
wan = {
ipv4 = {
gateway = "198.82.185.129";
address = "198.82.185.170";
cidr = 22;
};
ipv6 = {
gateway = "2001:468:c80:6119::1";
address = "2001:468:c80:6119:82c1:6eff:fe21:2b88";
cidr = 64;
};
tcpPorts = [
22
2222
];
udpPorts = [ 51820 ];
# Publicly routable IPv4 addresses only
exposeIpv4Hosts = [
# Alex's box
"198.82.185.174"
];
# Publicly routable IPv6 addresses only
exposeIpv6Hosts = [
# Alex's box
"2607:b400:6:ce83:225:90ff:fe9b:ed30"
];
};
wgIface = "wg0";
lanIface = "enp3s0f1";
lan = {
# Management
"10" = {
ipv4 = {
address = "10.98.4.1";
cidr = 24;
};
ipv6 = {
address = "2607:b400:6:ce80::1";
cidr = 64;
};
isolate = true;
allowRouterAccess = true;
domain = "mgmt";
dhcpv4 = "10.98.4.128,10.98.4.254,12h";
dhcpv6 = "ra-stateless,ra-names,12h";
};
# Untagged (native) VLAN Internal Traffic
"20" = {
ipv4 = {
address = "10.98.5.1";
cidr = 24;
};
ipv6 = {
address = "2607:b400:6:ce81::1";
cidr = 64;
};
isolate = false;
allowRouterAccess = true;
untagged = true;
domain = "internal";
dhcpv4 = "10.98.5.128,10.98.5.254,12h";
dhcpv6 = "ra-stateless,ra-names,12h";
};
# General Hosts
"30" = {
ipv4 = {
address = "10.98.6.1";
cidr = 24;
# IPv4 hosts for ARP proxy
publicHosts = [ ];
};
ipv6 = {
address = "2607:b400:6:ce82::1";
cidr = 64;
};
isolate = false;
allowRouterAccess = true;
domain = "g";
dhcpv4 = "10.98.6.128,10.98.6.254,12h";
dhcpv6 = "ra-stateless,ra-names,12h";
};
# Co-location
"40" = {
ipv4 = {
address = "10.98.7.1";
cidr = 24;
# IPv4 hosts for ARP proxy
publicHosts = [
# Alex's box
"198.82.185.174"
];
};
ipv6 = {
address = "2607:b400:6:ce83::1";
cidr = 64;
};
isolate = true;
allowRouterAccess = false;
domain = "colo";
dhcpv4 = "10.98.7.128,10.98.7.254,12h";
dhcpv6 = "ra-stateless,ra-names,12h";
};
};
checkUntagged = lib.asserts.assertMsg (
builtins.length (
builtins.filter (e: builtins.hasAttr "untagged" e.snd) (
lib.lists.zipLists (builtins.attrNames lan) (builtins.attrValues lan)
)
) == 1
) "There must be exactly one untagged VLAN for LAN" lan;
in
{
imports = [
./hardware-configuration.nix
../common/nix.nix
../common/sshd.nix
../common/users-local.nix
../common/tz-locale.nix
./router.nix
(import ./lan.nix {
inherit lib lanIface lan;
})
(import ./dhcp.nix {
inherit lib lanIface lan;
})
(import ./wan.nix {
inherit wanIface wan;
})
(import ./firewall.nix {
inherit
lib
lanIface
lan
wanIface
wan
wgIface
;
})
(import ./wireguard.nix {
inherit config wgIface;
})
];
environment.systemPackages = with pkgs; [
neovim
helix
mtr
dig
tcpdump
ndisc6
inetutils
];
networking.hostName = "zerocool";
system.stateVersion = "25.05";
}