How to install WireGuard
This is a guide on how to install wireguard as a tunnel.
First, We need to install WireGuard using a script on the tunnel server.
wget -O wireguard.sh https://get.vpnsetup.net/wg
sudo bash wireguard.sh --auto`
cat client.conf
ip a
/usr/sbin/iptables -A FORWARD -i SERVER_NETWORK_INTERFACE -o wg0 -j ACCEPT
/usr/sbin/iptables -A FORWARD -i wg0 -j ACCEPT
/usr/sbin/iptables -t nat -A POSTROUTING -o SERVER_NETWORK_INTERFACE -j MASQUERADE
Forward TCP and UDP
sudo iptables -t nat -A PREROUTING -i SERVER_NETWORK_INTERFACE -p tcp -j DNAT --to-destination 10.7.0.2
sudo iptables -t nat -A PREROUTING -i SERVER_NETWORK_INTERFACE -p udp -j DNAT --to-destination 10.7.0.2
You are all set, all of the traffic should be forwarded to your tunnel server.