How does the algorithm for dns names work?

Asked by Gerrit Hohl

polygraph-dns-cfg creates bind files for the domain name server. How does the algorithm work that creates these names in this files?

I have the following address space for my 'servers':

server_side.addr_space = [ 'lo::10.5.128-251.1-250:80/22' ];

which results in the following names:

w1001.h1128o1005s1010 IN A 10.5.128.1
w1002.h1129o1005s1010 IN A 10.5.128.2
w1003.h1139o1005s1010 IN A 10.5.128.3
w1004.h1128o1005s1010 IN A 10.5.128.4
[...]
w1249.h1130o1005s1010 IN A 10.5.130.247
w1250.h1128o1005s1010 IN A 10.5.130.248
w1250.h1129o1005s1010 IN A 10.5.130.249
w1250.h1130o1005s1010 IN A 10.5.130.250

So I assume that the w-number is just sequential number. The h-number just iterates through the C-part of the address space. In my case I have 750 servers so web-polygraph needs the 128, 129 and 130 range. the o-number ist the B-part of the address space and the s-number is the A-part.

Is this right?

Question information

Language:
English Edit question
Status:
Answered
For:
Polygraph Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Dmitry Kurochkin (dmitry.kurochkin) said :
#1

The polygraph-dns-cfg(1) tool does not generate any domain names itself. It just uses the names specified in the PGL AddrMap object and prints it in a format suitable for BIND configuration.

You may be using ipsToNames() PGL function to generate unique domain names for a list of IP addresses. This function is documented at [1]. I suppose that you are using ipsToNames in the simple non-template mode (which will be depricated in favor of templates BTW). In this mode the algorithm is the following:

  w(1000 + IP-octet-4).h(1000 + IP-octet-3)o(1000 + IP-octet-2)s(1000 + IP-octet-1).(zone)

This algorithm is hard-coded and may change without a notice. The only assumption you should make about the generated names is that they are unique for each address. If you need to control the generated names format, you should provide a template as the second parameter to ipsToNames function (see documentation [1] for details).

[1] http://www.web-polygraph.org/docs/reference/pgl/calls.html

Revision history for this message
Gerrit Hohl (g-hohl) said :
#2

Oh, I mean that. :-)

Yes, I do. But isn't that somehow odd? From the template you mentioned I would expect a list like that:

w1001.h1128o1005s1010 IN A 10.5.128.1
w1002.h1128o1005s1010 IN A 10.5.128.2
w1003.h1128o1005s1010 IN A 10.5.128.3
w1004.h1128o1005s1010 IN A 10.5.128.4
[...]
w1247.h1130o1005s1010 IN A 10.5.130.247
w1248.h1130o1005s1010 IN A 10.5.130.248
w1249.h1130o1005s1010 IN A 10.5.130.249
w1250.h1130o1005s1010 IN A 10.5.130.250

But is obvious that this is not the case:

w1001.h1128o1005s1010 IN A 10.5.128.1
w1002.h1129o1005s1010 IN A 10.5.128.2
w1003.h1139o1005s1010 IN A 10.5.128.3
w1004.h1128o1005s1010 IN A 10.5.128.4
[...]
w1249.h1130o1005s1010 IN A 10.5.130.247
w1250.h1128o1005s1010 IN A 10.5.130.248
w1250.h1129o1005s1010 IN A 10.5.130.249
w1250.h1130o1005s1010 IN A 10.5.130.250

So was the algorithm already changed? :-?

I will try the approach by defining an own template - also it is very limited as the only alternative at the moment is a 'dashed_ip' format.

Revision history for this message
Dmitry Kurochkin (dmitry.kurochkin) said :
#3

That looks like a (minor) bug related to how Polygraph expands ranges internally. I have opened a ticket for it [1]. The issue is minor because you still get the list of valid unique domain names for each IP. So while the matching is weird indeed, you still get a valid configuration. If you need ipsToNames() to generate predictable domain names, please use the templates.

I do not see any reasons for introducing more formats in addition to dashed_ip. But if there is a need for it, we can discuss it and find a proper solution.

[1] https://bugs.launchpad.net/polygraph/+bug/901731

Can you help with this problem?

Provide an answer of your own, or ask Gerrit Hohl for more information if necessary.

To post a message you must log in.