Skip to content

Instantly share code, notes, and snippets.

@rafamdr
Created July 11, 2020 18:19
Show Gist options
  • Select an option

  • Save rafamdr/4a8590fce9ecd1068d1fd19ae5287bd7 to your computer and use it in GitHub Desktop.

Select an option

Save rafamdr/4a8590fce9ecd1068d1fd19ae5287bd7 to your computer and use it in GitHub Desktop.
Redirect local service with specific port using a public port
# Two examples (TCP and UDP) showing how to redirect traffic to private ports (6120, 6121) used by a local service,
# using public ports (8000, 8001).
# Bonus: if your application/service has IP address or DNS name filtering, in this case, using this approach,
# it will understand that all requests are coming from "localhost"
socat tcp-listen:8001,reuseaddr,fork tcp:localhost:6121
socat udp-listen:8000,reuseaddr,fork udp:localhost:6120
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment