Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save apristen/fa72d09502dc2eaced5374307f92f0e9 to your computer and use it in GitHub Desktop.
Save apristen/fa72d09502dc2eaced5374307f92f0e9 to your computer and use it in GitHub Desktop.
Easy way for TCP and/or UDP ports forwarding from privileged (<1024) to non-privileged (>1024) ports using just iptables PREROUTING.
#!/bin/bash
iptables -t nat -A PREROUTING -p tcp -m tcp --dport 25 -j REDIRECT --to-ports 2525
iptables -t nat -A PREROUTING -p udp -m udp --dport 53 -j REDIRECT --to-ports 5353
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment