You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Ntk_SNSD 7.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. == NTK_RFC 0009 ==
  2. Subject: Scattered Name Service Disgregation
  3. ----
  4. This text describes the Scattered Name Service Disgregation, an extension of
  5. the ANDNA protocol.
  6. It will be included in the final documentation, so feel free to correct it.
  7. But if you want to change the system here described, please contact us first.
  8. ----
  9. == SNSD ==
  10. The Scattered Name Service Disgregation is the ANDNA equivalent of the
  11. SRV Record of the Internet Domain Name System, which is defined here:
  12. http://www.ietf.org/rfc/rfc2782.txt
  13. For a brief explanation you can read:
  14. http://en.wikipedia.org/wiki/SRV_record
  15. SNSD isn't the same of the "SRV Record", in fact, it has its own unique
  16. features.
  17. With the SNSD it is possible to associate IPs and hostnames to another
  18. hostname.
  19. Each assigned record has a service number, in this way the IPs and hostnames
  20. which have the same service number are grouped in an array.
  21. In the resolution request the client will specify the service number too,
  22. therefore it will get the record of the specified service number which is
  23. associated to the hostname. Example:
  24. The node X has registered the hostname "angelica".
  25. The default IP of "angelica" is 1.2.3.4.
  26. X associates the "depausceve" hostname to the `http' service number (80) of
  27. "angelica".
  28. X associates the "11.22.33.44" IP to the `ftp' service number (21) of
  29. "angelica".
  30. When the node Y resolves normally "angelica", it gets 1.2.3.4, but when
  31. its web browser tries to resolve it, it asks for the record associated to
  32. the `http' service, therefore the resolution will return "depausceve".
  33. The browser will resolve "depausceve" and will finally contact the server.
  34. When the ftp client of Y will try to resolve "angelica", it will get the
  35. "11.22.33.44" IP.
  36. If Y tries to resolve a service which hasn't been associated to anything, it
  37. will get the mainip 1.2.3.4.
  38. The node associated to a SNSD record is called "SNSD node". In this example
  39. "depausceve" and 11.22.33.44 are SNSD nodes.
  40. The node which registers the records and keeps the registration of the main
  41. hostname is always called "register node", but it can also be named "Zero SNSD
  42. node", in fact, it corresponds to the most general SNSD record: the service
  43. number 0.
  44. Note that with the SNSD, the NTK_RFC 0004 will be completely deprecated.
  45. == Service, priority and weight number ==
  46. ==== Service number ====
  47. The service number specifies the scope of a SNSD record. The IP associated to
  48. the service number `x' will be returned only to a resolution request which has
  49. the same service number.
  50. A service number is the port number of a specific service. The port of the
  51. service can be retrieved from /etc/services.
  52. The service number 0 corresponds to a normal ANDNA record. The relative IP
  53. will be returned to a general resolution request.
  54. ==== Priority ====
  55. The SNSD record has also a priority number. This number specifies the priority
  56. of the record inside its service array.
  57. The client will contact first the SNSD nodes which have the higher priority,
  58. and only if they are unreachable, it will try to contact the other nodes
  59. which have a lower priority.
  60. ==== Weight ===
  61. The weight number, associated to each SNSD record, is used when there are
  62. more than one records which have the same priority number.
  63. In this case, this is how the client chooses which record using to contact
  64. the servers:
  65. The client asks ANDNA the resolution request and it gets, for example, 8
  66. different records.
  67. The first record which will be used by the client is chosen in a pseudo-random
  68. manner: each record has a probability to be picked, which is proportional to its
  69. weight number, therefore the records with the heavier weight are more likely to
  70. be picked.
  71. Note that if the records have the same priority, then the choice is completely
  72. random.
  73. It is also possible to use a weight equal to zero to disable a record.
  74. The weight number has to be less than 128.
  75. == SNSD Registration ==
  76. The registration method of a SNSD record is similar to that described in the
  77. NTK_RFC 0004.
  78. It is possible to associate up to 16 records to a single service.
  79. The maximum number of total records which can be registered is 256.
  80. The registration of the SNSD records is performed by the same register_node.
  81. The hash_node which receives the registration won't contact the counter_node,
  82. because the hostname is already registered and it doesn't need to verify
  83. anything about it. It has only to check the validity of the signature.
  84. The register node can also choose to use an optional SNSD feature to be sure
  85. that a SNSD hostname is always associated to its trusted machine. In this
  86. case, the register_node needs the ANDNA pubkey of the SNSD node to send a
  87. periodical challenge to the node.
  88. If the node fails to reply, the register_node will send to ANDNA a delete
  89. request for the relative SNSD record.
  90. The registration of SNSD records of hostnames which are only queued in the
  91. andna_queue is discarded.
  92. Practically, the steps necessary to register a SNSD record are:
  93. * Modify the /etc/netsukuku/snsd_nodes file.
  94. {{{
  95. register_node# cd /etc/netsukuku/
  96. register_node# cat snsd_nodes
  97. #
  98. # SNSD nodes file
  99. #
  100. # The format is:
  101. # hostname:snsd_hostname:service:priority:weight[:pub_key_file]
  102. # or
  103. # hostname:snsd_ip:service:priority:weight[:pub_key_file]
  104. #
  105. # The `pub_key_file' parameter is optional. If you specify it, NetsukukuD will
  106. # check periodically `snsd_hostname' and it will verify if it is always the
  107. # same machine. If it isn't, the relative snsd will be deleted.
  108. #
  109. depausceve:pippo:http:1
  110. depausceve:1.2.3.4:21:0
  111. angelica:frenzu:ssh:1:/etc/netsukuku/snsd/frenzu.pubk
  112. register_node#
  113. register_node# scp frenzu:/usr/share/andna_lcl_keyring snsd/frenzu.pubk
  114. }}}
  115. * Send a SIGHUP to the NetsukukuD of the register node:
  116. {{{
  117. register_node# killall -HUP ntkd
  118. # or, alternatively
  119. register_node# rc.ntk reload
  120. }}}
  121. ==== Zero SNSD IP ====
  122. The main IP associated to a normal hostname has these default values:
  123. {{{
  124. IP = register_node IP # This value can't be changed
  125. service = 0
  126. priority = 16
  127. weight = 1
  128. }}}
  129. It is possible to associate other SNSD records in the service 0, but it isn't
  130. allowed to change the main IP. The main IP can only be the IP of the
  131. register_node.
  132. Although it isn't possible to set a different association for the main IP, it
  133. can be disabled by setting its weight number to 0.
  134. The string used to change the priority and weight value of the main IP is:
  135. {{{
  136. hostname:hostname:0:priority:weight
  137. # For example:
  138. register_node# echo depausceve:depausceve:0:23:12 >> /etc/netsukuku/snsd_nodes
  139. }}}
  140. ==== SNSD chain ====
  141. Since it is possible to assign different aliases and backup IPs to the zero
  142. record, there is the possibility to create a SNSD chain.
  143. For example:
  144. {{{
  145. depausceve registers: depausceve:80 --> pippo
  146. pippo registers: pippo:0 --> frenzu
  147. frenzu registers: frenzu:0 --> angelica
  148. }}}
  149. However the SNSD chains are ignored, only the first resolution is considered
  150. valid. Since in the zero service there's always the main IP, the resolution is
  151. always performed.
  152. In this case ("depausceve:80 --> pippo:0") the resolution will return the main
  153. IP of "pippo:0".
  154. The reply to a resolution request of service zero, returns always IPs and not
  155. hostnames.
  156. ----
  157. related: ["Netsukuku RFC"]