Here’s my situation: I have two machines connected via small home LAN. The one I use most interactively (runs Windows 2000) has two network cards - one to connect to the hub for my LAN, the other to my cable modem for Internet access.
Most of the time, everything works great.
What is happening is that every now and then (not sure exactly at what point), Windows takes it upon itself to add a default route (0.0.0.0) for the LAN network card. (I see this by doing a ‘route print’ from Command Prompt)
This prevents me from getting to the Internet (presumably because my computer is then trying to look on my local LAN for http://www.straightdope.com etc ?)
When I delete this automatically added default route, I can again see the Internet.
I only want to have a single default route (I think) for the Internet card - why does Windows keep adding back this other default route for the LAN? Is there any way to stop it, or better, what is the correct way to set up my route table for this situation?
I would try configuring the cards the opposite way. Basically make the LAN card the cable modem card and vice-versa. Windows is probably setting the default route to the first card it finds on the PCI bus.
Do you have a default gateway IP address set for your LAN card? If so, remove it from your TCP/IP settings for your LAN card. The only gateway entry you should have is the gateway for your 'Net connection (on the card dedicated to your 'Net connection, of course).
c_goat - great idea, I hadn’t thought of that. I changed the binding order (under "Network and dial-up connections|Advanced|Advanced settings|Adapters and bindings) so that the external card appears first. I’ll see what happens next time Win2k adds the default route back. If this works it’ll be a great solution - I can just add static routes for the other computers on the LAN.
Caldazar - there is no default gateway for the LAN card, only for the external IP. This jogged my memory - I thought I remembered reading long ago somewhere that Windows does this annoying thing of adding default routes when you have a default gateway specified for a NIC. But that is not the case here. Thanks anyway.
you can also try the ‘route’ command.
Try something like this from the command prompt:
route -f -p add 0.0.0.0 <gateway ip address> MASK 0.0.0.0 METRIC 1 IF 1
Which roughly means , clear the default routes, make this entry permanent, send all external traffic to <gateway ip address> and use interface 1. Your external card might be interface number 2 though, The command ‘route print’ lists your interfaces and routes.
Arrgh - I changed the binding order and my computer still can’t see the Internet, even when the external NIC appears first in the ‘route’ table.
micilin - thanks for the info. I do know the ‘route’ command (see my OP) but never really haved used the “metric” or “if” parameters. I tried what you said, and could only get it to work by leaving off the “IF” parameter; if I specify an “IF” (tried 0,1 and 2) I get
“The route addition failed: Either the interface index is wrong or the gateway does not lie on the same network as the interface. Check the IP Address Table for the machine.”
It works just fine without the IF, but then I’m back to where I started - Windows will just add another default route at some point (when I reboot?)