diff options
author | Vasudev Kamath <vasudev@copyninja.info> | 2016-07-17 15:42:41 +0530 |
---|---|---|
committer | Vasudev Kamath <vasudev@copyninja.info> | 2016-07-17 15:42:41 +0530 |
commit | 7c9e4e9daa00391c65c8ce9517109f445fb208da (patch) | |
tree | 392d8100c94eb39c3b9835695fd0ddf62a003b1d /port_forward | |
parent | d106e9ac560ee3b7f32256cf3a8e4a619f60f3fe (diff) | |
parent | b8f42ab1f6dc17bbb352bcc3a12020d47429df00 (diff) |
Merge branch 'master' of github.com:copyninja/bin
Diffstat (limited to 'port_forward')
-rwxr-xr-x | port_forward | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/port_forward b/port_forward index 4a3c9d1..4842b3c 100755 --- a/port_forward +++ b/port_forward @@ -35,8 +35,10 @@ setup_portforwarding () { iptables -A FORWARD -p "$protocol" -d ${DESTINATION%%\:*} --dport $PORT -j ACCEPT # Returning packet should have gateway IP - iptables -t nat -A POSTROUTING -s ${DESTINATION%%\:*} -o \ - $IN_INTERFACE -j SNAT --to ${IN_IP%%\/*} + for ip in ${IN_IP} ; do + iptables -t nat -A POSTROUTING -s ${DESTINATION%%\:*} -o \ + $IN_INTERFACE -j SNAT --to ${ip%%\/*} + done } @@ -82,7 +84,7 @@ DESTINATION="$4" # Get the incoming interface IP. This is used for SNAT. IN_IP=$(ip addr show $IN_INTERFACE|\ - perl -nE '/inet\s(.*)\sbrd/ and print $1') + perl -nE '/inet\s(.*)\sscope/ and say $1' | tr '\n' ' ') if [ -n "$CLEAR_RULES" ]; then |