Windows Server set multiple Gateways and metrics
Solution 1
OK. So you want all of the traffic to go out the closest gateway, but you can't get there from here. It's all the same layer 2/3 network so there's no way to prioritize
the gateways so that clients use the closest one. If you use different subnets on each side then that presents the wrinkle of having to route traffic between the two subnets so you'd then need to throw a router in the mix, which would necessitate the need to turn the layer 2 connection into a layer 3 connection. IMO, leave it as it is. Define both gateways in DHCP using the DG that you prefer for the traffic to go through at the top of the list, knowing that clients on the other side have a longer trip.
Solution 2
The real question is how do I provide two routes to the Internet and ensure my hosts always use the fastest path to get there?
The case for routing. You have two locations, each with its own Internet connection. Hosts at each location are best served by using their site's route to the Internet. The two locations are also connected by a single link. This path allows hosts in site A talk to hosts in site B and vice-versa. It can also be leveraged to provide each site with an alternate route to the Internet (lucky you).
The proper way to configure this network is to put a router at each site, connect each site's Internet connection to its respective router, and then connect the two routers via the existing site-to-site link.
How it works. Each site needs its own subnetwork address, but each site's hosts will always use their location's route to the Internet, and when a site's Internet connection fails, the routers do their job and begin routing traffic to the other site's router which in turn forwards it to the Internet.
Is this worth all the trouble? Yes, for several reasons:
- Faster Internet. You'll take advantage of the aggregate bandwidth of both of your Internet connections, not just one.
- Faster site-to-site link. Your location-to-location link won't be used by one site's hosts for Internet traffic, freeing up the bandwidth for other uses.
- Less failover delay. If a host is configured with two gateways and the one in use goes down, the client will experience a delay before trying the other gateway. The potential for this to continue exists as long as the gateway is down. Moving the failover responsibility to the router consolidates this delay into a single point in time, and once it's done, it's done.
- Host compatibility. Some hosts won't let you configure multiple gateways. If the one they're using fails, that host can't access the Internet until the gateway comes back up or you re-configure the host.
- No double work. You'll end up using routers anyway if you have problems assigning hosts two gateways.
Related videos on Youtube
![joelschmid](https://i.stack.imgur.com/9ZTat.jpg?s=256&g=1)
joelschmid
IT Consultant and WebDeveloper at https://webbee.ch
Updated on September 18, 2022Comments
-
joelschmid almost 2 years
I would like to configure my DHCP Server (Windows Server 2008 R2) so that it assigns to each host two gateways. The client should use the gateway which is closer (less number of hops). I can do this manually on the client itself by setting the 'automatic metric' (see print-screen):
But on the DHCP server if I define the router in the Scope-Settings it will use Gateway depending on the priority which is given by the position in the settings.
How can I configure my DHCP Server so that it works like described in the first image?
Thank you in advance for your help!
-
Somescout over 9 yearsWhat do you mean by "less number of hops"? Gateway is always located in the same subnet as the host.
-
joelschmid over 9 yearssure, but there are some switches in between. Meaning the client should choose the gateway which has less switches between him and the gateway. Isn't that what the metrics is all about?
-
joeqwerty over 9 yearsSwitches don't decrement the TTL as they aren't routing the traffic, they're switching the traffic. The network hosts don't even know that the switches exist, so no "hops" are involved.
-
Somescout over 9 yearsFrom the point of Ethernet networking switches are "transparent": client generally can't tell difference between direct connected cable and few switches in path. Windows can automatically assign metrics to routes, but as far as I know it based on interface characteristics (i.e. multiple gateways on same interface should get same metric).
-
joelschmid over 9 yearsNo, our provider is creating a layer 2 connection between two location. Both locations will have the same IP Address but an other gateway so that if the connection of the provider crashes both locations can still go to the internet. I'll make a drawing - give me 5 :-)
-
joeqwerty over 9 years
1.
Each set of hosts on eachside
would still only have one default gateway.2.
If the provider is connecting the two locations at layer 2 then again, no "hops" are involved. -
joelschmid over 9 yearsPlease consider the image added above. How can I manage it that both locations in the same dhcp subnet can use different gateways? If this is not possible, how can I create two subnets in the same network?
-
Somescout over 9 yearsIf hosts located at considerable distance it may be a good idea to separate them to different subnets. Still, if you really want it, you can try using DHCP Option 82 (dhcp relay option).
-
joelschmid over 9 yearsMeaning having one subnet with different gateways is not possible?
-
Somescout over 9 yearsOnly as failover. You can also use router failover protocol: VRRP, or Cisco's GLBP (which can automatically balance traffic between multiple routers). Or, again, option 82 is always available for brave people :)
-
I say Reinstate Monica over 9 yearsIt seems to meet like both locations should have a router and a link to the other location and the Internet. If either location's Internet connection failed, the router should start pushing all traffic over the link to the other location to get it to the Internet. This becomes even more helpful if the existing link between the two locations is congested (or low-bandwidth). Designed this way, Internet traffic never goes over the site-to-site link to get to the Internet unless there's no other route available.
-
I say Reinstate Monica over 9 years@desperado I expanded my answer to give you more information to consider regarding reasons to use routers in your situation.
-
-
I say Reinstate Monica over 9 yearsCorrect me if I'm wrong, but done this way all hosts would access the Internet through only one of the gateways until that gateway failed. Wouldn't that leave one of the Internet connections quiet, wasting its available bandwidth?
-
joeqwerty over 9 yearsYes. That's basically what I said in my answer.
-
JustAGuy over 8 yearsIf you want to load balance your internet on 2 WAN connections then you should do this on your gateway rather than on the stations themselves.