master
parent
11e55acae2
commit
21f3328f05
18
rc.firewall
18
rc.firewall
|
@ -82,15 +82,19 @@ if [ $ROUTING ]; then
|
||||||
echo -n "Adding route: "
|
echo -n "Adding route: "
|
||||||
for i in `grep -v "\#" $ROUTING`; do
|
for i in `grep -v "\#" $ROUTING`; do
|
||||||
ROUTE=( ${i//:/ } )
|
ROUTE=( ${i//:/ } )
|
||||||
echo 1 > /proc/sys/net/ipv4/conf/{${ROUTE[0]},${ROUTE[2]}}/forwarding
|
FWINT1=${ROUTE[0]}
|
||||||
$IPTABLES -A FORWARD -i ${ROUTE[0]} -o ${ROUTE[2]} \
|
FWINT2=${ROUTE[2]}
|
||||||
-s ${ROUTE[1]} -d ${ROUTE[3]} -j ACCEPT
|
FWIP1=${ROUTE[1]}
|
||||||
|
FWIP2=${ROUTE[3]}
|
||||||
|
echo 1 > /proc/sys/net/ipv4/conf/{$FWINT1,$FWINT2}/forwarding
|
||||||
|
$IPTABLES -A FORWARD -i $FWINT1 -o $FWINT1 \
|
||||||
|
-s $FWIP1 -d $FWIP2} -j ACCEPT
|
||||||
if [ ${ROUTE[4]} == "1" ]; then
|
if [ ${ROUTE[4]} == "1" ]; then
|
||||||
echo -n "${ROUTE[0]}:${ROUTE[1]}<->${ROUTE[1]}:${ROUTE[3]} "
|
echo -n "$FWINT1:$FWIP1}<->$FWINT1:$FWIP2} "
|
||||||
$IPTABLES -A FORWARD -o ${ROUTE[0]} -i ${ROUTE[2]} \
|
$IPTABLES -A FORWARD -o $FWINT1 -i $FWINT2 \
|
||||||
-d ${ROUTE[1]} -s ${ROUTE[3]} -j ACCEPT
|
-d $FWIP1 -s $FWIP2 -j ACCEPT
|
||||||
else
|
else
|
||||||
echo -n "${ROUTE[0]}:${ROUTE[1]}->${ROUTE[1]}:${ROUTE[3]} "
|
echo -n "$FWINT1:$FWIP1}->$FWINT1:$FWIP2} "
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue