Discussion Locked

How to setup two gateways in one subnet?

0 helpful
17 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I have two routers, the first one serves as a internet gateway with internal ip address 192.168.0.1/255.255.255.0 and public ip 203.120.224.160. And the other router used as a backup internet gateway with internal ip 192.168.0.2 with a different public ip. Our goal is for all PC's in the same subnet to be able to use the second gateway automatically when the first gateway (link) fails.

If I manually change the defaul gateway to the second one it works fine. But I want it to do it automatically, is it a way to get it done?

17 replies

by cg it

that's kinda a special software program [active polling]where the link state of the primary router is polled for connectivity by the secondary router. If the link state changes, then the secondary router would kick in.

by andrew.mizzi

I agree with the DR. It is software driven and can't be done 'normally' on workstations. Maybe look at getting one of your servers to do it.

by acattr

you can get an aggregator that will allow you to use both lines, if one goes down users wont notice.

http://www.astrocorp.com

If you don't want to spend the money, you can create a simple logon script or (startup script in AD Group Policies) that will change the computer's default gateway.

"route change 0.0.0.0 mask 0.0.0.0 192.168.0.2"

by danny_chen

I can use script to change the default gateway, but it won't do the auto detection for the dead gateway.

by leehellcat

I am guessing that your clients all point directly at the router.
You may be able to point the clients at a server, which in turn points to one of the 2 routers.
Then write a short VBA program to poll the first router and if it goes down, then swap to the second router.

by beermonster

Hi,
You give no idea of what clients you have, if they are microsoft, this functionality should come as standard. To get more info, search for

"dead gateway detection"

in Technet. You can find it online too at

microsoft.com/technet

Hope this helps...

by colin p. mcnamara

Border Gateway Protocol
This is the protocol that is used by EVERY provider that participates in the internet. On request your provider can configure your internet links to participate in whats called an Autonomous System. Effectively the provider will distribute a routes to you (including your default route). You take this information, and either a preference (making one provider primary, and another secondary). In this case, if the connection to 1 provider fails, then the route that they areproviding will go down, and automaticaly switch to the secondary path.

Cheers,
Colin McNamara

by shmaltz

Here is the answer:
On Winnt/2K/XP clients you can define 2 Default gateways on each comptuter, and assign a different metric to each gateway (the one with the lower gateway is always used, unless there is a problem). Windows will detect that the first gateway (the one with the lower metric) doesn't work and will reroute all traffic to use the seconde gateway. In the above OS you add the second gateway by typing it in the advanced IP Properties.
In windows 9x i'm not sure if it can be done thru the Interface, but the add route command will work in your case it will be:
route add 0.0.0.0 MASK 255.255.255.255 192.168.0.2 METRIC 2
You can add the p switch so it you don't have to reenter it every time you restart the machine.

by shmaltz

The following is from the Windows 2000 Resource Kit. It explains how windows detects a gateway that doesn't work anymore, and how it will use the new gateway:
Dead Gateway Detection
Dead gateway detection is used by TCP traffic to detect the failure of the default gateway and to make an adjustment to the IP routing table to use another default gateway. Windows 2000 TCP/IP uses the triggered reselection method described in RFC 816, with slight modifications.

When any TCP connection that is routed through the default gateway has attempted to send a TCP packet to the destination a number of times equal to one-half of the value of the registry entry TcpMaxDataRetransmissions (default value of 5) without receiving a response, the forwarding IP address for the Destination IP Address is changed to use the next default gateway in the list. When 25 percent of the TCP connections have moved to the next default gateway, TCP informs IP to update the default route for the IP address of the next default gateway, the one that the changed connections are now using.

For example, assume that for a host:

There are TCP connections to 11 different IP addresses that are routed through the default gateway.
The host has multiple default gateways configured.
TcpMaxDataRetransmissions is set at the default value of 5.
When the default gateway fails, the following process switches the default gateway to the next one in the list:

Continuied.....

by shmaltz

....

When the first TCP connection tries to send data, it does not receive any acknowledgments. After the third retransmission, the forwarding IP address for that remote IP address is switched to use the next default gateway in the list. At this point, any TCP connections to that remote IP address are switched over to the new default gateway, but the remaining connections will still try to use the original default gateway.
When the second TCP connection tries to send data, the same thing happens. Now, two of the 11 connections are using the new gateway.
When the third TCP connection tries to send data, its default gateway is changed to the next default gateway in the list. Three of 11 connections have been switched to the second default gateway. Because over 25 percent of the connections have been changed, the Gateway IP address for the default route in the routing table is updated with the IP address of the new gateway.
The new default gateway remains the primary one for thecomputer until it experiences problems, causing dead gateway detection to switch to the next gateway in the list again, or until the computer is restarted.
When the search reaches the last default gateway, it returns to the beginning of the list.

This discussion is closed to new replies.