ip4tables-fwd: filter by host ip for multi-net fwd
This commit is contained in:
4
.rc
4
.rc
@@ -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
|
||||
"
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user