Created
April 17, 2021 12:13
-
-
Save HackingGate/cf0e2011d328e58f7ec61c5400f50bf5 to your computer and use it in GitHub Desktop.
Revisions
-
HackingGate created this gist
Apr 17, 2021 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,31 @@ # WIP # The script is compatible with Canonical Ubuntu (Always Free Eligible) Minimal sudo apt update sudo apt install wireguard # ifconfig to check your interfae # for Ubuntu 20.04 Minimal 2021.03.25-0 it's ens3 # Generate keys (WIP) sudo echo ' [Interface] PrivateKey = server.key Address = 192.168.16.1/24 ListenPort = 51820 PostUp = sysctl -w net.ipv4.ip_forward=1; iptables -A FORWARD -i %i -j ACCEPT; iptables -t nat -A POSTROUTING -o ens3 -j MASQUERADE PostDown = iptables -D FORWARD -i %i -j ACCEPT; iptables -t nat -D POSTROUTING -o ens3 -j MASQUERADE [Peer] PublicKey = client.pub PresharedKey = shared.psk AllowedIPs = 192.168.16.0/24 PersistentKeepalive = 25 ' > /etc/wireguard/wg0.conf # Firewall settings # https://stackoverflow.com/a/54835902 # WireGuard uses udp. sudo firewall-cmd --zone=public --permanent --add-port=51820/udp sudo firewall-cmd --reload