blob: 9767c86e4a8e684e7618e4c21dd8af99ef93778b [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``
Junxiao Shib53fe642018-07-25 11:45:35 -060022 Run ndn-autoconfig in daemon mode. In this mode, the auto-discovery procedure is re-run
23 hourly or when a network change event is detected.
Alexander Afanasyev5c475972015-12-20 16:16:56 -080024
25 NOTE: if connection to NFD fails, the daemon will be terminated.
26
27``-c [FILE]`` or ``--config=[FILE]``
28 Use the specified configuration file. If `enabled = true` is not specified in the
29 configuration file, no actions will be performed.
30
Alexander Afanasyev2a001942016-12-14 18:18:41 -080031``--ndn-fch-url=[URL]``
32 Use the specified URL to find the closest hub (NDN-FCH protocol). If not specified,
Junxiao Shib53fe642018-07-25 11:45:35 -060033 ``http://ndn-fch.named-data.net/`` will be used. Only ``http://`` URLs are supported.
Alexander Afanasyev2a001942016-12-14 18:18:41 -080034
Davide Pesavento59769b12017-11-12 23:52:06 -050035``-h`` or ``--help``
36 Print help message and exit.
37
Alexander Afanasyev5c475972015-12-20 16:16:56 -080038``-V`` or ``--version``
Davide Pesavento59769b12017-11-12 23:52:06 -050039 Show version information and exit.
Alexander Afanasyev5c475972015-12-20 16:16:56 -080040
hilata6ee6e072014-04-20 17:10:18 -050041.. _NDN hub discovery procedure:
Alexander Afanasyev49272f72014-04-06 21:49:46 -070042
43NDN hub discovery procedure
44---------------------------
45
hilata6ee6e072014-04-20 17:10:18 -050046When an end host starts up, or detects a change in its network environment, it MAY use
Junxiao Shib53fe642018-07-25 11:45:35 -060047this procedure to discover a NDN router, in order to gain connectivity to
Alexander Afanasyev77cddbc2019-01-28 14:38:16 -050048`the NDN research testbed <https://named-data.net/ndn-testbed/>`__.
Junxiao Shib53fe642018-07-25 11:45:35 -060049This procedure can discover either an NDN router in the local network, or a NDN testbed
50gateway router (commonly known as a "hub").
Alexander Afanasyev49272f72014-04-06 21:49:46 -070051
52Overview
53^^^^^^^^
54
Alexander Afanasyev2a001942016-12-14 18:18:41 -080055This procedure contains four methods to discover a NDN router:
Alexander Afanasyev49272f72014-04-06 21:49:46 -070056
571. Look for a local NDN router by multicast.
58 This is useful in a home or small office network.
59
602. Look for a local NDN router by DNS query with default suffix.
hilata6ee6e072014-04-20 17:10:18 -050061 This allows network administrator to configure a NDN router in a large enterprise network.
Alexander Afanasyev49272f72014-04-06 21:49:46 -070062
Alexander Afanasyev2a001942016-12-14 18:18:41 -0800633. Find closest hub by sending an HTTP request to NDN-FCH server.
64
Junxiao Shib53fe642018-07-25 11:45:35 -0600654. Connect to the home hub according to user certificate.
Alexander Afanasyev49272f72014-04-06 21:49:46 -070066 This ensures connectivity from anywhere.
67
Junxiao Shib53fe642018-07-25 11:45:35 -060068After connecting, two prefixes will be registered toward the router:
Stumble62b19a62015-08-03 10:17:45 -070069
Junxiao Shib53fe642018-07-25 11:45:35 -060070- ``/`` --- this allows application communication
71- ``/localhop/nfd`` --- this informs NFD-RIB that there is connectivity to a router
Stumble62b19a62015-08-03 10:17:45 -070072
Alexander Afanasyev49272f72014-04-06 21:49:46 -070073Stage 1: multicast discovery
74^^^^^^^^^^^^^^^^^^^^^^^^^^^^
75
76Request
77+++++++
78
Junxiao Shib53fe642018-07-25 11:45:35 -060079The end host sends Interest ``/localhop/ndn-autoconf/hub`` over a multicast face.
Alexander Afanasyev49272f72014-04-06 21:49:46 -070080
81Response
82++++++++
83
Junxiao Shib53fe642018-07-25 11:45:35 -060084A producer app on the router answers this Interest with a Data packet that contains a
85``Uri`` TLV element. The value of this element is the FaceUri for the router, such as
86a UDP tunnel.
Alexander Afanasyev49272f72014-04-06 21:49:46 -070087
88Stage 2: DNS query with default suffix
89^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
90
91Request
92+++++++
93
94The end host sends a DNS query that is equivalent to this command::
95
96 dig +search +short +cmd +tries=2 +ndots=10 _ndn._udp srv
97
98Response
99++++++++
100
hilata6ee6e072014-04-20 17:10:18 -0500101The DNS server should answer with an SRV record that contains the hostname and UDP port
Junxiao Shib53fe642018-07-25 11:45:35 -0600102number of a nearby NDN router.
Alexander Afanasyev49272f72014-04-06 21:49:46 -0700103
Alexander Afanasyev2a001942016-12-14 18:18:41 -0800104Stage 3: HTTP Request to NDN-FCH server
105^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
106
107This stage uses a simple HTTP-based API. For more information about NDN-FCH server, refer
108to the `NDN-FCH README file <https://github.com/named-data/ndn-fch>`__.
109
110Request
111+++++++
112
Alexander Afanasyev77cddbc2019-01-28 14:38:16 -0500113HTTP/1.0 request for the NDN-FCH server URI (`<http://ndn-fch.named-data.net/>`__ by default)
Alexander Afanasyev2a001942016-12-14 18:18:41 -0800114
115Response
116++++++++
117
118The HTTP response is expected to be a hostname or an IP address of the closest hub,
119inferred using IP-geo approximation service.
120
Alexander Afanasyev2a001942016-12-14 18:18:41 -0800121Stage 4: find home router
Alexander Afanasyev49272f72014-04-06 21:49:46 -0700122^^^^^^^^^^^^^^^^^^^^^^^^^
123
hilata6ee6e072014-04-20 17:10:18 -0500124This stage assumes that user has configured default certificate using
Alexander Afanasyev77cddbc2019-01-28 14:38:16 -0500125`<https://ndncert.named-data.net/>`__ as described in `Certification Architecture
Junxiao Shib53fe642018-07-25 11:45:35 -0600126<https://redmine.named-data.net/attachments/download/23/CertificationArchitecture.pptx>`__.
Alexander Afanasyev49272f72014-04-06 21:49:46 -0700127
128Request
129+++++++
130
hilata6ee6e072014-04-20 17:10:18 -0500131The end host loads the default user identity (eg. ``/ndn/edu/ucla/cs/afanasev``), and
132converts it to DNS format.
Alexander Afanasyev49272f72014-04-06 21:49:46 -0700133
hilata6ee6e072014-04-20 17:10:18 -0500134The end host sends a DNS query for an SRV record of name ``_ndn._udp.`` + user identity in
135DNS format + ``_homehub._autoconf.named-data.net``. For example::
Alexander Afanasyev49272f72014-04-06 21:49:46 -0700136
137 _ndn._udp.afanasev.cs.ucla.edu.ndn._homehub._autoconf.named-data.net
138
139Response
140++++++++
141
hilata6ee6e072014-04-20 17:10:18 -0500142The DNS server should answer with an SRV record that contains the hostname and UDP port
Junxiao Shib53fe642018-07-25 11:45:35 -0600143number of the home hub of this user's site.
Alexander Afanasyev49272f72014-04-06 21:49:46 -0700144
145Client procedure
146----------------
147
148Stage 1
149^^^^^^^
150
151Send a multicast discovery Interest.
Junxiao Shib53fe642018-07-25 11:45:35 -0600152If this Interest is answered, connect to the router and terminate auto-discovery.
Alexander Afanasyev49272f72014-04-06 21:49:46 -0700153
154Stage 2
155^^^^^^^
156
157Send a DNS query with default suffix.
Junxiao Shib53fe642018-07-25 11:45:35 -0600158If this query is answered, connect to the router and terminate auto-discovery.
Alexander Afanasyev49272f72014-04-06 21:49:46 -0700159
160Stage 3
161^^^^^^^
162
Alexander Afanasyev2a001942016-12-14 18:18:41 -0800163Send HTTP request to NDN-FCH server.
Junxiao Shib53fe642018-07-25 11:45:35 -0600164If request succeeds, attempt to connect to the discovered hub and terminate
Alexander Afanasyev2a001942016-12-14 18:18:41 -0800165auto-discovery.
166
167Stage 4
168^^^^^^^
169
Junxiao Shib53fe642018-07-25 11:45:35 -0600170Load default user identity, and convert it to DNS format.
171If either fails, the auto-discovery fails.
Alexander Afanasyev49272f72014-04-06 21:49:46 -0700172
Junxiao Shib53fe642018-07-25 11:45:35 -0600173Send a DNS query to find home hub.
174If this query is answered, connect to the home hub and terminate auto-discovery.
175Otherwise, the auto-discovery fails.
hilata6ee6e072014-04-20 17:10:18 -0500176
Davide Pesavento59769b12017-11-12 23:52:06 -0500177Exit status
178-----------
179
1800: No error.
181
1821: An unspecified error occurred.
183
1842: Malformed command line, e.g., invalid, missing, or unknown argument.
185
1864: Insufficient privileges.
hilata6ee6e072014-04-20 17:10:18 -0500187
188See also
189--------
190
Alexander Afanasyev5c475972015-12-20 16:16:56 -0800191:ref:`ndn-autoconfig-server`, :doc:`ndn-autoconfig.conf`