NIC1 "steals" the default gateway of NIC2

Biggs

Diamond Member
Dec 18, 2000
3,010
0
0
I have a Win2K server with 2 NICs, 1 is a public for the DSL and the other is for the private lan. Sometimes, the clients on the lan loses their internet connection. When I use the "route print" command on the server, the default gateway is set to the private network's thus halting any traffic out to the Internet. Is there a way to disable the automatic "stealing" of the default gateway of the private network? Many thanks.
 

Santa

Golden Member
Oct 11, 1999
1,168
0
0
Are you using some sort of Internet Sharing application to share the internet?

If not just having the system be multihomed is not as straight forward and theoretically unless you setup the route table to indicate which packets go where you could potentially lose a gateway because both NICs have equal cost in terms of default route.

Let us know more of your setup. There is no "auto stealing" option to turn on or off but when things are of equal cost on a Windows box it tends to get tricky because Windows was never meant to automatically know how to act like a router.
 

MysticLlama

Golden Member
Sep 19, 2000
1,003
0
0
This is one of the not so well documented things in Windows that can drive someone bonkers.

I fought with it for a long time before I finally figured out what was going on.

The "default gateway" is for all adapters on the system even though each adapter has a field for it. I'm not sure how it actually picks which one to use when you put in two different ones, because I've had it pick the first one I added or the second or NIC 1 or 2, so I don't know what the criteria is.

The best way to do it is to set up the default gateway to be your WAN address, this way any traffic that doesn't match the internal network goes there.

Then for internal you need to add a route statement to match the traffic and send it to the correct NIC.

An example would be "route add 192.168.0.0 mask 255.255.255.0 192.168.0.1 -p"

That way it keeps it across restarts as well.

Try that out and see how it works.
 

Biggs

Diamond Member
Dec 18, 2000
3,010
0
0
Here's the "route print" result on the winproxy server,

Active Routes:
Network Destination Netmask Gateway Interface Metric
0.0.0.0 0.0.0.0 x.x.x.121 x.x.x.122 1
0.0.0.0 0.0.0.0 90.0.0.1 90.0.0.1 1
x.x.x.120 255.255.255.252 x.x.x.122 x.x.x.122 1
x.x.x.122 255.255.255.255 127.0.0.1 127.0.0.1 1
x.255.255.255 255.255.255.255 x.x.x.122 x.x.x.122 1
90.0.0.0 255.255.255.0 90.0.0.1 90.0.0.1 1
90.0.0.1 255.255.255.255 127.0.0.1 127.0.0.1 1
90.255.255.255 255.255.255.255 90.0.0.1 90.0.0.1 1
127.0.0.0 255.0.0.0 127.0.0.1 127.0.0.1 1
224.0.0.0 224.0.0.0 x.x.x.122 x.x.x.122 1
224.0.0.0 224.0.0.0 90.0.0.1 90.0.0.1 1
255.255.255.255 255.255.255.255 x.x.x.122 x.x.x.122 1
Default Gateway: x.x.x.121
===========================================================================
Persistent Routes:
Network Address Netmask Gateway Address Metric
90.0.0.0 255.255.255.0 90.0.0.1 1




IPCONFIG:
NIC1 (connects to the DSL)
DHCP Enabled: No
IP Address x.x.x.122
Subnet Mask: 255.255.255.252
Default Gateway: x.x.x.121
DNS Servers: 12.127.17.83 and 12.127.16.83

NIC2 (proxy server)
DHCP Enabled: No
IP Address 90.0.0.1
Subnet Mask: 255.255.255.0
Default Gateway: 90.0.0.1
DNS Servers: 12.127.17.83


Basically, after about an hour or continous ftp uploads/downloads, this server and all the proxy clients suddenly stop working. When I do a route print, the results above are the same EXCEPT that the default gateway now is 90.0.0.1! I need to disable then reenable NIC2 to "restore" the default gateway back to x.x.x.121. The last entry (persistent route) is a recent entry I added. However, the same problem still happens after an hour or so. I'm now thinking of changing the persistent route's metric to 2...

Thanks.
 

Saltin

Platinum Member
Jul 21, 2001
2,175
0
0
A machine with more than one NIC should never have more than one Default Gateway defined.
In your case, the NIC facing the net would have the DG, as it's the way out of your private subnet.

That's what a Default Gateway is! It's the way out. Why would your LAN NIC need a DG?
 

mobly99

Senior member
Apr 27, 2001
260
0
0
There are legitimate cases where you could want 2 default gateways (i.e. if one link goes down, use the other)
Best way to handle that would be to assign a higher interface metric to the secondary (less desired default gateway) NIC.
 

Nothinman

Elite Member
Sep 14, 2001
30,672
0
0
There are legitimate cases where you could want 2 default gateways (i.e. if one link goes down, use the other)

But you still can only have 1 'default' gateway at any one time. If you need a fail-over thing like that you either need 2 routers setup in a redundant fashion or dynamic routing software installed on the client that will change the routing tables when one link goes away.
 

mobly99

Senior member
Apr 27, 2001
260
0
0
Originally posted by: Nothinman

But you still can only have 1 'default' gateway at any one time. If you need a fail-over thing like that you either need 2 routers setup in a redundant fashion or dynamic routing software installed on the client that will change the routing tables when one link goes away.

No, you can most definately have 2 default routes at once.

Consider the below - Configure interface metric on Nic 1 to be 1, add default gateway pointing to FE0/0, lets say FE0/0 is 192.168.1.254. Configure interface metric on Nic 2 to be 2, add default gateway pointing to FE1/0, lets say FE1/0 is 192.168.2.254.

           FE0/0-----SW1------Nic1
Router|                                    |win2K box
          FE1/0-----SW2------Nic2

Your routing table on the win2K box would look like:
Network Destination Netmask Gateway Interface Metric
0.0.0.0 0.0.0.0 192.168.1.254 192.168.1.1 1
0.0.0.0 0.0.0.0 192.168.2.254 192.168.2.1 2

Now, all traffic is going out via NIC1. If your cable for NIC1 gets cut, disconnected, SW1 dies, etc - your link goes down for Nic1 and your routing table gets modified when the interface goes down. It would now look like the below and all traffic would be going out NIC 2 to your second default gateway:
Network Destination Netmask Gateway Interface Metric
0.0.0.0 0.0.0.0 192.168.2.254 192.168.2.1 2


Beyond this, even on a single interface, you can have 2 default gateways, Win2K does support dead gateway detection for TCP. Not a great solution as UDP won't fail, and there is no mechanism to go back to the primary when it comes back up

dead gateway detection reference

-Dave

edit- attempt at a diagram sucked