I am able to do iPhone USB tethering under Ubuntu which will be recognized as eth1 interface (I also have an eth0 internet connection).

What I want to do is, when the eth1 is up, I want to make it be the default gateway, and if eth1 is down, then return back to using eth0 as default gateway.

How can I make it happen? I want solutions for both Windows and Ubuntu.

[EDIT] A compromised solution under Ubuntu is that I can set one of my interfaces as "Use this connection only for resources on its network" with the networkmanager. (Under selected connection-> IPv4 ->"Routes")


Finally figured out some work solution:

  1. for windows, we need disable the default local connection's auto metric setting. As the default connection's metric is 20, but my iphone tethering's metric is 40 which makes it does not become the default gateway.

To change the metric of the default local connection, try: open "property" of the local connection -> "Internet Protocol Version 4 propertie" -> "Advanced" -> uncheck "automatic metric" and change its metric to a big value like 60.

After connect the iphone tethering, check with "route print" command to make sure that iphone's route has smaller metric value, or else change the local connection's metric value to a bigger with the way mentioned.

  1. for ubuntu, a workable way could be set local default connection as "Use this connection only for resources on its network" with the networkmanager. (Under selected connection-> IPv4 ->"Routes"). By this way, when iphone pluged, it will become the default gateway.

By this way, with default connection only local network is accessible. But as in office, all internet access is based on internal proxy, so it is acceptable for my linux environment.


I think a solution in Windows is to set the "binding order of network adapters":

For Windows XP: http://www.windowsreference.com/windows-2000/change-network-adapter-priority-in-xp2000/ For Windows Vista/7: http://www.windowsreference.com/windows-vista/change-network-adapter-priority-in-vista/

  • I tried, changing the order does not change the order of routing.
    – Sam Liao
    Mar 12 '12 at 2:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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