bruns@2mbit.com 2009-08-13 22:16:53 +00:00
parent 11e55acae2
commit 21f3328f05
1 changed files with 11 additions and 7 deletions

View File

@ -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