2012/6/19 Drunkard Zhang <gongfan...@gmail.com>: > 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.
I think there's some trick not mentioned in ARM, like: * The 1st level of brace can only be ONE element, address_match_list. bind won't deal with more than one address_match_list; * You can define more than 2 level of braces, but only configurations within 2 level actived, others are ignored; * Misswrite of sortlist config can not be detected, it just failed; So you can write anything you like with following format: sortlist { { acl-client; { acl-client; acl-local-city; acl-local-province; acl-local-contry; ...other-acls; }; }; configurations out of this frame won't work. Am I right? _______________________________________________ Please visit https://lists.isc.org/mailman/listinfo/bind-users to unsubscribe from this list bind-users mailing list bind-users@lists.isc.org https://lists.isc.org/mailman/listinfo/bind-users