Last active
August 29, 2015 14:24
-
-
Save ArseniyShestakov/dc58074b87e5caf4d3a3 to your computer and use it in GitHub Desktop.
Different console tricks to remember
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Lazy TCP port forwarding on localhost | |
autossh -M 0 -f -N -R 34567:192.168.1.150:34567 localhost | |
## Proper port forwarding from server to internal subnet | |
# Allow forwarding on external interface (eth0) | |
iptables -A FORWARD --in-interface eth0 -j ACCEPT | |
# Add masquerade for internal OpenVPN interface (tun0) | |
iptables -t nat -A POSTROUTING --out-interface tun0 -j MASQUERADE | |
# Forward from public ip port 8080 to internal port 80 | |
iptables -t nat -A PREROUTING -p tcp -i eth0 -m tcp --dport 8080 -j DNAT --to-destination 192.168.1.150:80 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment