blob: a73b211901e51eb0662ab585d807a1af44623195 [file] [log] [blame]
Davide Pesavento17521592020-05-14 19:01:32 -04001Getting started with NFD
Steve DiBenedetto62a93942014-08-24 17:13:52 -06002========================
Alexander Afanasyev284257b2014-04-11 14:16:51 -07003
Davide Pesavento69857c32020-04-05 16:36:26 -04004Supported platforms
5-------------------
Steve DiBenedetto62a93942014-08-24 17:13:52 -06006
Davide Pesavento69857c32020-04-05 16:36:26 -04007NFD is built against a continuous integration system and has been tested on the
8following platforms:
9
Davide Pesavento69857c32020-04-05 16:36:26 -040010- Ubuntu 18.04 (amd64, armhf, i386)
Davide Pesavento17521592020-05-14 19:01:32 -040011- Ubuntu 20.04 (amd64)
Alexander Afanasyev5006c1d2022-01-27 14:31:20 -050012- Ubuntu 21.10 (amd64)
Davide Pesavento69857c32020-04-05 16:36:26 -040013- macOS 10.15
Davide Pesaventof28a0612021-09-29 23:13:32 -040014- macOS 11 (Intel only)
Davide Pesavento17521592020-05-14 19:01:32 -040015- CentOS 8
Davide Pesavento69857c32020-04-05 16:36:26 -040016
17NFD is known to work on the following platforms, although they are not officially
18supported:
19
Davide Pesaventof28a0612021-09-29 23:13:32 -040020- Alpine >= 3.12
21- Debian >= 10
Davide Pesavento17521592020-05-14 19:01:32 -040022- Fedora >= 29
Davide Pesavento69857c32020-04-05 16:36:26 -040023- Gentoo Linux
Davide Pesaventof28a0612021-09-29 23:13:32 -040024- Raspberry Pi OS (formerly Raspbian) >= 2019-06-20
Davide Pesaventoc52cd5e2022-03-05 20:40:54 -050025- FreeBSD >= 12.0
Davide Pesaventof28a0612021-09-29 23:13:32 -040026- macOS 10.14
Davide Pesavento69857c32020-04-05 16:36:26 -040027
28.. _Install NFD on Ubuntu Linux using the NDN PPA repository:
29
30Install NFD on Ubuntu Linux using the NDN PPA repository
Steve DiBenedetto62a93942014-08-24 17:13:52 -060031--------------------------------------------------------
32
Davide Pesavento69857c32020-04-05 16:36:26 -040033NFD binaries and related tools for supported versions of Ubuntu can be installed using
34PPA packages from the **named-data** repository. First, you will need to add the
35``named-data/ppa`` repository to the binary package sources and update the list of
36available packages.
Steve DiBenedetto62a93942014-08-24 17:13:52 -060037
Alexander Afanasyev84dd4ca2017-10-15 14:56:08 -040038Preliminary steps if you have not used PPA packages before
39~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Steve DiBenedetto62a93942014-08-24 17:13:52 -060040
Davide Pesavento69857c32020-04-05 16:36:26 -040041To simplify adding new PPA repositories, Ubuntu provides the ``add-apt-repository`` tool,
Davide Pesaventocc7bee72016-04-22 02:21:13 +020042which is not installed by default on some systems.
Steve DiBenedetto62a93942014-08-24 17:13:52 -060043
44::
45
Davide Pesavento69857c32020-04-05 16:36:26 -040046 sudo apt install software-properties-common
Steve DiBenedetto62a93942014-08-24 17:13:52 -060047
Davide Pesavento69857c32020-04-05 16:36:26 -040048Adding the NDN PPA
49~~~~~~~~~~~~~~~~~~
Steve DiBenedetto62a93942014-08-24 17:13:52 -060050
Davide Pesavento69857c32020-04-05 16:36:26 -040051After installing ``add-apt-repository``, run the following commands to add the `NDN PPA
52repository`_::
Steve DiBenedetto62a93942014-08-24 17:13:52 -060053
54 sudo add-apt-repository ppa:named-data/ppa
Davide Pesavento69857c32020-04-05 16:36:26 -040055 sudo apt update
Steve DiBenedetto62a93942014-08-24 17:13:52 -060056
57Installing NFD and other NDN packages
58~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
59
Davide Pesavento69857c32020-04-05 16:36:26 -040060After you have added the `NDN PPA repository`_, NFD and other NDN packages can be easily
61installed either using ``apt``, as shown below, or any other compatible package manager.
Steve DiBenedetto62a93942014-08-24 17:13:52 -060062
63::
64
Davide Pesavento69857c32020-04-05 16:36:26 -040065 sudo apt install nfd
Steve DiBenedetto62a93942014-08-24 17:13:52 -060066
Davide Pesavento69857c32020-04-05 16:36:26 -040067For the list of available packages, refer to the `NDN PPA repository`_ page.
Steve DiBenedetto62a93942014-08-24 17:13:52 -060068
69.. _NDN PPA repository: https://launchpad.net/~named-data/+archive/ppa
70
Davide Pesavento69857c32020-04-05 16:36:26 -040071Building from source
Steve DiBenedetto62a93942014-08-24 17:13:52 -060072--------------------
73
Davide Pesavento69857c32020-04-05 16:36:26 -040074Downloading from git
Steve DiBenedetto62a93942014-08-24 17:13:52 -060075~~~~~~~~~~~~~~~~~~~~
76
Davide Pesavento69857c32020-04-05 16:36:26 -040077The first step is to obtain the source code for NFD and its main dependency, the
78*ndn-cxx* library. If you do not want a development version of NFD, make sure you
Eric Newberry3dc9fd02020-10-01 10:47:04 -070079checkout the correct release tag (e.g., ``*-0.7.1``) from both repositories.
Steve DiBenedetto62a93942014-08-24 17:13:52 -060080
Davide Pesavento9f6a7d92020-10-06 15:21:48 -040081.. code-block:: sh
Steve DiBenedetto62a93942014-08-24 17:13:52 -060082
83 # Download ndn-cxx
Davide Pesavento69857c32020-04-05 16:36:26 -040084 git clone https://github.com/named-data/ndn-cxx.git
Steve DiBenedetto62a93942014-08-24 17:13:52 -060085
86 # Download NFD
Davide Pesavento69857c32020-04-05 16:36:26 -040087 git clone --recursive https://github.com/named-data/NFD.git
Alexander Afanasyev284257b2014-04-11 14:16:51 -070088
Alexander Afanasyev84dd4ca2017-10-15 14:56:08 -040089.. note::
Davide Pesavento69857c32020-04-05 16:36:26 -040090 While we strive to ensure that the latest version (git master branch) of NFD and ndn-cxx
91 always compiles and works properly, we cannot guarantee that there will be no issues.
92 If this is discovered to be the case, please use matching released versions (git tag or
93 tarball) of NFD and ndn-cxx instead.
Alexander Afanasyev84dd4ca2017-10-15 14:56:08 -040094
Alexander Afanasyev284257b2014-04-11 14:16:51 -070095Prerequisites
Steve DiBenedetto62a93942014-08-24 17:13:52 -060096~~~~~~~~~~~~~
Alexander Afanasyev284257b2014-04-11 14:16:51 -070097
Davide Pesavento69857c32020-04-05 16:36:26 -040098Install the `ndn-cxx library <https://named-data.net/doc/ndn-cxx/current/INSTALL.html>`__
99and its prerequisites.
Alexander Afanasyev284257b2014-04-11 14:16:51 -0700100
Davide Pesavento69857c32020-04-05 16:36:26 -0400101On Linux, NFD needs the following dependencies to enable optional features:
Junxiao Shie5e1e252014-12-13 22:07:35 -0700102
Davide Pesavento9f6a7d92020-10-06 15:21:48 -0400103- On **Ubuntu**:
104
105 .. code-block:: sh
Junxiao Shie5e1e252014-12-13 22:07:35 -0700106
Davide Pesavento17521592020-05-14 19:01:32 -0400107 sudo apt install libpcap-dev libsystemd-dev
108
Davide Pesavento9f6a7d92020-10-06 15:21:48 -0400109- On **CentOS** and **Fedora**:
110
111 .. code-block:: sh
Davide Pesavento17521592020-05-14 19:01:32 -0400112
Davide Pesavento9ab43e62020-12-27 20:07:25 -0500113 sudo dnf config-manager --enable powertools # on CentOS only
Davide Pesavento17521592020-05-14 19:01:32 -0400114 sudo dnf install libpcap-devel systemd-devel
Alexander Afanasyev284257b2014-04-11 14:16:51 -0700115
Steve DiBenedetto62a93942014-08-24 17:13:52 -0600116Build
117~~~~~
118
Davide Pesavento9f6a7d92020-10-06 15:21:48 -0400119The following commands can be used to build and install NFD from source:
120
121.. code-block:: sh
Alexander Afanasyev284257b2014-04-11 14:16:51 -0700122
Davide Pesavento17521592020-05-14 19:01:32 -0400123 ./waf configure # on CentOS, add --without-pch
Alexander Afanasyev284257b2014-04-11 14:16:51 -0700124 ./waf
125 sudo ./waf install
126
Davide Pesavento69857c32020-04-05 16:36:26 -0400127If you have installed ndn-cxx and/or any other dependencies into a non-standard path,
128you may need to modify the ``PKG_CONFIG_PATH`` environment variable before running
Davide Pesavento9f6a7d92020-10-06 15:21:48 -0400129``./waf configure``. For example:
130
131.. code-block:: sh
Alexander Afanasyev284257b2014-04-11 14:16:51 -0700132
Davide Pesavento69857c32020-04-05 16:36:26 -0400133 export PKG_CONFIG_PATH="/custom/lib/pkgconfig:$PKG_CONFIG_PATH"
Alexander Afanasyev284257b2014-04-11 14:16:51 -0700134 ./waf configure
135 ./waf
136 sudo ./waf install
137
Davide Pesavento69857c32020-04-05 16:36:26 -0400138Refer to ``./waf --help`` for more options that can be used during the ``configure`` stage.
Steve DiBenedetto62a93942014-08-24 17:13:52 -0600139
Alexander Afanasyev508411e2014-12-16 13:27:59 -0800140.. note::
Davide Pesavento69857c32020-04-05 16:36:26 -0400141 If you are working on a source repository that has been compiled before, and you have
142 upgraded one of the dependencies, please execute ``./waf distclean`` to clear object files
143 and start over.
Alexander Afanasyev508411e2014-12-16 13:27:59 -0800144
Alexander Afanasyev26181532014-05-07 23:38:51 -0700145Debug symbols
Steve DiBenedetto62a93942014-08-24 17:13:52 -0600146~~~~~~~~~~~~~
Alexander Afanasyev26181532014-05-07 23:38:51 -0700147
Davide Pesavento17521592020-05-14 19:01:32 -0400148The default compiler flags include debug symbols in binaries. This should provide
149more meaningful debugging information if NFD or other tools happen to crash.
Alexander Afanasyev26181532014-05-07 23:38:51 -0700150
Davide Pesavento17521592020-05-14 19:01:32 -0400151If this is not desired, the default flags can be overridden to disable debug symbols.
152The following example shows how to completely disable debug symbols and configure
153NFD to be installed into ``/usr`` with configuration in the ``/etc`` directory.
Alexander Afanasyev26181532014-05-07 23:38:51 -0700154
Davide Pesavento9f6a7d92020-10-06 15:21:48 -0400155.. code-block:: sh
Alexander Afanasyev26181532014-05-07 23:38:51 -0700156
157 CXXFLAGS="-O2" ./waf configure --prefix=/usr --sysconfdir=/etc
158 ./waf
159 sudo ./waf install
160
Davide Pesavento69857c32020-04-05 16:36:26 -0400161For Ubuntu PPA packages, debug symbols are available in ``*-dbg`` packages.
Alexander Afanasyev84dd4ca2017-10-15 14:56:08 -0400162
Davide Pesavento69857c32020-04-05 16:36:26 -0400163Customizing the compiler
164~~~~~~~~~~~~~~~~~~~~~~~~
Alexander Afanasyev7c10b3b2015-01-20 12:24:27 -0800165
Davide Pesavento69857c32020-04-05 16:36:26 -0400166To build NFD with a different compiler (rather than the platform default), set the
167``CXX`` environment variable to point to the compiler binary. For example, to build
Davide Pesavento9f6a7d92020-10-06 15:21:48 -0400168with clang on Linux, use the following:
169
170.. code-block:: sh
Alexander Afanasyev7c10b3b2015-01-20 12:24:27 -0800171
Eric Newberry81a9a862016-12-27 22:59:27 -0700172 CXX=clang++ ./waf configure
Alexander Afanasyev7c10b3b2015-01-20 12:24:27 -0800173
Davide Pesavento69857c32020-04-05 16:36:26 -0400174Building the documentation
175~~~~~~~~~~~~~~~~~~~~~~~~~~
Alexander Afanasyev284257b2014-04-11 14:16:51 -0700176
Davide Pesavento9f6a7d92020-10-06 15:21:48 -0400177Tutorials and API documentation can be built using the following commands:
178
179.. code-block:: sh
Alexander Afanasyev284257b2014-04-11 14:16:51 -0700180
181 # Full set of documentation (tutorials + API) in build/docs
182 ./waf docs
183
Davide Pesavento69857c32020-04-05 16:36:26 -0400184 # Only tutorials in build/docs
Alexander Afanasyev284257b2014-04-11 14:16:51 -0700185 ./waf sphinx
186
Davide Pesavento69857c32020-04-05 16:36:26 -0400187 # Only API docs in build/docs/doxygen
188 ./waf doxygen
Alexander Afanasyev284257b2014-04-11 14:16:51 -0700189
Davide Pesavento17521592020-05-14 19:01:32 -0400190If ``sphinx-build`` is detected during ``./waf configure``, manpages will automatically
191be built and installed during the normal build process (i.e., during ``./waf`` and
192``./waf install``). By default, manpages will be installed into ``${PREFIX}/share/man``
193(the default value for ``PREFIX`` is ``/usr/local``). This location can be changed
194during the ``./waf configure`` stage using the ``--prefix``, ``--datarootdir``, or
195``--mandir`` options.
Alexander Afanasyev284257b2014-04-11 14:16:51 -0700196
Davide Pesavento17521592020-05-14 19:01:32 -0400197For further details, please refer to ``./waf --help``.
Steve DiBenedetto62a93942014-08-24 17:13:52 -0600198
Steve DiBenedetto62a93942014-08-24 17:13:52 -0600199Initial configuration
200---------------------
201
202.. note::
203 If you have installed NFD from binary packages, the package manager has already
Davide Pesavento69857c32020-04-05 16:36:26 -0400204 installed a working configuration and you can safely skip this section.
Steve DiBenedetto62a93942014-08-24 17:13:52 -0600205
206General
207~~~~~~~
208
Davide Pesavento69857c32020-04-05 16:36:26 -0400209After installing NFD from source, you need to create a proper configuration file.
210If the default installation directories were used with ``./waf configure``, this
211can be accomplished by simply copying the sample configuration file as follows::
Steve DiBenedetto62a93942014-08-24 17:13:52 -0600212
213 sudo cp /usr/local/etc/ndn/nfd.conf.sample /usr/local/etc/ndn/nfd.conf
214
215NFD Security
216~~~~~~~~~~~~
217
218NFD provides mechanisms to enable strict authorization for all management commands. In
Davide Pesavento69857c32020-04-05 16:36:26 -0400219particular, one can authorize only specific public keys to create new faces or change the
Steve DiBenedetto62a93942014-08-24 17:13:52 -0600220forwarding strategy for specific namespaces. For more information about how to generate
Davide Pesavento69857c32020-04-05 16:36:26 -0400221public/private key pairs, generate self-signed certificates, and use them to authorize
222NFD management commands, refer to the :ref:`How do I configure NFD security` FAQ question.
Steve DiBenedetto62a93942014-08-24 17:13:52 -0600223
Davide Pesavento69857c32020-04-05 16:36:26 -0400224In the sample configuration file, all security mechanisms are disabled for local clients,
225effectively allowing anybody on the local machine to issue NFD management commands.
226
227.. note::
228 The sample configuration file is intended only for demo purposes and should NOT be
229 used in production environments.
Steve DiBenedetto62a93942014-08-24 17:13:52 -0600230
231Running
232-------
233
Steve DiBenedetto62a93942014-08-24 17:13:52 -0600234Starting
235~~~~~~~~
236
Davide Pesavento69857c32020-04-05 16:36:26 -0400237If you have installed NFD from source, it is recommended to start NFD with the
238``nfd-start`` script::
Steve DiBenedetto62a93942014-08-24 17:13:52 -0600239
240 nfd-start
241
Davide Pesavento69857c32020-04-05 16:36:26 -0400242On macOS, this command may ask for your keychain password or ask "nfd wants to sign using
243key [xyz] in your keychain". Enter your keychain password and click "Always Allow".
Steve DiBenedetto62a93942014-08-24 17:13:52 -0600244
245Later, you can stop NFD with ``nfd-stop`` or by simply killing the ``nfd`` process.
246
Davide Pesavento2849fd42019-01-03 18:30:05 -0500247If you have installed NFD using a package manager, you can start and stop NFD using the
Davide Pesavento69857c32020-04-05 16:36:26 -0400248operating system's service manager, such as ``systemctl`` or ``launchctl``.
Steve DiBenedetto62a93942014-08-24 17:13:52 -0600249
Davide Pesavento69857c32020-04-05 16:36:26 -0400250Connecting to remote forwarders
251~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Steve DiBenedetto62a93942014-08-24 17:13:52 -0600252
Davide Pesavento69857c32020-04-05 16:36:26 -0400253To create a UDP tunnel to a remote instance of NFD, execute the following command
254in a terminal::
Steve DiBenedetto62a93942014-08-24 17:13:52 -0600255
Davide Pesavento69857c32020-04-05 16:36:26 -0400256 nfdc face create udp://<other-host>
Steve DiBenedetto62a93942014-08-24 17:13:52 -0600257
Davide Pesavento69857c32020-04-05 16:36:26 -0400258where ``<other-host>`` is the name or IP address of the other host (e.g.,
259``udp://ndn.example.net``). If successful, this will print something like::
Steve DiBenedetto62a93942014-08-24 17:13:52 -0600260
Junxiao Shi849e12a2017-08-02 00:14:57 +0000261 face-created id=308 local=udp4://10.0.2.15:6363 remote=udp4://131.179.196.46:6363 persistency=persistent
262
Davide Pesavento69857c32020-04-05 16:36:26 -0400263To add a route ``/ndn`` toward this remote forwarder, execute the following command
264in a terminal::
Junxiao Shi849e12a2017-08-02 00:14:57 +0000265
Davide Pesavento69857c32020-04-05 16:36:26 -0400266 nfdc route add /ndn udp://<other-host>
Junxiao Shi849e12a2017-08-02 00:14:57 +0000267
Davide Pesavento69857c32020-04-05 16:36:26 -0400268This will print::
Junxiao Shi849e12a2017-08-02 00:14:57 +0000269
270 route-add-accepted prefix=/ndn nexthop=308 origin=static cost=0 flags=child-inherit expires=never
Steve DiBenedetto62a93942014-08-24 17:13:52 -0600271
Davide Pesavento69857c32020-04-05 16:36:26 -0400272This indicates that NFD will forward all Interests that start with ``/ndn`` through the
273face to the other host. This forwards Interests to the other host, but does not provide
274a "back route" for the other host to forward Interests to you. For this, you can rely on
275the "automatic prefix propagation" feature of NFD or use the ``nfdc`` command on the other
276host to add the route.
Steve DiBenedetto62a93942014-08-24 17:13:52 -0600277
278Playing with NFD
279----------------
280
Davide Pesavento69857c32020-04-05 16:36:26 -0400281After you have installed, configured, and started NFD, you can demonstrate the features
282of NDN using the following applications and libraries.
Steve DiBenedetto62a93942014-08-24 17:13:52 -0600283
284Sample applications:
285
Davide Pesavento17521592020-05-14 19:01:32 -0400286 + `Simple examples using the ndn-cxx library <https://named-data.net/doc/ndn-cxx/current/examples.html>`__
Davide Pesavento69857c32020-04-05 16:36:26 -0400287 + `Introductory examples of NDN-CCL
Davide Pesavento17521592020-05-14 19:01:32 -0400288 <https://redmine.named-data.net/projects/application-development-documentation-guides/wiki/Step-By-Step_-_Common_Client_Libraries>`__
Steve DiBenedetto62a93942014-08-24 17:13:52 -0600289
290Real applications and libraries:
291
Davide Pesavento17521592020-05-14 19:01:32 -0400292 + `ndn-tools - Essential NDN command-line tools <https://github.com/named-data/ndn-tools>`__
293 + `ndn-traffic-generator - Traffic generator for NDN <https://github.com/named-data/ndn-traffic-generator>`__
294 + `ChronoSync - Sync library for multi-user real-time applications <https://github.com/named-data/ChronoSync>`__
295 + `PSync - Partial and full synchronization library <https://github.com/named-data/PSync>`__