Ενώνοντας 2 DSL για διπλό bandwidth
Posted: Sun Mar 02, 2008 12:23 pm
Τελικά μετά από αρκετή προσπάθεια κατάφερα να ενώσω δύο DSL σε linux ώστε να λειτουργούν σαν μία. Παραθέτω τα scripts που το πετυχαίνουν για όποιον ενδιαφέρεται:
και
Η συμπεριφορά ειδικά σε torrents με πολλαπλά connections είναι απλώς τέλεια, 100% utilisation και των δύο DSL.
mp
Code: Select all
#!/bin/sh
# script variables: LINKNAME, IFNAME, IPLOCAL , IPREMOTE
# this is for DSL1
case "$1" in
start)
# disable reverse path filter on the interface
echo 0 > /proc/sys/net/ipv4/conf/$IFNAME/rp_filter
echo $IPREMOTE > /tmp/dsl1-gw
echo $IFNAME > /tmp/dsl1-ifname
# add default gateway to multilink table
/sbin/ip route add table 1 default dev $IFNAME src $IPLOCAL
# reply packets from the same connection
/sbin/ip rule add from $IPLOCAL lookup 1
# setup multipath routing if both lines are up
if [ -s "/tmp/dsl2-ifname" ]; then
DSL2IFNAME=`cat /tmp/dsl2-ifname`
DSL2GW=`cat /tmp/dsl2-gw`
/sbin/ip route del default
/sbin/ip route add default scope global nexthop via $IPREMOTE dev $IFNAME weight 1 \
nexthop via $DSL2GW dev $DSL2IFNAME weight 1
else
/sbin/ip route add default dev $IFNAME
fi
;;
stop)
# remove entries from multilink routing table, remove rule to reply from incoming line
ip route flush table 1
ip rule del from $IPLOCAL
rm /tmp/dsl1-gw
rm /tmp/dsl1-ifname
if [ -s "/tmp/dsl2-ifname" ]; then
DSL2IFNAME=`cat /tmp/dsl2-ifname`
DSL2GW=`cat /tmp/dsl2-gw`
/sbin/ip route add default dev $DSL2IFNAME
fi
;;
*)
echo $"Usage: $0 {start|stop}"
exit 1
esac
Code: Select all
#!/bin/sh
# script variables: LINKNAME, IFNAME, IPLOCAL , IPREMOTE
# this is for DSL2
case "$1" in
start)
# disable reverse path filter on the interface
echo 0 > /proc/sys/net/ipv4/conf/$IFNAME/rp_filter
echo $IPREMOTE > /tmp/dsl2-gw
echo $IFNAME > /tmp/dsl2-ifname
# add default gateway to multilink table
/sbin/ip route add table 2 default dev $IFNAME src $IPLOCAL
# reply packets from the same connection
/sbin/ip rule add from $IPLOCAL lookup 2
# setup multipath routing if both lines are up
if [ -s "/tmp/dsl1-ifname" ]; then
DSL1IFNAME=`cat /tmp/dsl1-ifname`
DSL1GW=`cat /tmp/dsl1-gw`
/sbin/ip route del default
/sbin/ip route add default scope global nexthop via $IPREMOTE dev $IFNAME weight 1 \
nexthop via $DSL1GW dev $DSL1IFNAME weight 1
else
/sbin/ip route add default dev $IFNAME
fi
;;
stop)
# remove entries from multilink routing table, remove rule to reply from incoming line
ip route flush table 2
ip rule del from $IPLOCAL
rm /tmp/dsl2-gw
rm /tmp/dsl2-ifname
if [ -s "/tmp/dsl1-ifname" ]; then
DSL1IFNAME=`cat /tmp/dsl1-ifname`
DSL1GW=`cat /tmp/dsl1-gw`
/sbin/ip route add default dev $DSL1IFNAME
fi
;;
*)
echo $"Usage: $0 {start|stop}"
exit 1
esac
mp