2026-07-04
This commit is contained in:
parent
0de07cd804
commit
749bfdf50d
12 changed files with 80 additions and 157 deletions
|
|
@ -15,9 +15,8 @@
|
|||
|
||||
networking = {
|
||||
hostName = hostname;
|
||||
nameservers = [ "192.168.88.3" ];
|
||||
networkmanager.enable = false;
|
||||
firewall.trustedInterfaces = [ "vlan66" ];
|
||||
nameservers = [ "192.168.88.3" ];
|
||||
useDHCP = false;
|
||||
useNetworkd = true;
|
||||
|
||||
|
|
@ -72,20 +71,28 @@
|
|||
linkConfig.RequiredForOnline = "routable";
|
||||
};
|
||||
|
||||
# netdevs."30-vlan66" = {
|
||||
# netdevConfig = {
|
||||
# Kind = "vlan";
|
||||
# Name = "vlan66";
|
||||
# };
|
||||
# vlanConfig = {
|
||||
# Id = 66;
|
||||
# };
|
||||
# };
|
||||
networks."30-vm-1" = {
|
||||
matchConfig.Name = "vm-1";
|
||||
address = [ "10.0.0.1/24" ];
|
||||
networkConfig.IPMasquerade = "both";
|
||||
};
|
||||
|
||||
# networks."30-vlan66" = {
|
||||
# matchConfig.Name = "vlan66";
|
||||
# networkConfig.DHCP = "yes";
|
||||
# };
|
||||
};
|
||||
|
||||
networking.nat = {
|
||||
enable = true;
|
||||
internalInterfaces = [ "vm-*" ];
|
||||
externalInterface = "br0";
|
||||
};
|
||||
|
||||
services.resolved = {
|
||||
enable = true;
|
||||
settings = {
|
||||
Resolve = {
|
||||
Domains = [ "~." ];
|
||||
FallbackDNS = null;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
services.wireguard-netns = {
|
||||
|
|
@ -113,46 +120,4 @@
|
|||
};
|
||||
};
|
||||
};
|
||||
|
||||
# systemd.services."netns@wg0ns" = {
|
||||
# description = "wg0 network namespace";
|
||||
# before = [ "network.target" ];
|
||||
# serviceConfig = {
|
||||
# Type = "oneshot";
|
||||
# RemainAfterExit = true;
|
||||
# ExecStart = pkgs.writers.writeBash "wg0ns-up" ''
|
||||
# ${pkgs.coreutils}/bin/mkdir -p /etc/netns/wg0ns
|
||||
# echo "nameserver $(cat ${config.sops.secrets."wg0/dns".path})" > /etc/netns/wg0ns/resolv.conf
|
||||
# ${pkgs.iproute2}/bin/ip netns add wg0ns
|
||||
# '';
|
||||
# ExecStop = "${pkgs.iproute2}/bin/ip netns del wg0ns";
|
||||
# };
|
||||
# };
|
||||
#
|
||||
# systemd.services.wg0 = {
|
||||
# description = "wg0 network interface";
|
||||
# bindsTo = [ "netns@wg0ns.service" ];
|
||||
# requires = [ "network-online.target" ];
|
||||
# after = [ "netns@wg0ns.service" ];
|
||||
# wants = [ "network-online.target" ];
|
||||
# wantedBy = [ "multi-user.target" ];
|
||||
# serviceConfig = {
|
||||
# Type = "oneshot";
|
||||
# RemainAfterExit = true;
|
||||
# ExecStart = pkgs.writers.writeBash "wg-up" ''
|
||||
# ${pkgs.iproute2}/bin/ip link add wg0 type wireguard
|
||||
# ${pkgs.iproute2}/bin/ip link set wg0 netns wg0ns
|
||||
# ${pkgs.iproute2}/bin/ip -n wg0ns address add $(< ${config.sops.secrets."wg0/address".path}) dev wg0
|
||||
# ${pkgs.iproute2}/bin/ip netns exec wg0ns \
|
||||
# ${pkgs.wireguard-tools}/bin/wg setconf wg0 ${config.sops.secrets."wg0/conf".path}
|
||||
# ${pkgs.iproute2}/bin/ip -n wg0ns link set lo up
|
||||
# ${pkgs.iproute2}/bin/ip -n wg0ns link set wg0 up
|
||||
# ${pkgs.iproute2}/bin/ip -n wg0ns route add default dev wg0
|
||||
# '';
|
||||
# ExecStop = pkgs.writers.writeBash "wg-down" ''
|
||||
# ${pkgs.iproute2}/bin/ip -n wg0ns route del default dev wg0
|
||||
# ${pkgs.iproute2}/bin/ip -n wg0ns link del wg0
|
||||
# '';
|
||||
# };
|
||||
# };
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue