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