blob: d3f1446db26ca4f6fe2f240395cbd9a4855d23ec [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 Pesaventoc5e3e7a2023-03-07 21:25:27 -050010- Ubuntu 20.04 (focal)
11- Ubuntu 22.04 (jammy)
12- Debian 11 (bullseye)
Davide Pesaventoe541d1b2022-08-17 15:10:32 -040013- CentOS Stream 9
Davide Pesaventoc5e3e7a2023-03-07 21:25:27 -050014- macOS 11 / 12 / 13
Davide Pesavento69857c32020-04-05 16:36:26 -040015
Davide Pesaventoc5e3e7a2023-03-07 21:25:27 -050016NFD should also work on the following platforms, although they are not officially
Davide Pesavento69857c32020-04-05 16:36:26 -040017supported:
18
Davide Pesaventoc5e3e7a2023-03-07 21:25:27 -050019- Any other recent version of Ubuntu not listed above
Davide Pesaventoe541d1b2022-08-17 15:10:32 -040020- Alpine >= 3.12
Davide Pesaventoc5e3e7a2023-03-07 21:25:27 -050021- Fedora >= 32
22- Any version of Raspberry Pi OS based on Debian 11 (bullseye)
23- macOS 10.15
Davide Pesavento6d6f2072022-09-12 23:08:34 -040024- FreeBSD >= 12.2
Davide Pesavento69857c32020-04-05 16:36:26 -040025
26.. _Install NFD on Ubuntu Linux using the NDN PPA repository:
27
28Install NFD on Ubuntu Linux using the NDN PPA repository
Steve DiBenedetto62a93942014-08-24 17:13:52 -060029--------------------------------------------------------
30
Davide Pesavento69857c32020-04-05 16:36:26 -040031NFD binaries and related tools for supported versions of Ubuntu can be installed using
32PPA packages from the **named-data** repository. First, you will need to add the
33``named-data/ppa`` repository to the binary package sources and update the list of
34available packages.
Steve DiBenedetto62a93942014-08-24 17:13:52 -060035
Alexander Afanasyev84dd4ca2017-10-15 14:56:08 -040036Preliminary steps if you have not used PPA packages before
37~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Steve DiBenedetto62a93942014-08-24 17:13:52 -060038
Davide Pesavento69857c32020-04-05 16:36:26 -040039To simplify adding new PPA repositories, Ubuntu provides the ``add-apt-repository`` tool,
Davide Pesaventocc7bee72016-04-22 02:21:13 +020040which is not installed by default on some systems.
Steve DiBenedetto62a93942014-08-24 17:13:52 -060041
42::
43
Davide Pesavento69857c32020-04-05 16:36:26 -040044 sudo apt install software-properties-common
Steve DiBenedetto62a93942014-08-24 17:13:52 -060045
Davide Pesavento69857c32020-04-05 16:36:26 -040046Adding the NDN PPA
47~~~~~~~~~~~~~~~~~~
Steve DiBenedetto62a93942014-08-24 17:13:52 -060048
Davide Pesavento69857c32020-04-05 16:36:26 -040049After installing ``add-apt-repository``, run the following commands to add the `NDN PPA
50repository`_::
Steve DiBenedetto62a93942014-08-24 17:13:52 -060051
52 sudo add-apt-repository ppa:named-data/ppa
Davide Pesavento69857c32020-04-05 16:36:26 -040053 sudo apt update
Steve DiBenedetto62a93942014-08-24 17:13:52 -060054
55Installing NFD and other NDN packages
56~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
57
Davide Pesavento69857c32020-04-05 16:36:26 -040058After you have added the `NDN PPA repository`_, NFD and other NDN packages can be easily
59installed either using ``apt``, as shown below, or any other compatible package manager.
Steve DiBenedetto62a93942014-08-24 17:13:52 -060060
61::
62
Davide Pesavento69857c32020-04-05 16:36:26 -040063 sudo apt install nfd
Steve DiBenedetto62a93942014-08-24 17:13:52 -060064
Davide Pesavento69857c32020-04-05 16:36:26 -040065For the list of available packages, refer to the `NDN PPA repository`_ page.
Steve DiBenedetto62a93942014-08-24 17:13:52 -060066
67.. _NDN PPA repository: https://launchpad.net/~named-data/+archive/ppa
68
Davide Pesavento69857c32020-04-05 16:36:26 -040069Building from source
Steve DiBenedetto62a93942014-08-24 17:13:52 -060070--------------------
71
Davide Pesavento69857c32020-04-05 16:36:26 -040072Downloading from git
Steve DiBenedetto62a93942014-08-24 17:13:52 -060073~~~~~~~~~~~~~~~~~~~~
74
Davide Pesavento69857c32020-04-05 16:36:26 -040075The first step is to obtain the source code for NFD and its main dependency, the
76*ndn-cxx* library. If you do not want a development version of NFD, make sure you
Davide Pesavento3bc8e192022-12-31 01:40:11 -050077checkout the correct release tag (e.g., ``*-0.8.1``) from both repositories.
Steve DiBenedetto62a93942014-08-24 17:13:52 -060078
Davide Pesavento9f6a7d92020-10-06 15:21:48 -040079.. code-block:: sh
Steve DiBenedetto62a93942014-08-24 17:13:52 -060080
81 # Download ndn-cxx
Davide Pesavento69857c32020-04-05 16:36:26 -040082 git clone https://github.com/named-data/ndn-cxx.git
Steve DiBenedetto62a93942014-08-24 17:13:52 -060083
84 # Download NFD
Davide Pesavento69857c32020-04-05 16:36:26 -040085 git clone --recursive https://github.com/named-data/NFD.git
Alexander Afanasyev284257b2014-04-11 14:16:51 -070086
Alexander Afanasyev84dd4ca2017-10-15 14:56:08 -040087.. note::
Davide Pesavento69857c32020-04-05 16:36:26 -040088 While we strive to ensure that the latest version (git master branch) of NFD and ndn-cxx
89 always compiles and works properly, we cannot guarantee that there will be no issues.
90 If this is discovered to be the case, please use matching released versions (git tag or
91 tarball) of NFD and ndn-cxx instead.
Alexander Afanasyev84dd4ca2017-10-15 14:56:08 -040092
Alexander Afanasyev284257b2014-04-11 14:16:51 -070093Prerequisites
Steve DiBenedetto62a93942014-08-24 17:13:52 -060094~~~~~~~~~~~~~
Alexander Afanasyev284257b2014-04-11 14:16:51 -070095
Davide Pesaventobf4c1312023-02-23 20:32:01 -050096Install the `ndn-cxx library <https://docs.named-data.net/ndn-cxx/current/INSTALL.html>`__
Davide Pesavento69857c32020-04-05 16:36:26 -040097and its prerequisites.
Alexander Afanasyev284257b2014-04-11 14:16:51 -070098
Davide Pesavento69857c32020-04-05 16:36:26 -040099On Linux, NFD needs the following dependencies to enable optional features:
Junxiao Shie5e1e252014-12-13 22:07:35 -0700100
Davide Pesaventoe541d1b2022-08-17 15:10:32 -0400101- On **Debian** and **Ubuntu**:
Davide Pesavento9f6a7d92020-10-06 15:21:48 -0400102
103 .. code-block:: sh
Junxiao Shie5e1e252014-12-13 22:07:35 -0700104
Davide Pesavento17521592020-05-14 19:01:32 -0400105 sudo apt install libpcap-dev libsystemd-dev
106
Davide Pesavento9f6a7d92020-10-06 15:21:48 -0400107- On **CentOS** and **Fedora**:
108
109 .. code-block:: sh
Davide Pesavento17521592020-05-14 19:01:32 -0400110
Davide Pesavento17521592020-05-14 19:01:32 -0400111 sudo dnf install libpcap-devel systemd-devel
Alexander Afanasyev284257b2014-04-11 14:16:51 -0700112
Steve DiBenedetto62a93942014-08-24 17:13:52 -0600113Build
114~~~~~
115
Davide Pesavento9f6a7d92020-10-06 15:21:48 -0400116The following commands can be used to build and install NFD from source:
117
118.. code-block:: sh
Alexander Afanasyev284257b2014-04-11 14:16:51 -0700119
Davide Pesavento2150da82022-07-08 18:18:51 -0400120 ./waf configure
Alexander Afanasyev284257b2014-04-11 14:16:51 -0700121 ./waf
122 sudo ./waf install
123
Davide Pesavento69857c32020-04-05 16:36:26 -0400124If you have installed ndn-cxx and/or any other dependencies into a non-standard path,
125you may need to modify the ``PKG_CONFIG_PATH`` environment variable before running
Davide Pesavento9f6a7d92020-10-06 15:21:48 -0400126``./waf configure``. For example:
127
128.. code-block:: sh
Alexander Afanasyev284257b2014-04-11 14:16:51 -0700129
Davide Pesavento69857c32020-04-05 16:36:26 -0400130 export PKG_CONFIG_PATH="/custom/lib/pkgconfig:$PKG_CONFIG_PATH"
Alexander Afanasyev284257b2014-04-11 14:16:51 -0700131 ./waf configure
132 ./waf
133 sudo ./waf install
134
Davide Pesavento69857c32020-04-05 16:36:26 -0400135Refer to ``./waf --help`` for more options that can be used during the ``configure`` stage.
Steve DiBenedetto62a93942014-08-24 17:13:52 -0600136
Alexander Afanasyev508411e2014-12-16 13:27:59 -0800137.. note::
Davide Pesavento69857c32020-04-05 16:36:26 -0400138 If you are working on a source repository that has been compiled before, and you have
139 upgraded one of the dependencies, please execute ``./waf distclean`` to clear object files
140 and start over.
Alexander Afanasyev508411e2014-12-16 13:27:59 -0800141
Alexander Afanasyev26181532014-05-07 23:38:51 -0700142Debug symbols
Steve DiBenedetto62a93942014-08-24 17:13:52 -0600143~~~~~~~~~~~~~
Alexander Afanasyev26181532014-05-07 23:38:51 -0700144
Davide Pesavento17521592020-05-14 19:01:32 -0400145The default compiler flags include debug symbols in binaries. This should provide
146more meaningful debugging information if NFD or other tools happen to crash.
Alexander Afanasyev26181532014-05-07 23:38:51 -0700147
Davide Pesavento17521592020-05-14 19:01:32 -0400148If this is not desired, the default flags can be overridden to disable debug symbols.
149The following example shows how to completely disable debug symbols and configure
150NFD to be installed into ``/usr`` with configuration in the ``/etc`` directory.
Alexander Afanasyev26181532014-05-07 23:38:51 -0700151
Davide Pesavento9f6a7d92020-10-06 15:21:48 -0400152.. code-block:: sh
Alexander Afanasyev26181532014-05-07 23:38:51 -0700153
154 CXXFLAGS="-O2" ./waf configure --prefix=/usr --sysconfdir=/etc
155 ./waf
156 sudo ./waf install
157
Davide Pesavento69857c32020-04-05 16:36:26 -0400158For Ubuntu PPA packages, debug symbols are available in ``*-dbg`` packages.
Alexander Afanasyev84dd4ca2017-10-15 14:56:08 -0400159
Davide Pesavento69857c32020-04-05 16:36:26 -0400160Customizing the compiler
161~~~~~~~~~~~~~~~~~~~~~~~~
Alexander Afanasyev7c10b3b2015-01-20 12:24:27 -0800162
Davide Pesavento69857c32020-04-05 16:36:26 -0400163To build NFD with a different compiler (rather than the platform default), set the
164``CXX`` environment variable to point to the compiler binary. For example, to build
Davide Pesavento9f6a7d92020-10-06 15:21:48 -0400165with clang on Linux, use the following:
166
167.. code-block:: sh
Alexander Afanasyev7c10b3b2015-01-20 12:24:27 -0800168
Eric Newberry81a9a862016-12-27 22:59:27 -0700169 CXX=clang++ ./waf configure
Alexander Afanasyev7c10b3b2015-01-20 12:24:27 -0800170
Davide Pesavento69857c32020-04-05 16:36:26 -0400171Building the documentation
172~~~~~~~~~~~~~~~~~~~~~~~~~~
Alexander Afanasyev284257b2014-04-11 14:16:51 -0700173
Davide Pesavento9f6a7d92020-10-06 15:21:48 -0400174Tutorials and API documentation can be built using the following commands:
175
176.. code-block:: sh
Alexander Afanasyev284257b2014-04-11 14:16:51 -0700177
178 # Full set of documentation (tutorials + API) in build/docs
179 ./waf docs
180
Davide Pesavento69857c32020-04-05 16:36:26 -0400181 # Only tutorials in build/docs
Alexander Afanasyev284257b2014-04-11 14:16:51 -0700182 ./waf sphinx
183
Davide Pesavento69857c32020-04-05 16:36:26 -0400184 # Only API docs in build/docs/doxygen
185 ./waf doxygen
Alexander Afanasyev284257b2014-04-11 14:16:51 -0700186
Davide Pesavento17521592020-05-14 19:01:32 -0400187If ``sphinx-build`` is detected during ``./waf configure``, manpages will automatically
188be built and installed during the normal build process (i.e., during ``./waf`` and
189``./waf install``). By default, manpages will be installed into ``${PREFIX}/share/man``
190(the default value for ``PREFIX`` is ``/usr/local``). This location can be changed
191during the ``./waf configure`` stage using the ``--prefix``, ``--datarootdir``, or
192``--mandir`` options.
Alexander Afanasyev284257b2014-04-11 14:16:51 -0700193
Davide Pesavento17521592020-05-14 19:01:32 -0400194For further details, please refer to ``./waf --help``.
Steve DiBenedetto62a93942014-08-24 17:13:52 -0600195
Steve DiBenedetto62a93942014-08-24 17:13:52 -0600196Initial configuration
197---------------------
198
199.. note::
200 If you have installed NFD from binary packages, the package manager has already
Davide Pesavento69857c32020-04-05 16:36:26 -0400201 installed a working configuration and you can safely skip this section.
Steve DiBenedetto62a93942014-08-24 17:13:52 -0600202
203General
204~~~~~~~
205
Davide Pesavento69857c32020-04-05 16:36:26 -0400206After installing NFD from source, you need to create a proper configuration file.
207If the default installation directories were used with ``./waf configure``, this
208can be accomplished by simply copying the sample configuration file as follows::
Steve DiBenedetto62a93942014-08-24 17:13:52 -0600209
210 sudo cp /usr/local/etc/ndn/nfd.conf.sample /usr/local/etc/ndn/nfd.conf
211
212NFD Security
213~~~~~~~~~~~~
214
215NFD provides mechanisms to enable strict authorization for all management commands. In
Davide Pesavento69857c32020-04-05 16:36:26 -0400216particular, one can authorize only specific public keys to create new faces or change the
Steve DiBenedetto62a93942014-08-24 17:13:52 -0600217forwarding strategy for specific namespaces. For more information about how to generate
Davide Pesavento69857c32020-04-05 16:36:26 -0400218public/private key pairs, generate self-signed certificates, and use them to authorize
219NFD management commands, refer to the :ref:`How do I configure NFD security` FAQ question.
Steve DiBenedetto62a93942014-08-24 17:13:52 -0600220
Davide Pesavento69857c32020-04-05 16:36:26 -0400221In the sample configuration file, all security mechanisms are disabled for local clients,
222effectively allowing anybody on the local machine to issue NFD management commands.
223
224.. note::
225 The sample configuration file is intended only for demo purposes and should NOT be
226 used in production environments.
Steve DiBenedetto62a93942014-08-24 17:13:52 -0600227
228Running
229-------
230
Steve DiBenedetto62a93942014-08-24 17:13:52 -0600231Starting
232~~~~~~~~
233
Davide Pesavento69857c32020-04-05 16:36:26 -0400234If you have installed NFD from source, it is recommended to start NFD with the
235``nfd-start`` script::
Steve DiBenedetto62a93942014-08-24 17:13:52 -0600236
237 nfd-start
238
Davide Pesavento69857c32020-04-05 16:36:26 -0400239On macOS, this command may ask for your keychain password or ask "nfd wants to sign using
240key [xyz] in your keychain". Enter your keychain password and click "Always Allow".
Steve DiBenedetto62a93942014-08-24 17:13:52 -0600241
242Later, you can stop NFD with ``nfd-stop`` or by simply killing the ``nfd`` process.
243
Davide Pesavento2849fd42019-01-03 18:30:05 -0500244If you have installed NFD using a package manager, you can start and stop NFD using the
Davide Pesavento69857c32020-04-05 16:36:26 -0400245operating system's service manager, such as ``systemctl`` or ``launchctl``.
Steve DiBenedetto62a93942014-08-24 17:13:52 -0600246
Davide Pesavento69857c32020-04-05 16:36:26 -0400247Connecting to remote forwarders
248~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Steve DiBenedetto62a93942014-08-24 17:13:52 -0600249
Davide Pesavento69857c32020-04-05 16:36:26 -0400250To create a UDP tunnel to a remote instance of NFD, execute the following command
251in a terminal::
Steve DiBenedetto62a93942014-08-24 17:13:52 -0600252
Davide Pesavento69857c32020-04-05 16:36:26 -0400253 nfdc face create udp://<other-host>
Steve DiBenedetto62a93942014-08-24 17:13:52 -0600254
Davide Pesavento69857c32020-04-05 16:36:26 -0400255where ``<other-host>`` is the name or IP address of the other host (e.g.,
256``udp://ndn.example.net``). If successful, this will print something like::
Steve DiBenedetto62a93942014-08-24 17:13:52 -0600257
Junxiao Shi849e12a2017-08-02 00:14:57 +0000258 face-created id=308 local=udp4://10.0.2.15:6363 remote=udp4://131.179.196.46:6363 persistency=persistent
259
Davide Pesavento69857c32020-04-05 16:36:26 -0400260To add a route ``/ndn`` toward this remote forwarder, execute the following command
261in a terminal::
Junxiao Shi849e12a2017-08-02 00:14:57 +0000262
Davide Pesavento69857c32020-04-05 16:36:26 -0400263 nfdc route add /ndn udp://<other-host>
Junxiao Shi849e12a2017-08-02 00:14:57 +0000264
Davide Pesavento69857c32020-04-05 16:36:26 -0400265This will print::
Junxiao Shi849e12a2017-08-02 00:14:57 +0000266
267 route-add-accepted prefix=/ndn nexthop=308 origin=static cost=0 flags=child-inherit expires=never
Steve DiBenedetto62a93942014-08-24 17:13:52 -0600268
Davide Pesavento69857c32020-04-05 16:36:26 -0400269This indicates that NFD will forward all Interests that start with ``/ndn`` through the
270face to the other host. This forwards Interests to the other host, but does not provide
271a "back route" for the other host to forward Interests to you. For this, you can rely on
272the "automatic prefix propagation" feature of NFD or use the ``nfdc`` command on the other
273host to add the route.
Steve DiBenedetto62a93942014-08-24 17:13:52 -0600274
275Playing with NFD
276----------------
277
Davide Pesavento69857c32020-04-05 16:36:26 -0400278After you have installed, configured, and started NFD, you can demonstrate the features
279of NDN using the following applications and libraries.
Steve DiBenedetto62a93942014-08-24 17:13:52 -0600280
281Sample applications:
282
Davide Pesaventobf4c1312023-02-23 20:32:01 -0500283 + `Simple examples using the ndn-cxx library <https://docs.named-data.net/ndn-cxx/current/examples.html>`__
Davide Pesavento3bc8e192022-12-31 01:40:11 -0500284 + `Simple examples using the python-ndn library <https://python-ndn.readthedocs.io/en/latest/src/examples/basic_app.html>`__
Steve DiBenedetto62a93942014-08-24 17:13:52 -0600285
286Real applications and libraries:
287
Davide Pesavento17521592020-05-14 19:01:32 -0400288 + `ndn-tools - Essential NDN command-line tools <https://github.com/named-data/ndn-tools>`__
Davide Pesavento3bc8e192022-12-31 01:40:11 -0500289 + `ndn-traffic-generator - Simple traffic generator for NDN <https://github.com/named-data/ndn-traffic-generator>`__
290 + `ndn-svs - State Vector Sync library <https://github.com/named-data/ndn-svs>`__
291 + `PSync - Partial and full Sync library <https://github.com/named-data/PSync>`__