Windows Server set multiple Gateways and metrics

6,425

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:

  1. Faster Internet. You'll take advantage of the aggregate bandwidth of both of your Internet connections, not just one.
  2. 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.
  3. 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.
  4. 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.
  5. No double work. You'll end up using routers anyway if you have problems assigning hosts two gateways.
Share:
6,425

Related videos on Youtube

joelschmid
Author by

joelschmid

IT Consultant and WebDeveloper at https://webbee.ch

Updated on September 18, 2022

Comments

  • joelschmid
    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):

    Advance IP Settings

    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.

    DHCP Settings - Router

    How can I configure my DHCP Server so that it works like described in the first image? Network Thank you in advance for your help!

    • Somescout
      Somescout over 9 years
      What do you mean by "less number of hops"? Gateway is always located in the same subnet as the host.
    • joelschmid
      joelschmid over 9 years
      sure, 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
      joeqwerty over 9 years
      Switches 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
      Somescout over 9 years
      From 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
      joelschmid over 9 years
      No, 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
      joeqwerty over 9 years
      1. Each set of hosts on each side 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
      joelschmid over 9 years
      Please 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
      Somescout over 9 years
      If 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
      joelschmid over 9 years
      Meaning having one subnet with different gateways is not possible?
    • Somescout
      Somescout over 9 years
      Only 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
      I say Reinstate Monica over 9 years
      It 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
      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
    I say Reinstate Monica over 9 years
    Correct 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
    joeqwerty over 9 years
    Yes. That's basically what I said in my answer.
  • JustAGuy
    JustAGuy over 8 years
    If 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.