Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
19fabe3
added default ipv6 gateway
mikhail729 Nov 19, 2025
52df102
hosts/zerocool: changed zerocool networking configuration to use a pr…
mikhail729 Dec 5, 2025
8b418f6
hosts/zerocool: removed outdated comment in lan declaration
mikhail729 Dec 5, 2025
4d0f842
hosts/zerocool: correct IPv6 prefix and added vlans to IPv4 NAT
mikhail729 Dec 15, 2025
e3a66d2
hosts/zerocool: added firewall, untagged vlan, and dhcp configuration
mikhail729 Mar 5, 2026
e47076d
hosts/zerocool: update variables to camelCase
mikhail729 Mar 5, 2026
ac5a998
hosts/zerocool: changed static hosts to general host vlan
mikhail729 Mar 5, 2026
7d19892
hosts/zerocool: cleaned up duplicate code
mikhail729 Mar 5, 2026
579bead
hosts/zerocool: fixed typo in firewall
mikhail729 Mar 5, 2026
a1e819d
hosts/zerocool: added WAN port opening, host forwarding, and fixed de…
mikhail729 Mar 5, 2026
418f198
hosts/zerocool: fixed dhcpv6 access to router on denied vlans
mikhail729 Mar 5, 2026
292b2c2
hosts/zerocool: added different dhcp domains for every vlan
mikhail729 Mar 5, 2026
1ce047f
hosts/zerocool: added proxy forwarding for WAN
mikhail729 Mar 5, 2026
fd639e4
hosts/zerocool: exposed dhcp and dns ports
mikhail729 Mar 6, 2026
4b5fb84
hosts/zerocool: added proxy arp hosts and disabled ipv4 nat for publi…
mikhail729 Mar 6, 2026
e63977d
hosts/zerocool: fixed wan cidr
mikhail729 Mar 6, 2026
9021403
hosts/zerocool: cleaned up firewall
mikhail729 Mar 6, 2026
c200ddc
hosts/zerocool: added essential networking packages
mikhail729 Mar 6, 2026
08cca10
hosts/zerocool: autoformat files
mikhail729 Mar 6, 2026
a61fc6c
hosts/zerocool: updated dns to use local dnsmasq
mikhail729 Mar 6, 2026
2ab191b
hosts/zerocool: cleaned up firewall rules and added selective vlan is…
mikhail729 Mar 7, 2026
2926a70
hosts/zerocool: removed scaryterry
mikhail729 Mar 7, 2026
d517005
hosts/zerocool: fixed proxy arp
mikhail729 Mar 7, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
195 changes: 160 additions & 35 deletions hosts/zerocool/configuration.nix
Original file line number Diff line number Diff line change
@@ -1,43 +1,168 @@
{ config, lib, pkgs, ... }:
{
config,
lib,
pkgs,
...
}:
let
wan_iface = "enp3s0f0";
lan_iface = "enp3s0f1";
wg_iface = "wg0";
lan_addr = "10.98.4.1";
lan_cidr = 22;
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
imports = [
./hardware-configuration.nix
../common/nix.nix
../common/sshd.nix
../common/users-local.nix
../common/tz-locale.nix

./dns.nix
(import ./router.nix {
inherit wan_iface lan_iface lan_addr lan_cidr wg_iface;
wan_gateway = "198.82.185.129";
wan_addr = "198.82.185.170";
wan_cidr = 22;
wan_addr6 = "2001:468:c80:6119:82c1:6eff:fe21:2b88";
wan_cidr6 = 64;
})
(import ./firewall.nix {
inherit lan_iface;
})
(import ./dhcp.nix {
inherit lan_iface;
dhcp_start = "10.98.5.1";
dhcp_end = "10.98.5.127";
})
(import ./wireguard.nix {
inherit config wg_iface;
})
];
./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";
}

73 changes: 63 additions & 10 deletions hosts/zerocool/dhcp.nix
Original file line number Diff line number Diff line change
@@ -1,20 +1,73 @@
{ lan_iface, dhcp_start, dhcp_end }:
{
lib,
lanIface,
lan,
...
}:
let
hosts = import ./static-hosts.nix;
dnsmasq-hosts = builtins.map (host:
"${host.mac},${host.ipv4},${host.name}"
) hosts;
dnsmasqHosts = builtins.map (host: "${host.mac},${host.ipv4},${host.name}") hosts;
globalDomain = "mcb.vtluug.org";

taggedVlans = (
builtins.filter (e: !builtins.hasAttr "untagged" e.snd) (
lib.lists.zipLists (builtins.attrNames lan) (builtins.attrValues lan)
)
);
untaggedVlan = lib.lists.findFirst (
e: builtins.hasAttr "untagged" e
) (throw "Must have untagged VLAN") (builtins.attrValues lan);

interfaces = builtins.map (e: "vlan${e.fst}") (
builtins.filter (
e: (builtins.hasAttr "dhcpv4" e.snd) || (builtins.hasAttr "dhcpv6" e.snd)
) taggedVlans
);
in
{
networking.nameservers = [
"::"
"127.0.0.1"
];

# DNS, DHCPv4, DHCPv6
networking.firewall.allowedUDPPorts = [
53
67
547
];

services.dnsmasq = {
enable = true;
settings = {
interface = lan_iface;
dhcp-range = [
"${dhcp_start},${dhcp_end},12h"
"10.98.4.2,static,255.255.255.0"
domain =
(lib.lists.optional (builtins.hasAttr "domain" untaggedVlan) "${untaggedVlan.domain}.${globalDomain},${untaggedVlan.ipv4.address}/${toString untaggedVlan.ipv4.cidr}")
++ (builtins.map (
e: "${e.snd.domain}.${globalDomain},${e.snd.ipv4.address}/${toString e.snd.ipv4.cidr}"
) (builtins.filter (e: builtins.hasAttr "domain" e.snd) taggedVlans));
server = [
"9.9.9.9"
"2620:fe::fe"
"1.1.1.1"
"2606:4700:4700::1111"
"/whit.vtluug.org/10.98.3.2"
"/bastille.vtluug.org/10.98.3.2"
];
"dhcp-host" = dnsmasq-hosts;
interface =
(lib.lists.optional (
(builtins.hasAttr "dhcpv4" untaggedVlan) || (builtins.hasAttr "dhcpv6" untaggedVlan)
) lanIface)
++ interfaces;
dhcp-range =
(lib.lists.optional (builtins.hasAttr "dhcpv4" untaggedVlan) "interface:${lanIface},${untaggedVlan.dhcpv4}")
++ (lib.lists.optional (builtins.hasAttr "dhcpv6" untaggedVlan) "interface:${lanIface},::,constructor:${lanIface},${untaggedVlan.dhcpv6}")
++ (builtins.map (e: "interface:vlan${e.fst},${e.snd.dhcpv4}") (
builtins.filter (e: builtins.hasAttr "dhcpv4" e.snd) taggedVlans
))
++ (builtins.map (e: "interface:vlan${e.fst},::,constructor:vlan${e.fst},${e.snd.dhcpv6}") (
builtins.filter (e: builtins.hasAttr "dhcpv6" e.snd) taggedVlans
));
dhcp-host = dnsmasqHosts;
};
};
}
}
7 changes: 0 additions & 7 deletions hosts/zerocool/dns.nix

This file was deleted.

Loading