Created
March 26, 2021 01:22
-
-
Save icarrr/065ef744e972b8b2a2c4a7c922f9485a to your computer and use it in GitHub Desktop.
Forward port from private network to public port
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
#!/bin/bash | |
# sudo iptables -t nat -I POSTROUTING -m comment --comment "NAT the src ip" -d 192.168.42.12 -o ppp0 -j MASQUERADE | |
sudo iptables -t nat -I POSTROUTING -m comment --comment "NAT the src ip" -d 192.168.42.12 -j MASQUERADE | |
sudo iptables -I FORWARD -d 192.168.42.12 -m comment --comment "Accept to forward winbox mikrotik traffic" -m tcp -p tcp --dport 800 -j ACCEPT | |
sudo iptables -I FORWARD -m comment --comment "Accept to forward winbox mikrotik return traffic" -s 192.168.42.12 -m tcp -p tcp --sport 800 -j ACCEPT | |
sudo iptables -t nat -I PREROUTING -m tcp -p tcp --dport 1001 -m comment --comment "redirect pkts to virtual machine" -j DNAT --to-destination 192.168.42.12:800 | |
echo "Done" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment