Last active
March 6, 2023 02:27
-
-
Save FreeFly19/3289ba9c901e3190b40a54e7f957ab4c to your computer and use it in GitHub Desktop.
Port forwarding + ovpn
This file contains hidden or 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
client | |
# put the line below to disable tunneling outcoming trafic | |
route-nopull | |
.... |
This file contains hidden or 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
export DEST_IP=10.8.0.139 | |
export DEST_PORT=5000 | |
export LOCAL_EXPOSE_PORT=80 | |
sudo iptables -t nat -A PREROUTING -p tcp -i eth0 --dport $LOCAL_EXPOSE_PORT -j DNAT --to-destination $DEST_IP:$DEST_PORT | |
sudo iptables -A POSTROUTING -t nat -p tcp -d $DEST_IP --dport $DEST_PORT -j MASQUERADE | |
sudo iptables -A FORWARD -p tcp -d $DEST_IP --dport $DEST_PORT -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment