Was brushing up about DFS referrals today as I had a doubt about something at work. Thought I’d put a shout out to this interesting link that I came across.
A DFS namespace (e.g.
\\contoso\pub) has links (e.g.
\\contoso\pub\documents). These links can point to multiple targets (e.g.
\\server2\documents, and so on). When a client visits the link the target that’s chosen is the one in the same AD site as the client. If there is no target in the same site as the client then one of three situation can happen (you have to choose what happens per namespace, but can override it per link):
- A list of targets from all sites is returned at random.
- A list of targets is returned based on cost.
- All sites in the domain will have a cost from the site the client is in. This cost is defined in “AD Sites & Services” and is cumulative (i.e. if Site A to Site B has cost 10, and Site B to Site C has cost 10, and there’s no explicit cost defined between Site A to Site C then the cost from Site A to Site C is taken as 10+10 = 20).
- Targets from sites closest to the client site are listed in random, followed by targets from sites further away from the client site, and so on.
- No targets are returned (this is also called in-site only).
- So if there are no targets in the same site as the client, then the path fails.
Apart from these three possibilities, there’s also a fail back (which is hidden behind the drop down in the screen shot above).
So if a server has no targets to offer a client, it will fail back to whatever targets are set as preferred for a link. I’ll show what preferred targets are in a bit.
The above settings can be defined on the namespace itself or on each DFS link.
Now on to preferred targets. If you go to the
Advanced tab of each target, you can set its priority. That is to say, if a target is on same preference level as a bunch of other targets (because they are all in the same site or not) then you can set it to have a higher or lower priority.
By default there are no preferred targets.
The cool thing I learnt from that post is that if the referral order is set to in-site (i.e. exclude targets from outside the client site) and fail back to preferred targets is enabled (the default) and a target outside the site is set as preferred, then it too will be returned in the list of targets along with the ones in site. This way you can limit referrals to be in-site but have a few selected targets out of site as a fail-back.
One thing to keep in mind though is that since you want the out of site target to be set to lower priority than the in-site one, you must specify its priority as “Last among all targets”. Because if it were set as “First among all targets” then it will take precedence over the in-site target too – which is not what we want. Lastly, there’s no point setting the priority to “First among targets of equal cost” (or “Last”) in the case of in-site referrals as it will have no effect (because the cost of the in-site target and the external targets are different so it doesn’t apply).