New oneplus6t wireguard client

This commit is contained in:
Andrea Ciceri 2023-04-02 16:17:14 +02:00
parent 1c6e94ad0e
commit 44009e87bf
Signed by: aciceri
SSH key fingerprint: SHA256:/AagBweyV4Hlfg9u092n8hbHwD5fcB6A3qhDiDA65Rg
2 changed files with 14 additions and 16 deletions

View file

@ -1,29 +1,23 @@
{config, ...}: { {
config,
fleetFlake,
...
}: {
networking.firewall = { networking.firewall = {
allowedUDPPorts = [51820]; # Clients and peers can use the same port, see listenport allowedUDPPorts = [51820];
}; };
# Enable WireGuard
networking.wireguard.interfaces = { networking.wireguard.interfaces = {
# "wg0" is the network interface name. You can name the interface arbitrarily.
wg0 = { wg0 = {
ips = ["10.100.0.2/32"]; ips = ["${(import "${fleetFlake}/lib").ips."${config.networking.hostName}"}/32"];
listenPort = 51820; # to match firewall allowedUDPPorts (without this wg uses random port numbers) listenPort = 51820;
privateKeyFile = config.age.secrets."${config.networking.hostName}-wireguard-private-key".path; privateKeyFile = config.age.secrets."${config.networking.hostName}-wireguard-private-key".path;
peers = [ peers = [
{ {
# Public key of the server (not a file path).
publicKey = "O9V2PI7+vZm7gGn3f9SaTsJbVe9urf/jZkdXFz/mjVU="; publicKey = "O9V2PI7+vZm7gGn3f9SaTsJbVe9urf/jZkdXFz/mjVU=";
allowedIPs = ["10.100.0.0/24"];
# Forward all the traffic via VPN.
# allowedIPs = [ "0.0.0.0/0" ];
# Or forward only particular subnets
allowedIPs = ["10.100.0.1"];
# Set this to the server IP and port.
endpoint = "mothership.aciceri.dev:51820"; endpoint = "mothership.aciceri.dev:51820";
persistentKeepalive = 25; persistentKeepalive = 25;
} }
]; ];

View file

@ -30,9 +30,13 @@
{ {
# thinkpad # thinkpad
publicKey = "g8wId6Rl0olRFRtAnQ046ihPRYFCtMxOJ+/Z9ARwIxI="; publicKey = "g8wId6Rl0olRFRtAnQ046ihPRYFCtMxOJ+/Z9ARwIxI=";
# List of IPs assigned to this peer within the tunnel subnet. Used to configure routing.
allowedIPs = ["10.100.0.2/32"]; allowedIPs = ["10.100.0.2/32"];
} }
{
# oneplus6t
publicKey = "O6/tKaA8Hs7OEqi15hV4RwviR6vyCTMYv6ZlhsI+tnI=";
allowedIPs = ["10.100.0.3/32"];
}
]; ];
}; };
}; };