blob: c455bb996e9756ae628cb0bd8c8dc708dc372f3d [file] [log] [blame]
hilata6ee6e072014-04-20 17:10:18 -05001.. _ndn-autoconfig:
2
Alexander Afanasyev49272f72014-04-06 21:49:46 -07003ndn-autoconfig
4==============
5
Davide Pesavento9f6a7d92020-10-06 15:21:48 -04006Synopsis
7--------
Alexander Afanasyev49272f72014-04-06 21:49:46 -07008
Davide Pesavento9f6a7d92020-10-06 15:21:48 -04009**ndn-autoconfig** [**-h**] [**-V**] [**-c** *file*] [**-d**]
Alexander Afanasyev49272f72014-04-06 21:49:46 -070010
hilata6ee6e072014-04-20 17:10:18 -050011Description
12-----------
13
14Client tool to run :ref:`NDN hub discovery procedure`.
15
Alexander Afanasyev5c475972015-12-20 16:16:56 -080016Options
17-------
18
Alexander Afanasyev5c475972015-12-20 16:16:56 -080019``-d`` or ``--daemon``
Junxiao Shib53fe642018-07-25 11:45:35 -060020 Run ndn-autoconfig in daemon mode. In this mode, the auto-discovery procedure is re-run
21 hourly or when a network change event is detected.
Alexander Afanasyev5c475972015-12-20 16:16:56 -080022
23 NOTE: if connection to NFD fails, the daemon will be terminated.
24
Davide Pesavento9f6a7d92020-10-06 15:21:48 -040025``-c FILE`` or ``--config=FILE``
Alexander Afanasyev5c475972015-12-20 16:16:56 -080026 Use the specified configuration file. If `enabled = true` is not specified in the
27 configuration file, no actions will be performed.
28
Davide Pesavento9f6a7d92020-10-06 15:21:48 -040029``--ndn-fch-url=URL``
Alexander Afanasyev2a001942016-12-14 18:18:41 -080030 Use the specified URL to find the closest hub (NDN-FCH protocol). If not specified,
Junxiao Shib53fe642018-07-25 11:45:35 -060031 ``http://ndn-fch.named-data.net/`` will be used. Only ``http://`` URLs are supported.
Alexander Afanasyev2a001942016-12-14 18:18:41 -080032
Davide Pesavento59769b12017-11-12 23:52:06 -050033``-h`` or ``--help``
34 Print help message and exit.
35
Alexander Afanasyev5c475972015-12-20 16:16:56 -080036``-V`` or ``--version``
Davide Pesavento59769b12017-11-12 23:52:06 -050037 Show version information and exit.
Alexander Afanasyev5c475972015-12-20 16:16:56 -080038
hilata6ee6e072014-04-20 17:10:18 -050039.. _NDN hub discovery procedure:
Alexander Afanasyev49272f72014-04-06 21:49:46 -070040
41NDN hub discovery procedure
42---------------------------
43
hilata6ee6e072014-04-20 17:10:18 -050044When an end host starts up, or detects a change in its network environment, it MAY use
Junxiao Shib53fe642018-07-25 11:45:35 -060045this procedure to discover a NDN router, in order to gain connectivity to
Alexander Afanasyev77cddbc2019-01-28 14:38:16 -050046`the NDN research testbed <https://named-data.net/ndn-testbed/>`__.
Junxiao Shib53fe642018-07-25 11:45:35 -060047This procedure can discover either an NDN router in the local network, or a NDN testbed
48gateway router (commonly known as a "hub").
Alexander Afanasyev49272f72014-04-06 21:49:46 -070049
50Overview
51^^^^^^^^
52
Alexander Afanasyev2a001942016-12-14 18:18:41 -080053This procedure contains four methods to discover a NDN router:
Alexander Afanasyev49272f72014-04-06 21:49:46 -070054
551. Look for a local NDN router by multicast.
56 This is useful in a home or small office network.
57
582. Look for a local NDN router by DNS query with default suffix.
hilata6ee6e072014-04-20 17:10:18 -050059 This allows network administrator to configure a NDN router in a large enterprise network.
Alexander Afanasyev49272f72014-04-06 21:49:46 -070060
Alexander Afanasyev2a001942016-12-14 18:18:41 -0800613. Find closest hub by sending an HTTP request to NDN-FCH server.
62
Junxiao Shib53fe642018-07-25 11:45:35 -0600634. Connect to the home hub according to user certificate.
Alexander Afanasyev49272f72014-04-06 21:49:46 -070064 This ensures connectivity from anywhere.
65
Junxiao Shib53fe642018-07-25 11:45:35 -060066After connecting, two prefixes will be registered toward the router:
Stumble62b19a62015-08-03 10:17:45 -070067
Junxiao Shib53fe642018-07-25 11:45:35 -060068- ``/`` --- this allows application communication
69- ``/localhop/nfd`` --- this informs NFD-RIB that there is connectivity to a router
Stumble62b19a62015-08-03 10:17:45 -070070
Alexander Afanasyev49272f72014-04-06 21:49:46 -070071Stage 1: multicast discovery
72^^^^^^^^^^^^^^^^^^^^^^^^^^^^
73
74Request
75+++++++
76
Junxiao Shib53fe642018-07-25 11:45:35 -060077The end host sends Interest ``/localhop/ndn-autoconf/hub`` over a multicast face.
Alexander Afanasyev49272f72014-04-06 21:49:46 -070078
79Response
80++++++++
81
Junxiao Shib53fe642018-07-25 11:45:35 -060082A producer app on the router answers this Interest with a Data packet that contains a
83``Uri`` TLV element. The value of this element is the FaceUri for the router, such as
84a UDP tunnel.
Alexander Afanasyev49272f72014-04-06 21:49:46 -070085
86Stage 2: DNS query with default suffix
87^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
88
89Request
90+++++++
91
92The end host sends a DNS query that is equivalent to this command::
93
94 dig +search +short +cmd +tries=2 +ndots=10 _ndn._udp srv
95
96Response
97++++++++
98
hilata6ee6e072014-04-20 17:10:18 -050099The DNS server should answer with an SRV record that contains the hostname and UDP port
Junxiao Shib53fe642018-07-25 11:45:35 -0600100number of a nearby NDN router.
Alexander Afanasyev49272f72014-04-06 21:49:46 -0700101
Alexander Afanasyev2a001942016-12-14 18:18:41 -0800102Stage 3: HTTP Request to NDN-FCH server
103^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
104
105This stage uses a simple HTTP-based API. For more information about NDN-FCH server, refer
106to the `NDN-FCH README file <https://github.com/named-data/ndn-fch>`__.
107
108Request
109+++++++
110
Alexander Afanasyev77cddbc2019-01-28 14:38:16 -0500111HTTP/1.0 request for the NDN-FCH server URI (`<http://ndn-fch.named-data.net/>`__ by default)
Alexander Afanasyev2a001942016-12-14 18:18:41 -0800112
113Response
114++++++++
115
116The HTTP response is expected to be a hostname or an IP address of the closest hub,
117inferred using IP-geo approximation service.
118
Alexander Afanasyev2a001942016-12-14 18:18:41 -0800119Stage 4: find home router
Alexander Afanasyev49272f72014-04-06 21:49:46 -0700120^^^^^^^^^^^^^^^^^^^^^^^^^
121
hilata6ee6e072014-04-20 17:10:18 -0500122This stage assumes that user has configured default certificate using
Alexander Afanasyev77cddbc2019-01-28 14:38:16 -0500123`<https://ndncert.named-data.net/>`__ as described in `Certification Architecture
Junxiao Shib53fe642018-07-25 11:45:35 -0600124<https://redmine.named-data.net/attachments/download/23/CertificationArchitecture.pptx>`__.
Alexander Afanasyev49272f72014-04-06 21:49:46 -0700125
126Request
127+++++++
128
hilata6ee6e072014-04-20 17:10:18 -0500129The end host loads the default user identity (eg. ``/ndn/edu/ucla/cs/afanasev``), and
130converts it to DNS format.
Alexander Afanasyev49272f72014-04-06 21:49:46 -0700131
hilata6ee6e072014-04-20 17:10:18 -0500132The end host sends a DNS query for an SRV record of name ``_ndn._udp.`` + user identity in
133DNS format + ``_homehub._autoconf.named-data.net``. For example::
Alexander Afanasyev49272f72014-04-06 21:49:46 -0700134
135 _ndn._udp.afanasev.cs.ucla.edu.ndn._homehub._autoconf.named-data.net
136
137Response
138++++++++
139
hilata6ee6e072014-04-20 17:10:18 -0500140The DNS server should answer with an SRV record that contains the hostname and UDP port
Junxiao Shib53fe642018-07-25 11:45:35 -0600141number of the home hub of this user's site.
Alexander Afanasyev49272f72014-04-06 21:49:46 -0700142
143Client procedure
144----------------
145
146Stage 1
147^^^^^^^
148
149Send a multicast discovery Interest.
Junxiao Shib53fe642018-07-25 11:45:35 -0600150If this Interest is answered, connect to the router and terminate auto-discovery.
Alexander Afanasyev49272f72014-04-06 21:49:46 -0700151
152Stage 2
153^^^^^^^
154
155Send a DNS query with default suffix.
Junxiao Shib53fe642018-07-25 11:45:35 -0600156If this query is answered, connect to the router and terminate auto-discovery.
Alexander Afanasyev49272f72014-04-06 21:49:46 -0700157
158Stage 3
159^^^^^^^
160
Alexander Afanasyev2a001942016-12-14 18:18:41 -0800161Send HTTP request to NDN-FCH server.
Junxiao Shib53fe642018-07-25 11:45:35 -0600162If request succeeds, attempt to connect to the discovered hub and terminate
Alexander Afanasyev2a001942016-12-14 18:18:41 -0800163auto-discovery.
164
165Stage 4
166^^^^^^^
167
Junxiao Shib53fe642018-07-25 11:45:35 -0600168Load default user identity, and convert it to DNS format.
169If either fails, the auto-discovery fails.
Alexander Afanasyev49272f72014-04-06 21:49:46 -0700170
Junxiao Shib53fe642018-07-25 11:45:35 -0600171Send a DNS query to find home hub.
172If this query is answered, connect to the home hub and terminate auto-discovery.
173Otherwise, the auto-discovery fails.
hilata6ee6e072014-04-20 17:10:18 -0500174
Davide Pesavento59769b12017-11-12 23:52:06 -0500175Exit status
176-----------
177
1780: No error.
179
1801: An unspecified error occurred.
181
1822: Malformed command line, e.g., invalid, missing, or unknown argument.
183
1844: Insufficient privileges.
hilata6ee6e072014-04-20 17:10:18 -0500185
186See also
187--------
188
Alexander Afanasyev5c475972015-12-20 16:16:56 -0800189:ref:`ndn-autoconfig-server`, :doc:`ndn-autoconfig.conf`