Route IPv6 via Wireguard

This commit is contained in:
coolneng 2025-04-14 19:22:26 +02:00
parent ef69519de7
commit 156d8b04e5
Signed by: coolneng
GPG Key ID: 9893DA236405AF57

View File

@ -79,6 +79,9 @@ in
iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o ${ iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o ${
config.systemd.network.networks."24-home".name config.systemd.network.networks."24-home".name
} -j MASQUERADE } -j MASQUERADE
ip6tables -t nat -A POSTROUTING -s fd00::0/128 -o ${
config.systemd.network.networks."24-home".name
} -j MASQUERADE
''; '';
}; };
@ -96,12 +99,18 @@ in
# panacea # panacea
{ {
PublicKey = "XMkTztU2Y8hw6Fu/2o4Gszij+EmNacvFMXuZyHS1n38="; PublicKey = "XMkTztU2Y8hw6Fu/2o4Gszij+EmNacvFMXuZyHS1n38=";
AllowedIPs = [ "10.8.0.2/32" ]; AllowedIPs = [
"10.8.0.2/32"
"fd00::2/128"
];
} }
# caravanserai # caravanserai
{ {
PublicKey = "mCsTj09H7lfDDs8vMQkJOlItHtHQ6MPUyfGO5ZjBbVs="; PublicKey = "mCsTj09H7lfDDs8vMQkJOlItHtHQ6MPUyfGO5ZjBbVs=";
AllowedIPs = [ "10.8.0.3/32" ]; AllowedIPs = [
"10.8.0.3/32"
"fd00::3/128"
];
} }
]; ];
}; };
@ -109,8 +118,12 @@ in
systemd.network.networks."wg0" = { systemd.network.networks."wg0" = {
matchConfig.Name = "wg0"; matchConfig.Name = "wg0";
networkConfig = { networkConfig = {
Address = "10.8.0.1/24"; Address = [
"10.8.0.1/24"
"fd00::1/128"
];
IPv4Forwarding = true; IPv4Forwarding = true;
IPv6Forwarding = true;
}; };
}; };
@ -126,6 +139,8 @@ in
"127.0.0.1" "127.0.0.1"
"192.168.128.2" "192.168.128.2"
"10.8.0.1" "10.8.0.1"
"::1"
"fd00::1"
]; ];
bind-interfaces = true; bind-interfaces = true;
server = [ "127.0.0.1#43" ]; server = [ "127.0.0.1#43" ];
@ -135,8 +150,6 @@ in
conf-file = "${pkgs.dnsmasq}/share/dnsmasq/trust-anchors.conf"; conf-file = "${pkgs.dnsmasq}/share/dnsmasq/trust-anchors.conf";
dnssec = false; dnssec = false;
address = "/coolneng.duckdns.org/192.168.128.2";
}; };
}; };
@ -145,7 +158,10 @@ in
enable = true; enable = true;
upstreamDefaults = true; upstreamDefaults = true;
settings = { settings = {
listen_addresses = [ "127.0.0.1:43" ]; listen_addresses = [
"127.0.0.1:43"
"[::1]:43"
];
sources.public-resolvers = { sources.public-resolvers = {
urls = [ "https://download.dnscrypt.info/resolvers-list/v3/public-resolvers.md" ]; urls = [ "https://download.dnscrypt.info/resolvers-list/v3/public-resolvers.md" ];
cache_file = "/var/lib/dnscrypt-proxy2/public-resolvers.md"; cache_file = "/var/lib/dnscrypt-proxy2/public-resolvers.md";