Created
December 13, 2018 08:41
-
-
Save zhsso/9ce9b5fafb84e463258b13032fedcceb to your computer and use it in GitHub Desktop.
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
#!/bin/bash | |
pro='tcp' | |
NAT_Host=$1 | |
NAT_Port=$2 | |
Dst_Host=$3 | |
Dst_Port=$4 | |
iptables -t nat -A PREROUTING -m $pro -p $pro --dport $NAT_Port -j DNAT --to-destination $Dst_Host:$Dst_Port | |
iptables -t nat -A POSTROUTING -m $pro -p $pro --dport $Dst_Port -d $Dst_Host -j SNAT --to-source $NAT_Host |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment