blob: 468c346f43d7def27212fce8dbcd8c1c5d26280e [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 Pesaventoe541d1b2022-08-17 15:10:32 -040010- Ubuntu 18.04
11- Ubuntu 20.04
12- Ubuntu 22.04
13- Debian 11
14- CentOS Stream 9
15- macOS 10.15
16- macOS 11
17- macOS 12
Davide Pesavento69857c32020-04-05 16:36:26 -040018
19NFD is known to work on the following platforms, although they are not officially
20supported:
21
Davide Pesaventoe541d1b2022-08-17 15:10:32 -040022- Alpine >= 3.12
23- Fedora >= 29
24- Gentoo Linux
25- Raspberry Pi OS (formerly Raspbian) >= 2019-06-20
26- FreeBSD >= 12.0
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
Davide Pesaventoe541d1b2022-08-17 15:10:32 -040079checkout the correct release tag (e.g., ``*-0.8.0``) 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 Pesaventoe541d1b2022-08-17 15:10:32 -0400103- On **Debian** and **Ubuntu**:
Davide Pesavento9f6a7d92020-10-06 15:21:48 -0400104
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 Pesavento17521592020-05-14 19:01:32 -0400113 sudo dnf install libpcap-devel systemd-devel
Alexander Afanasyev284257b2014-04-11 14:16:51 -0700114
Steve DiBenedetto62a93942014-08-24 17:13:52 -0600115Build
116~~~~~
117
Davide Pesavento9f6a7d92020-10-06 15:21:48 -0400118The following commands can be used to build and install NFD from source:
119
120.. code-block:: sh
Alexander Afanasyev284257b2014-04-11 14:16:51 -0700121
Davide Pesavento2150da82022-07-08 18:18:51 -0400122 ./waf configure
Alexander Afanasyev284257b2014-04-11 14:16:51 -0700123 ./waf
124 sudo ./waf install
125
Davide Pesavento69857c32020-04-05 16:36:26 -0400126If you have installed ndn-cxx and/or any other dependencies into a non-standard path,
127you may need to modify the ``PKG_CONFIG_PATH`` environment variable before running
Davide Pesavento9f6a7d92020-10-06 15:21:48 -0400128``./waf configure``. For example:
129
130.. code-block:: sh
Alexander Afanasyev284257b2014-04-11 14:16:51 -0700131
Davide Pesavento69857c32020-04-05 16:36:26 -0400132 export PKG_CONFIG_PATH="/custom/lib/pkgconfig:$PKG_CONFIG_PATH"
Alexander Afanasyev284257b2014-04-11 14:16:51 -0700133 ./waf configure
134 ./waf
135 sudo ./waf install
136
Davide Pesavento69857c32020-04-05 16:36:26 -0400137Refer to ``./waf --help`` for more options that can be used during the ``configure`` stage.
Steve DiBenedetto62a93942014-08-24 17:13:52 -0600138
Alexander Afanasyev508411e2014-12-16 13:27:59 -0800139.. note::
Davide Pesavento69857c32020-04-05 16:36:26 -0400140 If you are working on a source repository that has been compiled before, and you have
141 upgraded one of the dependencies, please execute ``./waf distclean`` to clear object files
142 and start over.
Alexander Afanasyev508411e2014-12-16 13:27:59 -0800143
Alexander Afanasyev26181532014-05-07 23:38:51 -0700144Debug symbols
Steve DiBenedetto62a93942014-08-24 17:13:52 -0600145~~~~~~~~~~~~~
Alexander Afanasyev26181532014-05-07 23:38:51 -0700146
Davide Pesavento17521592020-05-14 19:01:32 -0400147The default compiler flags include debug symbols in binaries. This should provide
148more meaningful debugging information if NFD or other tools happen to crash.
Alexander Afanasyev26181532014-05-07 23:38:51 -0700149
Davide Pesavento17521592020-05-14 19:01:32 -0400150If this is not desired, the default flags can be overridden to disable debug symbols.
151The following example shows how to completely disable debug symbols and configure
152NFD to be installed into ``/usr`` with configuration in the ``/etc`` directory.
Alexander Afanasyev26181532014-05-07 23:38:51 -0700153
Davide Pesavento9f6a7d92020-10-06 15:21:48 -0400154.. code-block:: sh
Alexander Afanasyev26181532014-05-07 23:38:51 -0700155
156 CXXFLAGS="-O2" ./waf configure --prefix=/usr --sysconfdir=/etc
157 ./waf
158 sudo ./waf install
159
Davide Pesavento69857c32020-04-05 16:36:26 -0400160For Ubuntu PPA packages, debug symbols are available in ``*-dbg`` packages.
Alexander Afanasyev84dd4ca2017-10-15 14:56:08 -0400161
Davide Pesavento69857c32020-04-05 16:36:26 -0400162Customizing the compiler
163~~~~~~~~~~~~~~~~~~~~~~~~
Alexander Afanasyev7c10b3b2015-01-20 12:24:27 -0800164
Davide Pesavento69857c32020-04-05 16:36:26 -0400165To build NFD with a different compiler (rather than the platform default), set the
166``CXX`` environment variable to point to the compiler binary. For example, to build
Davide Pesavento9f6a7d92020-10-06 15:21:48 -0400167with clang on Linux, use the following:
168
169.. code-block:: sh
Alexander Afanasyev7c10b3b2015-01-20 12:24:27 -0800170
Eric Newberry81a9a862016-12-27 22:59:27 -0700171 CXX=clang++ ./waf configure
Alexander Afanasyev7c10b3b2015-01-20 12:24:27 -0800172
Davide Pesavento69857c32020-04-05 16:36:26 -0400173Building the documentation
174~~~~~~~~~~~~~~~~~~~~~~~~~~
Alexander Afanasyev284257b2014-04-11 14:16:51 -0700175
Davide Pesavento9f6a7d92020-10-06 15:21:48 -0400176Tutorials and API documentation can be built using the following commands:
177
178.. code-block:: sh
Alexander Afanasyev284257b2014-04-11 14:16:51 -0700179
180 # Full set of documentation (tutorials + API) in build/docs
181 ./waf docs
182
Davide Pesavento69857c32020-04-05 16:36:26 -0400183 # Only tutorials in build/docs
Alexander Afanasyev284257b2014-04-11 14:16:51 -0700184 ./waf sphinx
185
Davide Pesavento69857c32020-04-05 16:36:26 -0400186 # Only API docs in build/docs/doxygen
187 ./waf doxygen
Alexander Afanasyev284257b2014-04-11 14:16:51 -0700188
Davide Pesavento17521592020-05-14 19:01:32 -0400189If ``sphinx-build`` is detected during ``./waf configure``, manpages will automatically
190be built and installed during the normal build process (i.e., during ``./waf`` and
191``./waf install``). By default, manpages will be installed into ``${PREFIX}/share/man``
192(the default value for ``PREFIX`` is ``/usr/local``). This location can be changed
193during the ``./waf configure`` stage using the ``--prefix``, ``--datarootdir``, or
194``--mandir`` options.
Alexander Afanasyev284257b2014-04-11 14:16:51 -0700195
Davide Pesavento17521592020-05-14 19:01:32 -0400196For further details, please refer to ``./waf --help``.
Steve DiBenedetto62a93942014-08-24 17:13:52 -0600197
Steve DiBenedetto62a93942014-08-24 17:13:52 -0600198Initial configuration
199---------------------
200
201.. note::
202 If you have installed NFD from binary packages, the package manager has already
Davide Pesavento69857c32020-04-05 16:36:26 -0400203 installed a working configuration and you can safely skip this section.
Steve DiBenedetto62a93942014-08-24 17:13:52 -0600204
205General
206~~~~~~~
207
Davide Pesavento69857c32020-04-05 16:36:26 -0400208After installing NFD from source, you need to create a proper configuration file.
209If the default installation directories were used with ``./waf configure``, this
210can be accomplished by simply copying the sample configuration file as follows::
Steve DiBenedetto62a93942014-08-24 17:13:52 -0600211
212 sudo cp /usr/local/etc/ndn/nfd.conf.sample /usr/local/etc/ndn/nfd.conf
213
214NFD Security
215~~~~~~~~~~~~
216
217NFD provides mechanisms to enable strict authorization for all management commands. In
Davide Pesavento69857c32020-04-05 16:36:26 -0400218particular, one can authorize only specific public keys to create new faces or change the
Steve DiBenedetto62a93942014-08-24 17:13:52 -0600219forwarding strategy for specific namespaces. For more information about how to generate
Davide Pesavento69857c32020-04-05 16:36:26 -0400220public/private key pairs, generate self-signed certificates, and use them to authorize
221NFD management commands, refer to the :ref:`How do I configure NFD security` FAQ question.
Steve DiBenedetto62a93942014-08-24 17:13:52 -0600222
Davide Pesavento69857c32020-04-05 16:36:26 -0400223In the sample configuration file, all security mechanisms are disabled for local clients,
224effectively allowing anybody on the local machine to issue NFD management commands.
225
226.. note::
227 The sample configuration file is intended only for demo purposes and should NOT be
228 used in production environments.
Steve DiBenedetto62a93942014-08-24 17:13:52 -0600229
230Running
231-------
232
Steve DiBenedetto62a93942014-08-24 17:13:52 -0600233Starting
234~~~~~~~~
235
Davide Pesavento69857c32020-04-05 16:36:26 -0400236If you have installed NFD from source, it is recommended to start NFD with the
237``nfd-start`` script::
Steve DiBenedetto62a93942014-08-24 17:13:52 -0600238
239 nfd-start
240
Davide Pesavento69857c32020-04-05 16:36:26 -0400241On macOS, this command may ask for your keychain password or ask "nfd wants to sign using
242key [xyz] in your keychain". Enter your keychain password and click "Always Allow".
Steve DiBenedetto62a93942014-08-24 17:13:52 -0600243
244Later, you can stop NFD with ``nfd-stop`` or by simply killing the ``nfd`` process.
245
Davide Pesavento2849fd42019-01-03 18:30:05 -0500246If you have installed NFD using a package manager, you can start and stop NFD using the
Davide Pesavento69857c32020-04-05 16:36:26 -0400247operating system's service manager, such as ``systemctl`` or ``launchctl``.
Steve DiBenedetto62a93942014-08-24 17:13:52 -0600248
Davide Pesavento69857c32020-04-05 16:36:26 -0400249Connecting to remote forwarders
250~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Steve DiBenedetto62a93942014-08-24 17:13:52 -0600251
Davide Pesavento69857c32020-04-05 16:36:26 -0400252To create a UDP tunnel to a remote instance of NFD, execute the following command
253in a terminal::
Steve DiBenedetto62a93942014-08-24 17:13:52 -0600254
Davide Pesavento69857c32020-04-05 16:36:26 -0400255 nfdc face create udp://<other-host>
Steve DiBenedetto62a93942014-08-24 17:13:52 -0600256
Davide Pesavento69857c32020-04-05 16:36:26 -0400257where ``<other-host>`` is the name or IP address of the other host (e.g.,
258``udp://ndn.example.net``). If successful, this will print something like::
Steve DiBenedetto62a93942014-08-24 17:13:52 -0600259
Junxiao Shi849e12a2017-08-02 00:14:57 +0000260 face-created id=308 local=udp4://10.0.2.15:6363 remote=udp4://131.179.196.46:6363 persistency=persistent
261
Davide Pesavento69857c32020-04-05 16:36:26 -0400262To add a route ``/ndn`` toward this remote forwarder, execute the following command
263in a terminal::
Junxiao Shi849e12a2017-08-02 00:14:57 +0000264
Davide Pesavento69857c32020-04-05 16:36:26 -0400265 nfdc route add /ndn udp://<other-host>
Junxiao Shi849e12a2017-08-02 00:14:57 +0000266
Davide Pesavento69857c32020-04-05 16:36:26 -0400267This will print::
Junxiao Shi849e12a2017-08-02 00:14:57 +0000268
269 route-add-accepted prefix=/ndn nexthop=308 origin=static cost=0 flags=child-inherit expires=never
Steve DiBenedetto62a93942014-08-24 17:13:52 -0600270
Davide Pesavento69857c32020-04-05 16:36:26 -0400271This indicates that NFD will forward all Interests that start with ``/ndn`` through the
272face to the other host. This forwards Interests to the other host, but does not provide
273a "back route" for the other host to forward Interests to you. For this, you can rely on
274the "automatic prefix propagation" feature of NFD or use the ``nfdc`` command on the other
275host to add the route.
Steve DiBenedetto62a93942014-08-24 17:13:52 -0600276
277Playing with NFD
278----------------
279
Davide Pesavento69857c32020-04-05 16:36:26 -0400280After you have installed, configured, and started NFD, you can demonstrate the features
281of NDN using the following applications and libraries.
Steve DiBenedetto62a93942014-08-24 17:13:52 -0600282
283Sample applications:
284
Davide Pesavento17521592020-05-14 19:01:32 -0400285 + `Simple examples using the ndn-cxx library <https://named-data.net/doc/ndn-cxx/current/examples.html>`__
Davide Pesavento69857c32020-04-05 16:36:26 -0400286 + `Introductory examples of NDN-CCL
Davide Pesavento17521592020-05-14 19:01:32 -0400287 <https://redmine.named-data.net/projects/application-development-documentation-guides/wiki/Step-By-Step_-_Common_Client_Libraries>`__
Steve DiBenedetto62a93942014-08-24 17:13:52 -0600288
289Real applications and libraries:
290
Davide Pesavento17521592020-05-14 19:01:32 -0400291 + `ndn-tools - Essential NDN command-line tools <https://github.com/named-data/ndn-tools>`__
292 + `ndn-traffic-generator - Traffic generator for NDN <https://github.com/named-data/ndn-traffic-generator>`__
293 + `ChronoSync - Sync library for multi-user real-time applications <https://github.com/named-data/ChronoSync>`__
294 + `PSync - Partial and full synchronization library <https://github.com/named-data/PSync>`__