Skip to content

Instantly share code, notes, and snippets.

@ndunks
Created July 24, 2023 02:30
Show Gist options
  • Save ndunks/6498b36365999c45a6747abddfbf5800 to your computer and use it in GitHub Desktop.
Save ndunks/6498b36365999c45a6747abddfbf5800 to your computer and use it in GitHub Desktop.
# filter
iptables -A FORWARD -d 10.19.49.19/32 -j ACCEPT
iptables -A INPUT -p tcp -m tcp --dport 8443 -j ACCEPT
iptables -A INPUT -p tcp -m tcp --dport 8880 -j ACCEPT
# nat
iptables -t nat -A PREROUTING -i eth0 -p tcp -m tcp --dport 8443 -j DNAT --to-destination 10.19.49.19:1234
iptables -t nat -A POSTROUTING -d 10.19.49.19/32 -o wg0 -p tcp -m tcp --dport 1234 -j SNAT --to-source 10.19.49.1
iptables -t nat -A PREROUTING -i eth0 -p tcp -m tcp --dport 8880 -j DNAT --to-destination 10.19.49.19:8880
iptables -t nat -A POSTROUTING -d 10.19.49.19/32 -o wg0 -p tcp -m tcp --dport 8880 -j SNAT --to-source 10.19.49.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment