ip4tables-fwd: filter by host ip for multi-net fwd

This commit is contained in:
2013-03-11 12:49:24 +03:00
parent 05164bf495
commit c66ed40f8c

4
.rc
View File

@@ -197,8 +197,8 @@ function ip4tables-fwd() {
[ -z "$SRC_PORT" ] && local SRC_PORT=$DST_PORT
echo "To forward <$SRC_HOST> port <$SRC_PORT> to <$DST_HOST> port <$DST_PORT>:
iptables -t nat -A PREROUTING -p tcp --dport $SRC_PORT -j DNAT --to-destination $DST_HOST:$DST_PORT
iptables -t nat -A POSTROUTING -p tcp --dport $DST_PORT -j SNAT --to-source $SRC_HOST
iptables -t nat -A PREROUTING -d $SRC_HOST -p tcp --dport $SRC_PORT -j DNAT --to-destination $DST_HOST:$DST_PORT
iptables -t nat -A POSTROUTING -d $DST_HOST -p tcp --dport $DST_PORT -j SNAT --to-source $SRC_HOST
"
}