blob: ddbf4e6fbd2fcde01aa553d73bab0fd29f2cfada [file] [log] [blame]
David Arjona2e6c8bb2018-11-14 16:27:09 -06001==========================================================
2A beginners guide to installing and testing NLSR on Fedora
3==========================================================
4
5:Authors: David Arjona-Villicaña, Octavio Renteria-Vidales, Ashlesh Gawande
6:Date: November, 2018
7:Abstract: This is an easy to follow guide on how to install and test the NLSR routing protocol for NDN using two Fedora 28 machines. The commands and the paths used in this guide have been tested only in Fedora, although a similar procedure should be used for other linux systems. Specifically, the testing section `5 <#test>`__) is platform independent. Therefore users who have NLSR already installed may skip to this section. Since neither NDN, NLSR nor Fedora are static software developments, it is expected that some commands and features in this guide will change over time. However, this guide is as accurate as it could be at the time it was published.
8
9.. role:: raw-latex(raw)
10 :format: latex
11
12
13.. _intro:
14
151. Introduction
16===============
17
18The following instructions are based on the information provided at the
19Named Data Networking project web page [NDNmain]_.
20Before installing NLSR it is necessary to install different libraries
21and programs: ndn-cxx, NFD and ChronoSync. This document describes the
22necessary steps to correctly install these programs `2 <#ndncxx>`__,
23`3 <#nfd>`__ and `4 <#nlsr>`__) and a brief guide on how to configure
24and test NLSR using a simple two-node network `5 <#test>`__).
25
26Many of the commands in this guide need to be executed as *root*.
27Starting from Fedora 28, there is no need to set a root user
28[Kolman2018]_. However it is possible to define it,
29using the following command:
30
31::
32
33 $ sudo -i
34
35And then using the *passwd* command to set up a password. After setting
36up the root user, it is possible to become root by employing the
37following command and providing the root password when prompted:
38
39::
40
41 $ su -
42
43Fedora employs the *dnf* command to install and verify installed
44packages. The following commands may become useful during the
45installation process and should be executed as root:
46
47- To verify that all installed packages are up to date
48
49 ::
50
51 $ dnf update
52
53- To verify if a package is already installed in the system
54
55 ::
56
57 $ dnf list --installed <package-name>
58
59- To search for information about a package or family of packages (not
60 necessarily installed in the system).
61
62 ::
63
64 $ dnf info <package-name>
65
66- To install a package in the system.
67
68 ::
69
70 $ dnf install <package-name>
71
72It is also a good installation practice to download and install all the
73NDN programs in a common directory. Therefore, it is recommended to
74create a directory at the home directory where all the following
75programs may get installed. The name of this directory is not important.
76However, the following are provided as suggestions: project, NDNproject,
77NDNprograms. Each of the programs in the following sections should be
78downloaded to their own directory using the *git* command, and then
79compiled in this directory.
80
81.. _ndncxx:
82
832. Installing ndn-cxx
84=====================
85
862.1 Before installing ndn-cxx
87-----------------------------
88
89An updated list of the packages and programs that need to be installed
90before installing ndn-cxx, is provided at [NDN-cxx]_.
91This list is also reproduced bellow with the commands to verify that all
92the packages have been installed in the system. The following commands
93should be run as root:
94
95#. gcc and gcc-c++
96
97 ::
98
99 $ dnf list --installed gcc
100 $ dnf list --installed gcc-c++
101
102#. Python version 2.6 or later
103
104 ::
105
106 $ python -V
107
108#. libsqlite3
109
110 ::
111
112 $ dnf list --installed sqlite
113 $ dnf list --installed sqlite-devel
114
115#. openssl version 1.0.1 or later
116
117 ::
118
119 $ openssl version
120 $ dnf list --installed openssl-devel
121
122#. pkgconf that replaces pkg-config
123
124 ::
125
126 $ dnf list --installed pkgconf*
127
128#. boost libraries version 1.54 or later
129
130 ::
131
132 $ dnf list --installed boost
133 $ dnf list --installed boost-devel
134
135#. doxygen
136
137 ::
138
139 $ dnf list --installed doxygen
140
141#. graphviz
142
143 ::
144
145 $ dnf list --installed graphviz
146
147#. python2-sphinx that replaces python-sphinx
148
149 ::
150
151 $ dnf list --installed python2-sphinx
152
153#. After verifying that the python-sphinx package has been installed, it
154 is necessary to run the following two commands:
155
156 ::
157
158 $ pip-3 install sphinxcontrib-doxylink
159 $ pip install sphinxcontrib-googleanalytics
160
161 Note: When the two previous commands are run before correctly
162 installing python-sphinx, the following error message is produced
163 when trying to install this latter package: Error unpacking rpm
164 package python2-urllib3-1.22-3.fc27.noarch”. To fix this problem, it
165 is necessary to run the following commands before installing
166 python-sphinx again:
167
168 ::
169
170 $ dnf remove python2-sphinx
171 $ pip uninstall sphinxcontrib-googleanalytics
172 $ pip-3 uninstall sphinxcontrib-doxylink
173 $ pip uninstall urllib3
174
175#. dpkg-architecture
176
177 ::
178
179 $ dnf list --installed dpkg
180 $ dnf list --installed dpkg-dev
181
182#. git and valgrind, which is used when installing NFD (§
183 `3 <#nfd>`__).
184
185 ::
186
187 $ dnf list --installed valgrind
188 $ dnf list --installed valgrind-devel
189 $ dnf list --installed git
190
1912.2 Downloading and installing ndn-cxx
192--------------------------------------
193
194The *git* command allows to download the ndn-cxx library in its own
195folder, also called *ndn-cxx*. Therefore it is recommended to execute
196this command at the directory created at § `1 <#intro>`__:
197
198::
199
200 $ git clone --depth 1 https://github.com/named-data/ndn-cxx.git
201
202Move to the ndn-cxx directory:
203
204::
205
206 $ cd ndn-cxx
207
208Use the following command to verify that everything is ready to compile.
209If an error message displays, it is necessary to fix it before
210continuing:
211
212::
213
214 $ ./waf configure --with-examples
215
216Compile the ndn-cxx library and install the compiled files at the
217systems directories:
218
219::
220
221 $ ./waf
222 $ sudo ./waf install
223
2242.3 Configuring ndn-cxx
225-----------------------
226
227The commands in this subsection need to be run as root. First, it is
228necessary to create file *local.conf*, which contains a line with the
229location for the ndn-cxx library:
230
231::
232
233 $ echo /usr/local/lib64 >> /etc/ld.so.conf.d/local.conf
234
235The following command configures the libraries:
236
237::
238
239 $ ldconfig -v | grep ndn
240
241This command should display a line similar to the following:
242
243::
244
245 libndn-cxx.so.0.6.1 -> libndn-cxx.so.0.6.1
246
247Configure the NDN path:
248
249::
250
251 $ echo export PKG_CONFIG_PATH=/usr/local/lib64/pkgconfig >>
252 /etc/profile.d/ndn.sh
253
254After this command has been executed, it is necessary to apply the
255changes by either logging out and back in, and then running the
256following command:
257
258::
259
260 $ printenv | grep PKG
261
262Or by executing the following command:
263
264::
265
266 $ ./etc/profile.d/ndn.sh
267
268For more information and examples about how to compile and configure
269this library, users should read the ndn-cxx guide at
270[NDN-cxx]_.
271
272.. _nfd:
273
2743. Installing NFD
275=================
276
2773.1 Before installing NFD
278-------------------------
279
280An updated list of the packages and programs that need to be installed
281before NFD is provided at [NDNNFD]_. Before installing
282NFD it is necessary to verify that the following packages are installed:
283
284#. libpcap libraries
285
286 ::
287
288 $ dnf list --installed libpcap
289 $ dnf list --installed libpcap-devel
290
2913.2 Downloading and installing NFD
292----------------------------------
293
294This library is downloaded and installed in a folder called *NFD*, which
295should be created at the directory defined at § `1 <#intro>`__. The
296following commands need to be run as a regular user:
297
298::
299
300 $ git clone --depth 1 https://github.com/named-data/NFD.git
301 $ cd NFD
302 $ ./waf configure
303
304If the previous command prints an error message saying that waf cannot
305find WebSocket, it is necessary to follow the instructions provided by
306this same output, which tells the user to execute either of the
307following two set of commands:
308
309::
310
311 $ git submodule init && git submodule update
312
313Or:
314
315::
316
317 $ mkdir websocketpp
318 $ curl -L https://github.com/zaphoyd/websocketpp/archive/0.7.0.tar.gz
319 > websocket.tar.gz
320 $ tar zxf websocket.tar.gz -C websocketpp/ --strip 1
321
322After executing either of these instructions, complete the configuration
323by running *./waf configure* again. Then complete the installation by
324means of the following commands:
325
326::
327
328 $ ./waf
329 $ sudo ./waf install
330
3313.3 Configuring NFD
332-------------------
333
334Create a configuration file by running the following command as root:
335
336::
337
338 $ cp /usr/local/etc/ndn/nfd.conf.sample /usr/local/etc/ndn/nfd.conf
339
340After the configuration file has been created, NFDs behavior may be
341changed by modifying this file. Once the configuration file has been
342created, it is recommended to start NFD by using the following command:
343
344::
345
346 $ nfd-start
347
348This command does not properly allow to employ the command window to
349enter new commands; however it displays the NFD logs. Therefore, it is
350recommended to open a new command window. This second window may be used
351to verify NDFs status and then stop NFD by using the following
352commands:
353
354::
355
356 $ nfd-status
357 $ nfd-stop
358
359.. _nlsr:
360
3614. Installing NLSR
362==================
363
3644.1 Installing ChronoSync
365-------------------------
366
367Before installing NLSR, it is necessary to first download and install
368ChronoSync, which is a library that allows NLSR routers to verify that
369their routing information coincides. More information about ChronoSync
370may be found at [Chronosync]_. This library may be
371installed by running the following commands as a regular user and at the
372directory defined at § `1 <#intro>`__:
373
374::
375
376 $ git clone --depth 1 https://github.com/named-data/ChronoSync.git
377 $ cd ChronoSync
378 $ ./waf configure
379 $ ./waf
380 $ sudo ./waf install
381
382The following command needs to be used again to configure the libraries:
383
384::
385
386 $ sudo ldconfig -v | grep ndn
387
388This command should display a line similar to the following:
389
390::
391
392 libChronoSync.so.0.5.0 -> libChronoSync.so.0.5.0
393
3944.2 Downloading and installing NLSR
395-----------------------------------
396
397NLSR is downloaded and installed in a folder called *NLSR* which should
398be created at the directory defined at § `1 <#intro>`__. The following
399commands need to be run as a regular user:
400
401::
402
403 $ git clone --depth 1 https://github.com/named-data/NLSR.git
404 $ cd NLSR
405 $ ./waf configure
406 $ ./waf
407 $ sudo ./waf install
408
4094.3 Configuring NLSR
410--------------------
411
412Create and configure the following directory by running the following
413commands as root:
414
415::
416
417 $ mkdir /var/lib/nlsr
418 $ chmod 777 /var/lib/nlsr
419
420.. _test:
421
4225. Configuring and Testing NLSR
423===============================
424
425To test NLSR, the first step is to configure the keys and certificates
426that implement a secure communication between the routers. Then it is
427necessary to verify that the computers in the test network are
428connected, that NFD is running and the faces between the computers are
429configured. Finally, the NLSR configuration file has to be edited before
430running NLSR. The following subsections are provided as a guide to
431define and configure a simple computer network between two computers:
432router1 and router2.
433
434.. _security:
435
4365.1 Setting up the security
437---------------------------
438
439Configuring security in an NDN network requires to generate, exchange
440and install, keys and certificates between the root, site, operator and
441router computers that form the network
442[NLSRsecconf]_, [NLSRdevguide]_, although in practice, it
443is possible to keep more than one of these entities in a single machine.
444The following example and *Figure 1* show how to configure security
445for a single router, called Router X. In this example, the root, site,
446operator and Router X are in different computers:
447
448.. figure:: security_comp.png
449 :alt: Security configuration example for Router X.
450 :width: 19cm
451 :align: center
452
453 Fig. 1. Security configuration example for Router X.
454
455
456#. At the root server, generate the root key:
457
458 ::
459
460 $ ndnsec-key-gen /ndn/ > root.key
461
462#. Generate the certificate for the root key at the root server:
463
464 ::
465
466 $ ndnsec-cert-dump -i /ndn/ > root.cert
467
468#. Install the root certificate at the root server:
469
470 ::
471
472 $ ndnsec-cert-install -f root.cert
473
474#. At the site server, generate the site key:
475
476 ::
477
478 $ ndnsec-key-gen /ndn/edu/uaslp > site.key
479
480#. Copy the site key to the root server and generate the certificate for
481 the site server:
482
483 ::
484
485 $ ndnsec-cert-gen -s /ndn/ site.key > site.cert
486
487#. Copy the site certificate to the site server and install it:
488
489 ::
490
491 $ ndnsec-cert-install -f site.cert
492
493#. At the operator server, generate the operator key:
494
495 ::
496
497 $ ndnsec-key-gen /ndn/edu/uaslp/%C1.Operator/op > op.key
498
499#. Copy the operator key to the site server and generate the certificate
500 for the operator server:
501
502 ::
503
504 $ ndnsec-cert-gen -s /ndn/edu/uaslp op.key > op.cert
505
506#. Copy the operator certificate to the operator server and install it:
507
508 ::
509
510 $ ndnsec-cert-install -f op.cert
511
512#. At the router, generate the router key:
513
514 ::
515
516 $ ndnsec-key-gen /ndn/edu/uaslp/%C1.Router/routerX > routerX.key
517
518#. Copy the router key to the operator server and generate the
519 certificate for the router:
520
521 ::
522
523 $ ndnsec-cert-gen -s /ndn/edu/uaslp/%C1.Operator/op routerX.key >
524 routerX.cert
525
526#. Copy the router certificate to the router and install it:
527
528 ::
529
530 $ ndnsec-cert-install -f routerX.cert
531
532In the previous steps, the *%C1.Router* and *%C1.Operator* labels are
533NDN keywords and should not be changed. These labels will be also used
534by the configuration file `5.4 <#configfile>`__)
535
536The following command may be used to verify that the certificates have
537been installed in a computer:
538
539::
540
541 $ ndnsec-list
542
543This guide recommends that one machine functions as the root, site,
544operator and router1, while a different computer only functions as
545router2. *Figure 2* shows this
546configuration. For router1, the twelve steps described before need to be
547executed except for exchanging files between computers. For the router2,
548only steps 10 to 12 are needed to generate this routers certificate.
549
550Additionally, the following command may be used to print a list and a
551brief description of all the *ndnsec* commands:
552
553::
554
555 $ man ndnsec
556
557
558.. figure:: netwk1.png
559 :alt: Example network.
560 :width: 19cm
561 :align: center
562
563 Fig. 2. Example network.
564
565
5665.2 Configuring the network
567---------------------------
568
569The first step is to configure the physical network. If two computers
570are going to get connected using a single Ethernet cable, it is
571necessary to verify that this cable is a crossover. The other option is
572to employ a switch between two computers that are then connected using
573two regular Ethernet cables.
574
575After the physical network has been assembled, it is necessary to
576configure the network addresses and cards for all the computers in the
577network. It is important to remember that computers that are connected
578to each other should use the same subnetwork address. It is possible to
579verify the network configuration in a Linux computer by means of the *ip
580addr* command
581
582Once the physical network and network cards have been configured, it is
583necessary to verify that the computers can communicate with each other.
584The simplest way to do this is by using the *ping* command:
585
586::
587
588 $ ping <remote-ip-address>
589
5905.3 Starting and configuring NFD
591--------------------------------
592
593To start and configure NFD it is necessary to open two terminal windows.
594The first one will be used to start NFD by means of the *nfd-start*
595command. This terminal will also display the logs that NFD generates. By
596default, NFD only generates informational logs (INFO). However, it is
597possible to obtain different levels of verbosity for these logs. These
598levels can be set before NFD starts by editing the
599*/usr/local/etc/ndn/nfd.conf* file. Open this file using a regular text
600editor, read the information provided about logging and then modify the
601*default-level* variable at the *log* section according to the
602instructions provided in the file. Additional information about NFD
603configuration may be found at [NDNNFDusage]_.
604
605The second terminal will be used to monitor the NFD status:
606
607::
608
609 $ nfd-status
610
611Employ the following command to configure each face that a computer uses
612to connect to a neighboring computer:
613
614::
615
616 $ nfdc face create udp4://<remote-ip-address>
617
618The face id may be displayed by running either *nfd-status* or:
619
620::
621
622 $ nfdc face list
623
624The status of the face may be verified by using the following command:
625
626::
627
628 $ nfdc face show id <face-id>
629
630After finishing NLSR testing, it is necessary to destroy the face before
631stopping NFD. This operation is described at § `5.6 <#turn_off>`__. For
632the two computer network provided as an example (*Figure 2*), it is necessary that both
633machines run NFD and that each one configures a face that connects to
634the other machine.
635
636.. _configfile:
637
6385.4 Setting up the configuration file
639-------------------------------------
640
641Instructions on how to use the configuration file are already provided
642at the NLSRs Router Configuration page [NLSRrtrconf]_.
643Read the information in this page to understand NLSR router
644configuration. The following text describes the instructions that have
645been modified at the default nlsr.conf file for router1:
646
647::
648
649 ; AT general SECTION:
650 {
651 network /ndn/ ; name of the network
652 site /edu/uaslp ; name of the site
653 router /%C1.Router/router1 ; name of the router: router1
654 }
655
656 ;AT neighbors SECTION:
657 neighbors
658 {
659 neighbor
660 {
661 name /ndn/edu/uaslp/%C1.Router/router2 ; Neighbor router: router2
662 face-uri udp://140.220.80.124 ; face to the neighbor
663 link-cost 30 ; cost of the link
664 }
665 }
666
667 ; AT advertising SECTION:
668 advertising
669 {
670 prefix /ndn/edu/uaslp/office/bldg1 ; Advertising destinations
671 prefix /ndn/edu/uaslp/office/bldg2 ; for router1
672 }
673
674 ; AT security SECTION:
675 security
676 {
677 validator
678 {
679 ...
680 trust-anchor
681 {
682 type file
683 file-name "root.cert" ; root certificate file
684 }
685 }
686
687 prefix-update-validator
688 {
689 ...
690 trust-anchor
691 {
692 type file
693 file-name "site.cert" ; site certificate file
694 }
695 }
696
697 cert-to-publish "root.cert" ; root certificate file
698
699 cert-to-publish "site.cert" ; site certificate file
700
701 cert-to-publish "op.cert" ; operator certificate file
702
703 cert-to-publish "router1.cert" ; router1 certificate file
704 }
705
706The following text shows the modified instructions for router2:
707
708::
709
710 ; AT general SECTION:
711 {
712 network /ndn/ ; name of the network
713 site /edu/uaslp ; name of the site
714 router /%C1.Router/router2 ; name of the router: router2
715 }
716
717 ;AT neighbors SECTION:
718 neighbors
719 {
720 neighbor
721 {
722 name /ndn/edu/uaslp/%C1.Router/router1 ; Neighbor router: router1
723 face-uri udp://140.220.80.121 ; face to the neighbor
724 link-cost 30 ; cost of the link
725 }
726 }
727
728 ; AT advertising SECTION:
729 advertising
730 {
731 prefix /ndn/edu/uaslp/labs/networks ; Advertising destinations
732 prefix /ndn/edu/uaslp/labs/hardware ; for router2
733 }
734
735 ; AT security SECTION:
736 security
737 {
738 validator
739 {
740 ...
741 trust-anchor
742 {
743 type file
744 file-name "root.cert" ; root certificate file
745 } ; this file needs to be copied to
746 } ; router2
747
748 prefix-update-validator
749 {
750 ...
751 trust-anchor
752 {
753 type file
754 file-name "site.cert" ; site certificate file
755 } ; this file needs to be copied to
756 } ; router2
757
758 ...
759 cert-to-publish "router2.cert" ; router2 certificate file
760 }
761
762Notice that files *root.cert* and *site.cert*, which were generated at
763router1, need to be copied to router2. Also notice that the *%C1.Router*
764and *%C1.Operator* keywords employed at § `5.1 <#security>`__ are also
765referenced by these configuration files.
766
767.. _starting_nlsr:
768
7695.5 Starting NLSR
770-----------------
771
772It is recommended to open a third command terminal and run NLSR in this
773window. After the NLSR configuration file has been edited and saved as
774*nlsr.conf*, it is possible to start NLSR by running either of the
775following two commands:
776
777::
778
779 $ nlsr
780 $ nlsr -f <configuration-file>
781
782However, to verify what is NLSR doing, it becomes necessary to employ
783NLSRs logging facility [NLSRstarting]_. A brief
784description on how to use NDNs logging facility may be displayed by
785entering the *man ndn-log* command. This guide recommends using one of
786the following two instructions to start NLSR:
787
788::
789
790 $ export NDN_LOG=nlsr.*=TRACE && nlsr
791 $ export NDN_LOG=nlsr.*=TRACE && nlsr -f <configuration-file>
792
793The second terminal window may be used to run *nfd-status* again and it
794should be possible to verify that the status has changed, specially at
795the FIB and RIB sections of the generated report.
796
797.. _turn_off:
798
7995.6 Turning everything off
800--------------------------
801
802In order to stop NLSR and NFD, the following sequence of events is
803recommended:
804
805#. Stop NLSR by pressing the Ctrl+C keys at the third terminal window.
806
807#. Destroy the face to the remote computers using either of the
808 following two commands at the second terminal window:
809
810 ::
811
812 $ nfdc face destroy <face-id>
813 $ nfdc face destroy udp4://<remote-ip-address>
814
815#. Stop NFD by entering the following command at the second terminal
816 window:
817
818 ::
819
820 $ nfd-stop
821
822#. The crossover Ethernet cable may be unplugged and the computers’
823 network configuration restored to its original settings.
824
8255.7 Where to go from here
826-------------------------
827
828Users interested in building and configuring larger networks may want to
829take a look at the NDN Ansible repository
830[NDNAnsible]_. This repository uses Ansible, which is a
831configuration management tool, to manage the official NDN testbed
832deployment [NDNTestbed]_.
833
834
835.. [NDNmain] *Named Data Networking*, http://named-data.net/, March 2018.
836
837.. [Kolman2018] M. Kolman. *Anaconda improvements in Fedora 28*, Fedora Magazine, June 2018.
838
839.. [NDN-cxx] *Getting started with ndn-cxx*, http://named-data.net/doc/ndn-cxx/current/INSTALL.html, April 2018.
840
841.. [NDNNFD] *Getting started with NFD*, http://named-data.net/doc/NFD/current/INSTALL.html, April 2018.
842
843.. [NDNNFDusage] *NFD usage*, http://named-data.net/doc/NFD/current/manpages/nfd.html, May 2018.
844
845.. [Chronosync] Z. Zhu and A. Afanasyev. *Lets ChronoSync: Decentralized dataset state synchronization in Named Data Networking*, in IEEE ICNP, October 2013.
846
847.. [NLSRsecconf] *NLSR Security Configuration*, http://named-data.net/doc/NLSR/current/SECURITY-CONFIG.html June 2018.
848
849.. [NLSRdevguide] V. Lehman, M. Chowdhury, N. Gordon, A. Gawande. *NLSR Developers Guide*, University of Memphis, November 2017.
850
851.. [NLSRrtrconf] *NLSR Router Configuration*, http://named-data.net/doc/NLSR/current/ROUTER-CONFIG.html, April 2018.
852
853.. [NLSRstarting] *Getting Started with NLSR*, http://named-data.net/doc/NLSR/current/GETTING-STARTED.html, May 2018.
854
855.. [NDNAnsible] *NDN Ansible repository*, https://github.com/WU-ARL/NDN_Ansible, October 2018.
856
857.. [NDNTestbed] *NDN Testbed*, https://named-data.net/ndn-testbed/, October 2018.