Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have multiple 3G USB based Modems. I would like them to keep connected simultaneously, NOT necessarily aggregating their bandwidth; a separate intelligent application would manage their utilization effectively.

However I am running into problem of setting up proper routes for the ppp0,ppp1 interfaces: when one of them connects, other's entries in the routing table get updated so it is no more usable. If I reconnect the second one, it would override the first one's routing entries. If I do it over and over, sometimes both of them's entries disappear while in rare cases the two work well.

I have tried it both using NetworkManager as well as WVDial but issue pops up in both of these. Perhaps both of them use same PPP dialer at the backend and thats why this issue appears.

What is the proper solution to make them work together? In the long run, I'd also like them to automatically dial in once USB gets connected.

share|improve this question
    
Hello, I have the same problem. network-manager doesn't allow me to choose both the connections, so I'm trying to use wvdial. I'd really appreciate some insight on this matter. –  Andrea Spadaccini Feb 8 '11 at 11:36
1  
Linux supports multiple routing tables. You need a separate table for each connection you make. Setting up a new table can be done using ip-up scripts. This link can give you a beter idea: blog.meisterbrau.org/2009/03/… –  sharjeel Feb 9 '11 at 14:08
    
I've no idea what the problem is. Anyway, maybe this link to the Linux Advanced Routing & Traffic Control HOWTO is helpful to someone. –  Stefano Palazzo Feb 15 '11 at 10:59

1 Answer 1

You may wish to try configuring your mobile connections with a simple tweak: checking the Use this connection only for the resources on its network checkbox, which is hidden a little far unfortunately:

Under the settings for your connection, go to the IPv4 tab, click the Routes button, then check the last checkbox on that dialog.

Not tested, but roughly, what should be happening is each pppX device should be getting enabled with correct routes through each of your providers' networks, but the default route should not get set to pass over any of them.

You should then be able to write a simple script that, for instance, pings the same server from each of the interfaces and chooses the fastest one to set the default route; something like:

route_candidate=$(
for iface in `ifconfig -a | grep ppp | awk '{print $1; }'`; do
    echo $iface = `ping -I $iface -c 1 -q 8.8.8.8 | grep avg | awk -F/ '{print $5;}'`
done | sort -k 3 -rn | head -n 1
)

logger "Setting new route from candidate: $route_candidate"

ip route del default
ip route add default dev `echo $route_candidate | awk '{print $1;}'`

I didn't test this completely, but it's roughly what needs to be done; with the addition or modification of using "via whatever_the_default_gw_ip_is" for the ip route add default command. Run this with cron on a regular interval and you have a cheapo system for staying on the "fastest" ISP.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.