How to tell Windows 7 to ignore a default gateway

24

8

I currently have 2 network cards in my PC -- one connected to an internal network on a router with a disconnected WAN port (10.x.x.x), and one connected to the internet through a consumer router (192.168.0.x).

Windows seems to recognize them correctly (my "Network and Sharing Center" lists them as "No Internet" and "Internet" respectively), however when I try browsing the internet it always tries the internal network's default gateway, rather than the one with internet access. Trying to ping a website results in "Reply from 10.0.0.1: Destination net unreachable.".

A simple "route delete 0.0.0.0 mask 0.0.0.0 10.0.0.1" fixes the problems, but they return upon reboot, or upon renewing my IP.

Is there any way to tell Windows to ignore one NIC's default gateway, or to at least give them priorities?

zildjohn01

Posted 2009-12-02T14:57:31.227

Reputation: 2 212

Answers

36

You can try to force the metric for the 10.0.0.0 adapter to be higher than the 192.168.0.0 adapter. This should push Windows 7 to prefer the 192.168.0.0 adapter when routing to a network that is not directly connected.

  1. Open the Properties of your 10.0.0.0 network adapter.
  2. Open the properties of Internet Protocol Version 4 (TCP/IPv4).
  3. Click on Advanced.
  4. Uncheck Automatic Metric and set the Interface Metric value to a high number, say 2000.
  5. Hit OK until you close the screens.

You can view what metrics are used using the route print and looking at the metric column for the routes listed. Windows 7 uses a more dynamic metric than the previous versions, so you'll want to make sure you set the 10.0.0.0 adapter to a high enough number to prevent it from being lower than your 192.168.0.0 adapter.

Joshua

Posted 2009-12-02T14:57:31.227

Reputation: 4 434

Sounds like I should have poked around a little more. This worked great. Thanks! – zildjohn01 – 2009-12-02T16:50:53.140

4

Apple's Bonjour service is known to cause the 0.0.0.0 gateway issue. It is installed by iTunes or Adobe Suites.

Here's how to turn it off: http://kb2.adobe.com/cps/400/kb400982.html

This bug has been dogging me since Vista, thanks Apple for your crappy software!

JohnB

Posted 2009-12-02T14:57:31.227

Reputation:

0

If you can't turn force the internal network's router to stop handing out a default gateway address altogether, then perhaps you could simply have the internal network's router hand out the same gateway address as the other router.

eleven81

Posted 2009-12-02T14:57:31.227

Reputation: 12 423

0

You could use NetProfiles to run a batch script every time your 192.168.0.x connection is activated. Of course, the script being your route delete command:

route delete 0.0.0.0 mask 0.0.0.0 10.0.0.1

other features of NetProfiles:

  • Save your network settings as profiles.
  • Automatically activate wireless profiles when specified wireless connections are detected. (XP only)
  • Change IP Address, Subnet Mask, Default Gateway, Primary and Secondary DNS Servers, WINS
    • Server, and DHCP settings with the click of a button.
  • Specifiy different mapped drives for each profile.
  • Change your default printer based on which profile you're currently using.
  • Automatically change your profile via program shortcuts created with Net Profiles.
  • Change the default homepage for Internet Explorer, Firefox, and Opera.

  • Proxy settings for Internet Explorer, Firefox, and Opera.

  • Run a user-defined list of programs when a profile is activated.
  • Maintain seperate desktop wallper for each profile.
  • Change screen resolutions and color quality when profiles are activated.
  • Can be easily translated into other languages using the enclosed XML language file.

John T

Posted 2009-12-02T14:57:31.227

Reputation: 149 037

0

Using the interface metric option is the best method. The routes will still show 2 gateways. But the metric forces the usage of one over the other. I have a similar setup and it works perfectly. It would not route correctly earlier.

indigozebra

Posted 2009-12-02T14:57:31.227

Reputation: 1