Skip to content

Instantly share code, notes, and snippets.

@DmitryMyadzelets
Last active March 30, 2023 15:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DmitryMyadzelets/2c1a2688b3d9feecc2849f117811dcd5 to your computer and use it in GitHub Desktop.
Save DmitryMyadzelets/2c1a2688b3d9feecc2849f117811dcd5 to your computer and use it in GitHub Desktop.
UDP Reverse Tunnel - HowTo

UDP Reverse Tunnel

How to send UDP packets from a public host to a private host behind NAT, with no port forwarding.

Install UDP reverse tunnel

https://github.com/prof7bit/udp-reverse-tunnel

Multiple UDP ports

  1. Install with a parameter instead of a fixed port
sudo make install-outside listen=%i
  1. Rename
cd /etc/systemd/system
mv udp-tunnel-outside.service udp-tunnel-outside@.service
  1. Edit the udp-tunnel-outside@.service file to work with a parameter
[Unit]
Description=reverse UDP tunnel (outside agent) on port %i
Wants=network-online.target
After=network-online.target

[Service]
Type=simple
Restart=always
RestartSec=60

ExecStart=udp-tunnel -l %i

[Install]
WantedBy=multi-user.target
  1. Enable it and start passing the ports as a parameter
sudo systemctl enable udp-tunnel-outside@{5001..5004}
sudo systemctl daemon-reload
sudo systemctl start udp-tunnel-outside@{5001..5004}
  1. Check status
systemctl status udp-tunnel-outside@{5001..5004}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment