Skip to content

Instantly share code, notes, and snippets.

  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save coderofsalvation/f489955adafdc9ffb28805fcc36059f6 to your computer and use it in GitHub Desktop.
using iptables to redirect low ports to high ports with rootless podman docker containers

IPTABLES

server $ cat proxy

proxyport(){
  iptables -t nat -A PREROUTING -p tcp --dport $1 -j REDIRECT --to-port $2
  iptables -t nat -I OUTPUT -p tcp -d $(curl -s https://checkip.amazonaws.com) --dport $1 -j REDIRECT --to-port $2 # reverse ip
}

server $ source proxy
server $ proxyport 80 8080
server $ proxyport 81 8181
server $ proxyport 443 4443
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment