blob: 9520bed3d4ff67c5f9083b0c7cbc34056ab6fa54 [file] [log] [blame]
hilata6ee6e072014-04-20 17:10:18 -05001.. _ndn-autoconfig:
2
Alexander Afanasyev49272f72014-04-06 21:49:46 -07003ndn-autoconfig
4==============
5
hilata6ee6e072014-04-20 17:10:18 -05006Usage
7-----
Alexander Afanasyev49272f72014-04-06 21:49:46 -07008
9::
10
Alexander Afanasyev5c475972015-12-20 16:16:56 -080011 ndn-autoconfig [options]
Alexander Afanasyev49272f72014-04-06 21:49:46 -070012
hilata6ee6e072014-04-20 17:10:18 -050013Description
14-----------
15
16Client tool to run :ref:`NDN hub discovery procedure`.
17
Alexander Afanasyev5c475972015-12-20 16:16:56 -080018Options
19-------
20
Alexander Afanasyev5c475972015-12-20 16:16:56 -080021``-d`` or ``--daemon``
22 Run ndn-autoconfig in daemon mode, detecting network change events and re-running
23 auto-discovery procedure. In addition, the auto-discovery procedure is unconditionally
24 re-run every hour.
25
26 NOTE: if connection to NFD fails, the daemon will be terminated.
27
28``-c [FILE]`` or ``--config=[FILE]``
29 Use the specified configuration file. If `enabled = true` is not specified in the
30 configuration file, no actions will be performed.
31
Alexander Afanasyev2a001942016-12-14 18:18:41 -080032``--ndn-fch-url=[URL]``
33 Use the specified URL to find the closest hub (NDN-FCH protocol). If not specified,
34 ``http://ndn-fch.named-data.net`` will be used. Only ``http://`` URLs are supported.
35
Davide Pesavento59769b12017-11-12 23:52:06 -050036``-h`` or ``--help``
37 Print help message and exit.
38
Alexander Afanasyev5c475972015-12-20 16:16:56 -080039``-V`` or ``--version``
Davide Pesavento59769b12017-11-12 23:52:06 -050040 Show version information and exit.
Alexander Afanasyev5c475972015-12-20 16:16:56 -080041
hilata6ee6e072014-04-20 17:10:18 -050042.. _NDN hub discovery procedure:
Alexander Afanasyev49272f72014-04-06 21:49:46 -070043
44NDN hub discovery procedure
45---------------------------
46
hilata6ee6e072014-04-20 17:10:18 -050047When an end host starts up, or detects a change in its network environment, it MAY use
48this procedure to discover a local or home NDN router, in order to gain connectivity to
Eric Newberry81a9a862016-12-27 22:59:27 -070049`the NDN research testbed <https://named-data.net/ndn-testbed/>`_.
Alexander Afanasyev49272f72014-04-06 21:49:46 -070050
51Overview
52^^^^^^^^
53
Alexander Afanasyev2a001942016-12-14 18:18:41 -080054This procedure contains four methods to discover a NDN router:
Alexander Afanasyev49272f72014-04-06 21:49:46 -070055
561. Look for a local NDN router by multicast.
57 This is useful in a home or small office network.
58
592. Look for a local NDN router by DNS query with default suffix.
hilata6ee6e072014-04-20 17:10:18 -050060 This allows network administrator to configure a NDN router in a large enterprise network.
Alexander Afanasyev49272f72014-04-06 21:49:46 -070061
Alexander Afanasyev2a001942016-12-14 18:18:41 -0800623. Find closest hub by sending an HTTP request to NDN-FCH server.
63
644. Connect to the home NDN router according to user certificate.
Alexander Afanasyev49272f72014-04-06 21:49:46 -070065 This ensures connectivity from anywhere.
66
Stumble62b19a62015-08-03 10:17:45 -070067After connecting to an NDN router, two prefixes will be automatically registered:
68
Alexander Afanasyev5c475972015-12-20 16:16:56 -080069- ``/ndn``
70- ``/localhop/nfd`` --- this to inform RIB manager that there is connectivity to the hub
Stumble62b19a62015-08-03 10:17:45 -070071
Alexander Afanasyev49272f72014-04-06 21:49:46 -070072Stage 1: multicast discovery
73^^^^^^^^^^^^^^^^^^^^^^^^^^^^
74
75Request
76+++++++
77
78The end host sends an Interest over a multicast face.
79
80Interest Name is ``/localhop/ndn-autoconf/hub``.
81
82Response
83++++++++
84
hilata6ee6e072014-04-20 17:10:18 -050085A producer app on the HUB answer this Interest with a Data packet that contains a
86TLV-encoded `Uri` block. The value of this block is the URI for the HUB, preferrably a
87UDP tunnel.
Alexander Afanasyev49272f72014-04-06 21:49:46 -070088
89Stage 2: DNS query with default suffix
90^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
91
92Request
93+++++++
94
95The end host sends a DNS query that is equivalent to this command::
96
97 dig +search +short +cmd +tries=2 +ndots=10 _ndn._udp srv
98
99Response
100++++++++
101
hilata6ee6e072014-04-20 17:10:18 -0500102The DNS server should answer with an SRV record that contains the hostname and UDP port
103number of the NDN router.
Alexander Afanasyev49272f72014-04-06 21:49:46 -0700104
Alexander Afanasyev2a001942016-12-14 18:18:41 -0800105Stage 3: HTTP Request to NDN-FCH server
106^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
107
108This stage uses a simple HTTP-based API. For more information about NDN-FCH server, refer
109to the `NDN-FCH README file <https://github.com/named-data/ndn-fch>`__.
110
111Request
112+++++++
113
114HTTP/1.0 request for the NDN-FCH server URI (``http://ndn-fch.named-data.net`` by default)
115
116Response
117++++++++
118
119The HTTP response is expected to be a hostname or an IP address of the closest hub,
120inferred using IP-geo approximation service.
121
122
123Stage 4: find home router
Alexander Afanasyev49272f72014-04-06 21:49:46 -0700124^^^^^^^^^^^^^^^^^^^^^^^^^
125
hilata6ee6e072014-04-20 17:10:18 -0500126This stage assumes that user has configured default certificate using
Eric Newberry81a9a862016-12-27 22:59:27 -0700127`<https://ndncert.named-data.net/>`_ as described in `Certification Architecture
128<https://redmine.named-data.net/attachments/download/23/CertificationArchitecture.pptx>`_.
Alexander Afanasyev49272f72014-04-06 21:49:46 -0700129
130Request
131+++++++
132
hilata6ee6e072014-04-20 17:10:18 -0500133The end host loads the default user identity (eg. ``/ndn/edu/ucla/cs/afanasev``), and
134converts it to DNS format.
Alexander Afanasyev49272f72014-04-06 21:49:46 -0700135
hilata6ee6e072014-04-20 17:10:18 -0500136The end host sends a DNS query for an SRV record of name ``_ndn._udp.`` + user identity in
137DNS format + ``_homehub._autoconf.named-data.net``. For example::
Alexander Afanasyev49272f72014-04-06 21:49:46 -0700138
139 _ndn._udp.afanasev.cs.ucla.edu.ndn._homehub._autoconf.named-data.net
140
141Response
142++++++++
143
hilata6ee6e072014-04-20 17:10:18 -0500144The DNS server should answer with an SRV record that contains the hostname and UDP port
145number of the home NDN router of this user's site.
Alexander Afanasyev49272f72014-04-06 21:49:46 -0700146
147Client procedure
148----------------
149
150Stage 1
151^^^^^^^
152
153Send a multicast discovery Interest.
154
155If this Interest is answered, connect to the HUB and terminate auto-discovery.
156
157Stage 2
158^^^^^^^
159
160Send a DNS query with default suffix.
161
162If this query is answered, connect to the HUB and terminate auto-discovery.
163
164Stage 3
165^^^^^^^
166
Alexander Afanasyev2a001942016-12-14 18:18:41 -0800167Send HTTP request to NDN-FCH server.
168
169If request succeeds, attempt to connect to the discovered HUB and terminate
170auto-discovery.
171
172Stage 4
173^^^^^^^
174
hilata6ee6e072014-04-20 17:10:18 -0500175* Load default user identity, and convert it to DNS format; if either fails, the
176 auto-discovery fails.
Alexander Afanasyev49272f72014-04-06 21:49:46 -0700177
178* Send a DNS query to find home HUB.
hilata6ee6e072014-04-20 17:10:18 -0500179 If this query is answered, connect to the home HUB and terminate auto-discovery.
180 Otherwise, the auto-discovery fails.
181
Davide Pesavento59769b12017-11-12 23:52:06 -0500182Exit status
183-----------
184
1850: No error.
186
1871: An unspecified error occurred.
188
1892: Malformed command line, e.g., invalid, missing, or unknown argument.
190
1914: Insufficient privileges.
hilata6ee6e072014-04-20 17:10:18 -0500192
193See also
194--------
195
Alexander Afanasyev5c475972015-12-20 16:16:56 -0800196:ref:`ndn-autoconfig-server`, :doc:`ndn-autoconfig.conf`