home · archive · links · projects

wireguard_iptables.sh

IPT=iptables
SUB_NET=10.0.0.0/24
IN_FACE=eth0
WG_FACE=wg0
WG_PORT=51580

$IPT -t nat -I POSTROUTING 1 -s $SUB_NET -o $IN_FACE -j MASQUERADE
$IPT -I INPUT -i $WG_FACE -j ACCEPT
$IPT -I FORWARD -i $IN_FACE -o $WG_FACE -j ACCEPT
$IPT -I FORWARD -i $WG_FACE -o $IN_FACE -j ACCEPT
$IPT -I INPUT -i $IN_FACE -p udp --dport $WG_PORT -j ACCEPT

© Licensed under CC BY-NC-SA 4.0 if not specified otherwise.
Email: dzshy [at] outlook [dot] com