Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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")

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

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.

share|improve this answer
add comment

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/

share|improve this answer
    
I tried, changing the order does not change the order of routing. –  arsane Mar 12 '12 at 2:07
add comment

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.