Created
July 5, 2013 13:15
-
-
Save boo1ean/5934467 to your computer and use it in GitHub Desktop.
port forwarding
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
insert_port_forwarding() { #port, dest_ip, protocol, dest_port | |
local port=$1 | |
local dest_ip=$2 | |
local protocol=$3 | |
local dest_port=$4 | |
if [ -z $dest_port ] | |
then | |
dest_port=$port | |
fi | |
iptables -t nat -A PREROUTING -p $protocol -d $LIN_WAN_IP --dport $port -j DNAT --to $dest_ip:$dest_port | |
iptables -A FORWARD -p tcp -i ${WAN} --dport $dest_port -j FORWARD_ALLOW | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment