2

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!

joelschmid
  • 177
  • 2
  • 11
  • 3
    What do you mean by "less number of hops"? Gateway is **always** located in the same subnet as the host. – Somescout Nov 06 '14 at 14:42
  • 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? – joelschmid Nov 06 '14 at 14:46
  • A default gateway is in the same subnet as the hosts that it is the default gateway for. So no `hops` are involved in reaching the default gateway. I suppose what you're looking to do is to assign multiple default gateways via DHCP so that the Windows clients will "fail over" to the second default gateway if the first default gateway is down via Dead Gateway Detection. – joeqwerty Nov 06 '14 at 14:47
  • 6
    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. – joeqwerty Nov 06 '14 at 14:48
  • 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). – Somescout Nov 06 '14 at 14:49
  • 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 :-) – joelschmid Nov 06 '14 at 14:50
  • 2
    `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. – joeqwerty Nov 06 '14 at 14:52
  • 3
    As @joeqwerty mentioned, it is important to note that switches have nothing to do with the routing. If you are just looking into the most efficient path at the switching level, look into implementing STP;; but be clear that it will work independently of any routing functions. – Get-HomeByFiveOClock Nov 06 '14 at 14:53
  • 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? – joelschmid Nov 06 '14 at 14:57
  • 1
    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). – Somescout Nov 06 '14 at 15:01
  • Meaning having one subnet with different gateways is not possible? – joelschmid Nov 06 '14 at 15:02
  • 1
    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 :) – Somescout Nov 06 '14 at 15:06
  • 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 Nov 07 '14 at 01:33
  • @desperado I expanded my answer to give you more information to consider regarding reasons to use routers in your situation. – I say Reinstate Monica Nov 08 '14 at 20:47

2 Answers2

2

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.

joeqwerty
  • 109,901
  • 6
  • 81
  • 172
  • 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? – I say Reinstate Monica Nov 07 '14 at 02:16
  • Yes. That's basically what I said in my answer. – joeqwerty Nov 07 '14 at 05:10
  • 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. – JustAGuy Oct 12 '15 at 11:37
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.
I say Reinstate Monica
  • 3,132
  • 7
  • 28
  • 52