Multiple network connections in Ubuntu with one prefered for internet traffic

3

1

Is there a way to make all internet traffic go through one network connection when there are multiple connections?

I've connected my mobile broadband modem into my Ubuntu Jaunty box so that I now have two running connections: the mobile broadband and an ethernet connection.

The problem is that internet traffic is going through the ethernet connection rather than the mobile connection. Where I live, ISPs cap bandwidth after you have used your quota, and we have been capped at my house, so I need internet traffic to go through the faster mobile connection. I need access to the home network so disabling ethernet is not an option

nedned

Posted 2009-10-26T00:11:55.160

Reputation: 2 502

Answers

3

You can do this with a static route

Details for how to do this can be found here http://www.ubuntugeek.com/howto-add-permanent-static-routes-in-ubuntu.html

You will define one route for your internal network to whichever interface that is attached to, and then you'll set the default route (0.0.0.0/0) to the other interface.

MDMarra

Posted 2009-10-26T00:11:55.160

Reputation: 19 580

Ahh ok. Should either of them be going through the gateway of the home network? – nedned – 2009-10-26T01:40:11.830

1Whatever needs to stay locally on your internal network. You've said that you cannot unplug the interface that is connected to your broadband modem because you need to be able to access other things on your network. So for that interface make a route that applies to traffic internal on your network. If your internal network is 192.168.1.0 with a netmask of 255.255.255.0 it would look like 192.168.1.0/24 and you would say anything from that route would use your broadband router/modem as the gateway. – MDMarra – 2009-10-26T01:50:45.060

Success! Thanks heaps. It turned out that there was already an appropriate entry in the routing tables for the local network so I just needed to add the default entry for the mobile broadband modem. – nedned – 2009-10-26T02:25:15.923

3

In Ubuntu you can also try selecting "Edit connections" from the Network Manager, edit the ethernet connection, under IPv4 Settings select Routes... and tick "Use this connection only for resources on its network".

The explanations of the option is "If enabled, this connection will never be used as the default network connection." This should achieve what you want. You could also defined separate connection profiles, one of which uses the ethernet as the default connection and another that doesn't.

Sampo

Posted 2009-10-26T00:11:55.160

Reputation: 31