Wireguard
Jump to navigation
Jump to search
Client
Er is iets vreemds met Networkmanager, gebruik
sudo wg-quick up wg0
Client
[root@RijksLReich wireguard]# cat wggpl.conf
[Interface] PrivateKey = ---- 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
[root@RijksLReich wireguard]# cat wgiemhof.conf
[Interface] PrivateKey = ----- Address = 192.168.1.250/32 [Peer] PublicKey = PFA3adlbjdXJ5DM1V/U11DA/iLLBYCYgKwSm8Ybw+F0= AllowedIPs = 192.168.1.0/24 Endpoint = iemhof.rijkenmiel.nl:51820
Server
root@Geitenpad:/etc/wireguard# cat wg1.conf
[Interface] Address = 192.168.1.2/32 ListenPort = 51820 PrivateKey = ------ 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
root@iemhof:~# cat /etc/wireguard/wg1.conf
[Interface] Address = 192.168.1.252/32 ListenPort = 51820 PrivateKey = --- 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 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 [Peer] PublicKey = UiijlLcPMu8hlce3XxHja/vFcuyt+XMH0ufVyDSDyys= AllowedIPs = 192.168.1.251/32 [Peer] PublicKey = GP6zja0ewQxaZc6t+Q50a40W14pSSoVKFSIFnnogaiA= AllowedIPs = 192.168.1.250/32