diff options
Diffstat (limited to 'hosts/vidhar/network.nix')
-rw-r--r-- | hosts/vidhar/network.nix | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/hosts/vidhar/network.nix b/hosts/vidhar/network.nix new file mode 100644 index 00000000..a32dd2f8 --- /dev/null +++ b/hosts/vidhar/network.nix | |||
@@ -0,0 +1,83 @@ | |||
1 | { config, lib, pkgs, ... }: | ||
2 | { | ||
3 | imports = [ ./dsl.nix ]; | ||
4 | |||
5 | config = { | ||
6 | networking = { | ||
7 | hostName = "vidhar"; | ||
8 | domain = "yggdrasil"; | ||
9 | search = [ "yggdrasil" ]; | ||
10 | |||
11 | useDHCP = false; | ||
12 | useNetworkd = true; | ||
13 | |||
14 | interfaces."lan" = { | ||
15 | ipv4.addresses = [ | ||
16 | { address = "10.141.0.1"; prefixLength = 24; } | ||
17 | ]; | ||
18 | }; | ||
19 | interfaces."mgmt" = { | ||
20 | ipv4.addresses = [ | ||
21 | { address = "10.141.1.1"; prefixLength = 24; } | ||
22 | ]; | ||
23 | }; | ||
24 | |||
25 | vlans = { | ||
26 | mgmt = { | ||
27 | id = 2; | ||
28 | interface = "eno2"; | ||
29 | }; | ||
30 | lan = { | ||
31 | id = 3; | ||
32 | interface = "eno2"; | ||
33 | }; | ||
34 | }; | ||
35 | |||
36 | firewall.enable = false; | ||
37 | nftables = { | ||
38 | enable = true; | ||
39 | rulesetFile = ./ruleset.nft; | ||
40 | }; | ||
41 | }; | ||
42 | |||
43 | services.resolved = { | ||
44 | llmnr = "false"; | ||
45 | }; | ||
46 | |||
47 | services.dhcpd4 = { | ||
48 | enable = true; | ||
49 | interfaces = [ "lan" "mgmt" ]; | ||
50 | extraConfig = '' | ||
51 | subnet 10.141.0.0 netmask 255.255.255.0 { | ||
52 | range 10.141.0.128 10.141.0.254; | ||
53 | option domain-name-servers 10.141.0.1; | ||
54 | option broadcast-address 10.141.0.255; | ||
55 | option routers 10.141.0.1; | ||
56 | option domain-name "yggdrasil"; | ||
57 | } | ||
58 | |||
59 | subnet 10.141.1.0 netmask 255.255.255.0 { | ||
60 | range 10.141.1.128 10.141.1.254; | ||
61 | } | ||
62 | ''; | ||
63 | machines = [ | ||
64 | { | ||
65 | ethernetAddress = "50:d4:f7:f3:0f:7e"; | ||
66 | hostName = "gauss-ap01"; | ||
67 | ipAddress = "10.141.0.64"; | ||
68 | } | ||
69 | { | ||
70 | ethernetAddress = "60:a4:b7:53:94:b5"; | ||
71 | hostName = "switch01"; | ||
72 | ipAddress = "10.141.1.2"; | ||
73 | } | ||
74 | ]; | ||
75 | }; | ||
76 | systemd.network.networks = { | ||
77 | "eno2" = { | ||
78 | matchConfig.Name = "eno2"; | ||
79 | networkConfig.LinkLocalAddressing = "no"; | ||
80 | }; | ||
81 | }; | ||
82 | }; | ||
83 | } | ||