Sorting list of DC addresses by closest first

Richard Sharpe rsharpe at
Wed Apr 21 06:05:13 GMT 2004

On Tue, 20 Apr 2004, Christopher R. Hertel wrote:

> Richard Sharpe wrote:
> > 
> > Hi,
> > 
> > We are having a problem with our internal infrastructure and our attempts
> > to move to using Samba on our NAS to host internal CIFS usage.
> > 
> > We have offices in TX, PA, and CA, with DCs in each of those offices. The
> > PDC is in TX.
> > 
> > When we first tried to cut over to using Samba member servers, all
> > authentication traffic was going to TX, even in that from PA and CA.
> > 
> > It seems to me that when get_dc_list is called, the list should be sorted
> > with those addresses that are in the same subnets as the member server
> > first on the list (perhaps permuted each time if there is more than one)
> > and the remaining addresses next on the list, perhaps again permuted as
> > they are used.
> > 
> > Has anyone thought of the need for this behavior?
> I have considered it for other reasons.
> An important point, however, is that the the PDC is identified (in part) by
> the fact that it is the first in the list.  This is an annoying quirk of MS
> WINS behavior that Samba mimics.  When you send a domain<1C> query to an MS
> WINS server, the list of IPs returned has the PDC IP first and the rest of
> the <1C> IPs (registered by BDCs) are sorted by most-recently-renewed first.
> I don't know what it is that depends on this behavior, but it's only in the
> WINS response.  If you can sort the list on the receiving (client) end then
> you're golden.

Hmmm, nmblookup on sasafras#1c returns the following:

Got a positive name query response from ( ) sasafras<1c> sasafras<1c> sasafras<1c> sasafras<1c> sasafras<1c>

The funny thing is that, which is not the PDC, just a BDC, 
is closest to me.

This seems to be contrary to what you said.

Richard Sharpe, rsharpe[at], rsharpe[at], 

More information about the samba-technical mailing list