blob: 9a4b2f4dbcdbc11eb722f2bb155fbdb7b691563c [file] [log] [blame]
Steve DiBenedetto62a93942014-08-24 17:13:52 -06001Getting Started with NFD
2========================
Alexander Afanasyev284257b2014-04-11 14:16:51 -07003
Steve DiBenedetto62a93942014-08-24 17:13:52 -06004Installing NFD from Binaries
5----------------------------
6
7We provide NFD binaries for the supported platforms, which are the preferred installation
8method. In addition to simplifying installation, the binary release also includes
9automatic initial configuration and platform-specific tools to automatically start NFD and
10related daemons. In particular, on OS X NFD is controlled using `launchd
11<https://github.com/named-data/NFD/tree/master/contrib/osx-launchd>`__ and on Ubuntu using
12`upstart <https://github.com/named-data/NFD/tree/master/contrib/upstart>`__ mechanisms.
13In both cases, `nfd-start` and `nfd-stop` scripts are convenience wrappers for launchd and
14upstart.
15
16On OS X, NFD can be installed with MacPorts. Refer to :ref:`Install NFD Using the NDN
17MacPorts Repository on OS X` for more details.
18
Junxiao Shie5e1e252014-12-13 22:07:35 -070019On Ubuntu 12.04, 14.04, or 14.10 NFD can be installed from NDN PPA repository. Refer to
Steve DiBenedetto62a93942014-08-24 17:13:52 -060020:ref:`Install NFD Using the NDN PPA Repository on Ubuntu Linux`.
21
22Future releases could include support for other platforms. Please send us feedback on the
23platforms you're using, so we can prioritize our goals. We would also appreciate help
24packaging the current NFD release for other platforms.
25
26
27.. _Install NFD Using the NDN MacPorts Repository on OS X:
28
29Install NFD Using the NDN MacPorts Repository on OS X
30-----------------------------------------------------
31
32OS X users have the opportunity to seamlessly install and run NFD as well as other related
33applications via `MacPorts <https://www.macports.org/>`_. If you are not using MacPorts
34yet, go to the `MacPorts website <https://www.macports.org/install.php>`_ and install the
35MacPorts package.
36
37NFD and related ports are not part of the official MacPorts repository. In order to use
38these ports, you will need to add the NDN MacPorts repository to your local configuration.
39In particular, you will need to modify the list of source URLs for MacPorts. For example,
40if your MacPorts are installed in ``/opt/local``, add the following line to
41`/opt/local/etc/macports/sources.conf` before or after the default port repository:
42
43::
44
45 rsync://macports.named-data.net/macports/
46
47After this step, you can use ``sudo port selfupdate`` to fetch updated port definitions.
48
49The following command will install NFD using MacPorts:
50
51::
52
53 sudo port install nfd
54
55.. note::
56
57 You have to have XCode installed on your machine. This can be installed from the
58 AppStore (free) on OS X 10.7 or later. Older editions of OS X can download an
59 appropriate version of XCode from http://developer.apple.com.
60
61
62One advantage of using MacPorts is that you can easily upgrade NFD and other packages to
63the latest version. The following commands will do this job:
64
65::
66
67 sudo port selfupdate
68 sudo port upgrade nfd
69
70.. _Install NFD Using the NDN PPA Repository on Ubuntu Linux:
71
72Install NFD Using the NDN PPA Repository on Ubuntu Linux
73--------------------------------------------------------
74
Junxiao Shie5e1e252014-12-13 22:07:35 -070075NFD binaries and related tools for Ubuntu 12.04, 14.04, or 14.10 can be installed using PPA
Steve DiBenedetto62a93942014-08-24 17:13:52 -060076packages from named-data repository. First, you will need to add ``named-data/ppa``
77repository to binary package sources and update list of available packages.
78
79Preliminary steps if you haven't used PPA packages before
80~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
81
82To simplify adding new PPA repositories, Ubuntu provides ``add-apt-repository`` tool,
83which is not installed by default on some platforms.
84
85On Ubuntu **12.04**:
86
87::
88
89 sudo apt-get install python-software-properties
90
Junxiao Shie5e1e252014-12-13 22:07:35 -070091On Ubuntu **14.04** or **14.10**:
Steve DiBenedetto62a93942014-08-24 17:13:52 -060092
93::
94
95 sudo apt-get install software-properties-common
96
97
98Adding NDN PPA
99~~~~~~~~~~~~~~
100
101After installing ``add-apt-repository``, run the following command to add `NDN PPA
102repository`_.
103
104::
105
106 sudo add-apt-repository ppa:named-data/ppa
107 sudo apt-get update
108
109Installing NFD and other NDN packages
110~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
111
112After you have added `NDN PPA repository`_, NFD and other NDN packages can be easily
113installed in a standard way, i.e., either using ``apt-get`` as shown below or using any
114other package manager, such as Synaptic Package Manager:
115
116::
117
118 sudo apt-get install nfd
119
120For the list of available packages, refer to `NDN PPA repository`_ homepage.
121
122.. _NDN PPA repository: https://launchpad.net/~named-data/+archive/ppa
123
124Building from Source
125--------------------
126
127Downloading from Git
128~~~~~~~~~~~~~~~~~~~~
129
130The first step is to obtain the source code for ``NFD`` and, its main dependency, the
131``ndn-cxx`` library. If you are not planning to work with the bleeding edge code, make
132sure you checkout the correct release tag (e.g., ``*-0.2.0``) for both repositories:
133
134::
135
136 # Download ndn-cxx
137
138 git clone https://github.com/named-data/ndn-cxx
139 cd ndn-cxx
140 git checkout ndn-cxx-0.2.0
141
142 cd ..
143
144 # Download NFD
145
146 git clone --recursive https://github.com/named-data/NFD
147 cd NFD
148 git checkout NFD-0.2.0
Alexander Afanasyev284257b2014-04-11 14:16:51 -0700149
150Prerequisites
Steve DiBenedetto62a93942014-08-24 17:13:52 -0600151~~~~~~~~~~~~~
Alexander Afanasyev284257b2014-04-11 14:16:51 -0700152
Steve DiBenedetto62a93942014-08-24 17:13:52 -0600153- Install the `ndn-cxx library <http://named-data.net/doc/ndn-cxx/current/INSTALL.html>`_
154 and its requirements
Alexander Afanasyev284257b2014-04-11 14:16:51 -0700155
Junxiao Shie5e1e252014-12-13 22:07:35 -0700156- ``pkg-config``
157
158 On OS X 10.8, 10.9, and 10.10 with MacPorts:
159
160 ::
161
162 sudo port install pkgconfig
163
164 On Ubuntu >= 12.04:
165
166 ::
167
168 sudo apt-get install pkg-config
169
Alexander Afanasyev284257b2014-04-11 14:16:51 -0700170- ``libpcap``
171
Junxiao Shie5e1e252014-12-13 22:07:35 -0700172 Comes with the base system on OS X 10.8, 10.9, and 10.10.
Alexander Afanasyev284257b2014-04-11 14:16:51 -0700173
174 On Ubuntu >= 12.04:
175
176 ::
177
178 sudo apt-get install libpcap-dev
179
180To build manpages and API documentation:
181
182- ``doxygen``
183- ``graphviz``
184- ``python-sphinx``
185
Junxiao Shie5e1e252014-12-13 22:07:35 -0700186 On OS X 10.8, 10.9, and 10.10 with MacPorts:
Alexander Afanasyev284257b2014-04-11 14:16:51 -0700187
188 ::
189
190 sudo port install doxygen graphviz py27-sphinx sphinx_select
191 sudo port select sphinx py27-sphinx
192
193 On Ubuntu >= 12.04:
194
195 ::
196
197 sudo apt-get install doxygen graphviz python-sphinx
198
Alexander Afanasyev284257b2014-04-11 14:16:51 -0700199
Junxiao Shie5e1e252014-12-13 22:07:35 -0700200Besides officially supported platforms, NFD is known to work on: Fedora 20, CentOS 6/7, Gentoo Linux,
Steve DiBenedetto62a93942014-08-24 17:13:52 -0600201Raspberry Pi, OpenWRT, FreeBSD 10.0, and several other platforms. We are soliciting help
202with documenting common problems / pitfalls in installing/using NFD on different platforms
203on `NFD Wiki
204<http://redmine.named-data.net/projects/nfd/wiki/Wiki#Installation-experiences-for-selected-platforms>`__.
205
206
207Build
208~~~~~
209
210The following basic commands should be used to build NFD on Ubuntu:
Alexander Afanasyev284257b2014-04-11 14:16:51 -0700211
212::
213
214 ./waf configure
215 ./waf
216 sudo ./waf install
217
Alexander Afanasyev6db058c2014-11-13 16:46:25 -0800218If you have installed `ndn-cxx` library and/or other dependencies into a non-standard paths, you
219may need to modify ``PKG_CONFIG_PATH`` environment variable before running ``./waf configure``.
220For example,
Alexander Afanasyev284257b2014-04-11 14:16:51 -0700221
222::
223
Alexander Afanasyev6db058c2014-11-13 16:46:25 -0800224 export PKG_CONFIG_PATH=/custom/lib/pkgconfig:$PKG_CONFIG_PATH
Alexander Afanasyev284257b2014-04-11 14:16:51 -0700225 ./waf configure
226 ./waf
227 sudo ./waf install
228
Steve DiBenedetto62a93942014-08-24 17:13:52 -0600229
230Refer to ``./waf --help`` for more options that can be used during ``configure`` stage and
231how to properly configure and run NFD.
232
Alexander Afanasyev26181532014-05-07 23:38:51 -0700233Debug symbols
Steve DiBenedetto62a93942014-08-24 17:13:52 -0600234~~~~~~~~~~~~~
Alexander Afanasyev26181532014-05-07 23:38:51 -0700235
236The default compiler flags enable debug symbols to be included in binaries. This
237potentially allows more meaningful debugging if NFD or other tools happen to crash.
238
239If it is undesirable, default flags can be easily overridden. The following example shows
240how to completely disable debug symbols and configure NFD to be installed into ``/usr``
241with configuration in ``/etc`` folder.
242
243::
244
245 CXXFLAGS="-O2" ./waf configure --prefix=/usr --sysconfdir=/etc
246 ./waf
247 sudo ./waf install
248
Alexander Afanasyev284257b2014-04-11 14:16:51 -0700249Building documentation
Steve DiBenedetto62a93942014-08-24 17:13:52 -0600250~~~~~~~~~~~~~~~~~~~~~~
Alexander Afanasyev284257b2014-04-11 14:16:51 -0700251
252NFD tutorials and API documentation can be built using the following commands:
253
254::
255
256 # Full set of documentation (tutorials + API) in build/docs
257 ./waf docs
258
259 # Only tutorials in `build/docs`
260 ./waf sphinx
261
262 # Only API docs in `build/docs/doxygen`
263 ./waf doxgyen
264
265
Steve DiBenedetto62a93942014-08-24 17:13:52 -0600266Manpages are automatically created and installed during the normal build process (e.g.,
267during ``./waf`` and ``./waf install``), if ``python-sphinx`` module is detected during
268``./waf configure`` stage. By default, manpages are installed into
Alexander Afanasyev284257b2014-04-11 14:16:51 -0700269``${PREFIX}/share/man`` (where default value for ``PREFIX`` is ``/usr/local``). This
270location can be changed during ``./waf configure`` stage using ``--prefix``,
271``--datarootdir``, or ``--mandir`` options.
272
273For more details, refer to ``./waf --help``.
Steve DiBenedetto62a93942014-08-24 17:13:52 -0600274
275
276Initial configuration
277---------------------
278
279.. note::
280 If you have installed NFD from binary packages, the package manager has already
281 installed initial configuration and you can safely skip this section.
282
283General
284~~~~~~~
285
286After installing NFD from source, you need to create a proper config file. If default
287location for ``./waf configure`` was used, this can be accomplished by simply copying the
288sample configuration file:
289
290::
291
292 sudo cp /usr/local/etc/ndn/nfd.conf.sample /usr/local/etc/ndn/nfd.conf
293
294NFD Security
295~~~~~~~~~~~~
296
297NFD provides mechanisms to enable strict authorization for all management commands. In
298particular, one can authorize only specific public keys to create new Faces or change the
299forwarding strategy for specific namespaces. For more information about how to generate
300private/public key pair, generate self-signed certificate, and use this self-signed
301certificate to authorize NFD management commands refer to :ref:`How to configure NFD
302security` FAQ question.
303
304In the sample configuration file, all authorizations are disabled, effectively allowing
305anybody on the local machine to issue NFD management commands. **The sample file is
306intended only for demo purposes and MUST NOT be used in a production environment.**
307
308Running
309-------
310
311**You should not run ndnd or ndnd-tlv, otherwise NFD will not work correctly**
312
313Starting
314~~~~~~~~
315
316In order to use NFD, you need to start two separate daemons: ``nfd`` (the forwarder
317itself) and ``nrd`` (RIB manager that will manage all prefix registrations). The
318recommended way is to use `nfd-start` script:
319
320::
321
322 nfd-start
323
324On OS X it may ask for your keychain password or ask ``nfd/nrd wants to sign using key in
325your keychain.`` Enter your keychain password and click Always Allow.
326
327Later, you can stop NFD with ``nfd-stop`` or by simply killing the ``nfd`` process.
328
329
330Connecting to remote NFDs
331~~~~~~~~~~~~~~~~~~~~~~~~~
332
333To create a UDP or TCP tunnel to remote NFD and create route toward it, use the following
334command in terminal:
335
336::
337
338 nfdc register /ndn udp://<other host>
339
340where ``<other host>`` is the name or IP address of the other host (e.g.,
341``udp://spurs.cs.ucla.edu``). This outputs:
342
343::
344
345 Successful in name registration: ControlParameters(Name: /ndn, FaceId: 260, Origin: 255, Cost: 0, Flags: 1, )
346
347The ``/ndn`` means that NFD will forward all Interests that start with ``/ndn`` through
348the face to the other host. If you only want to forward Interests with a certain prefix,
349use it instead of ``/ndn``. This only forwards Interests to the other host, but there is
350no "back route" for the other host to forward Interests to you. For that, you must go to
351the other host and use ``nfdc`` to add the route.
352
353The "back route" can also be automatically configured with ``nfd-autoreg``. For more
354information refer to :doc:`manpages/nfd-autoreg`.
355
356Playing with NFD
357----------------
358
359After you haved installed, configured, and started NFD, you can try to install and play
360with the following:
361
362Sample applications:
363
364- `Simple examples in ndn-cxx
365 library <http://named-data.net/doc/ndn-cxx/0.2.0/examples.html>`__.
366 If you have installed ndn-cxx from source, you already have compiled
367 these:
368
369 + examples/producer
370 + examples/consumer
371 + examples/consumer-with-timer
372
373 + tools/ndncatchunks3
374 + tools/ndnputchunks3
375
376- `Introductory examples of
377 NDN-CCL <http://redmine.named-data.net/projects/nfd/wiki/Getting_Started_-_Common_Client_Libraries#Install-the-Common-Client-Library>`__
378
379Real applications and libraries:
380
381 + `ndn-tlv-ping - Reachability Testing Tool for NDN
382 <https://github.com/named-data/ndn-tlv-ping>`__
383 + `ndn-traffic-generator - Traffic Generator For
384 NDN <https://github.com/named-data/ndn-traffic-generator>`__
385 + `repo-ng - Next generation of NDN
386 repository <https://github.com/named-data/repo-ng>`__
387 + `ChronoChat - Multi-user NDN chat
388 application <https://github.com/named-data/ChronoChat>`__
389 + `ChronoSync - Sync library for multiuser realtime applications for
390 NDN <https://github.com/named-data/ChronoSync>`__