Wireguard: Difference between revisions
Jump to navigation
Jump to search
| Line 4: | Line 4: | ||
sudo wg-quick up wg0 | sudo wg-quick up wg0 | ||
== Client == | |||
[root@RijksLReich wireguard]# cat wggpl.conf | |||
[Interface] | |||
PrivateKey = 6CQikJo5DpmYcAGYm6brCmVRgRoa1CY28S2ZcbjJs0o= | |||
Address = 192.168.1.4/32 | |||
[Peer] | |||
PublicKey = ZANO5QvDzieVtizUTaoYqmKa8Jz0i27tQvf/4aBAsXQ= | |||
AllowedIPs = 192.168.2.0/24,192.168.1.0/24 | |||
Endpoint = geitenpad.rijkenmiel.nl:51820 | |||
== Server == | == Server == | ||
Revision as of 20:32, 15 May 2025
Client
Er is iets vreemds met Networkmanager, gebruik
sudo wg-quick up wg0
Client
[root@RijksLReich wireguard]# cat wggpl.conf
[Interface] PrivateKey = 6CQikJo5DpmYcAGYm6brCmVRgRoa1CY28S2ZcbjJs0o= Address = 192.168.1.4/32 [Peer] PublicKey = ZANO5QvDzieVtizUTaoYqmKa8Jz0i27tQvf/4aBAsXQ= AllowedIPs = 192.168.2.0/24,192.168.1.0/24 Endpoint = geitenpad.rijkenmiel.nl:51820
Server
root@Geitenpad:/etc/wireguard# cat wg1.conf
[Interface] Address = 192.168.1.2/32 ListenPort = 51820 PrivateKey = UEClTEblGB0/DBO9VYa7DM6MRiRHOPt3nxlqTL/JykM= PreUp = sysctl -w net.ipv4.ip_forward=1 PreUp = iptables -t mangle -A PREROUTING -i wg1 -j MARK --set-mark 0x30 PreUp = iptables -t nat -A POSTROUTING ! -o wg1 -m mark --mark 0x30 -j MASQUERADE PreUp = iptables -A FORWARD -i wg1 -o eno1 -j ACCEPT PreUp = iptables -A FORWARD -i eno1 -o wg1 -j ACCEPT PostDown = iptables -t mangle -D PREROUTING -i wg1 -j MARK --set-mark 0x30 PostDown = iptables -t nat -D POSTROUTING ! -o wg1 -m mark --mark 0x30 -j MASQUERADE PostDown = iptables -D FORWARD -i wg1 -o eth0 -j ACCEPT PostDown = iptables -D FORWARD -i eth0 -o wg1 -j ACCEPT [Peer] PublicKey = UiijlLcPMu8hlce3XxHja/vFcuyt+XMH0ufVyDSDyys= AllowedIPs = 192.168.1.3/32 [Peer] PublicKey = GP6zja0ewQxaZc6t+Q50a40W14pSSoVKFSIFnnogaiA= AllowedIPs = 192.168.1.4/32
root@Geitenpad:/etc/wireguard# cat /proc/sys/net/ipv4/ip_forward
1