sortlist usage

Drunkard Zhang gongfan193 at gmail.com
Tue Jun 19 03:15:42 UTC 2012


I‘m working for a China ISP, with a very complex network arch. One of
these complex things is the CDN of ICP returned a bunch of IP
addresses, which distributed in geographically varies, and some IP
addresses located way far from us. So I want do some "sortlist" which
sorts the IP addresses by geographical distance, not considering
latency and CDN peer's load now.

>From ARM 9.9, I get this example:

sortlist {
// IF the local host
// THEN first fit on the following nets
{ localhost;
{ localnets;
192.168.1/24;
{ 192.168.2/24; 192.168.3/24; }; }; };
// IF on class C 192.168.1 THEN use .1, or .2 or .3
{ 192.168.1/24;
{ 192.168.1/24;
{ 192.168.2/24; 192.168.3/24; }; }; };
// IF on class C 192.168.2 THEN use .2, or .1 or .3
{ 192.168.2/24;
{ 192.168.2/24;
{ 192.168.1/24; 192.168.3/24; }; }; };
// IF on class C 192.168.3 THEN use .3, or .1 or .2
{ 192.168.3/24;
{ 192.168.3/24;
{ 192.168.1/24; 192.168.2/24; }; }; };
// IF .4 or .5 THEN prefer that net
{ { 192.168.4/24; 192.168.5/24; };
};
};

Here's my understanding after some testing:
1st level of brace matches client's IP addresses;
2nd level of brace matches IP in rrset data;
3rd, what's this level used for? Is it just ordering behind 2nd? When
I added 3rd level of address_match_list, the ordering of rrset just
failed.

By testing, I found that the 1st level of entry can only be one IP
range or acl name, sort will fail while 1st level is more than one
address_match_list. Is this intended or I missed something?

BTW, is 4th or 5th or 6... level of address_match_list supported?

Another thing related: can I use sortlist for determining which
upstream DNS server to query?

Here's one testing domain name I used:
11:11:21 ~ $ dig +short @220.115.251.73 s.kaixin001.com.cn
s.kaixin001.com.cn.lxdns.com.
s.kaixin001.z.lxdns.com.
kx.xdwscache.glb0.lxdns.com.
124.14.10.17
124.14.10.25
124.14.10.18
121.251.53.95
58.22.135.38

The first 3 IPs located locally, 121.251.53.95 located in Anhui, and
58.22.135.38 located in Fuzhou, Fujian. The first 3 IPs returned
cyclicly, 4th and 5th IP are fixed.



More information about the bind-users mailing list