blob: ce98c1d659f716b8bdf58b086f7f4bdf0d12f190 [file] [log] [blame]
Ashlesh Gawande6c86e302019-09-17 22:27:05 -05001Howtos
2======
3
4Connect Mini-NDN nodes to an outside network
Davide Pesavento750d0402025-02-25 16:50:50 -05005--------------------------------------------
Ashlesh Gawande6c86e302019-09-17 22:27:05 -05006
7Mini-NDN nodes can be connected to an outside network indirectly by
8running NFD on the local machine:
9
Davide Pesavento750d0402025-02-25 16:50:50 -050010.. code-block:: none
Ashlesh Gawande6c86e302019-09-17 22:27:05 -050011
12 (Mini-NDN node) ------ (NFD running on the host machine where Mini-NDN is running) ------- (External Network)
13
14Add a node in root namespace
15____________________________
16
Davide Pesavento750d0402025-02-25 16:50:50 -050017For this simple example, we can use a single node topology with node 'a'.
Ashlesh Gawande6c86e302019-09-17 22:27:05 -050018
19If we want node 'a' to connect to the host machine, we need to add a
20"root" node which has a link with node "a."
21
22Then the following code can be used:
23
Davide Pesavento750d0402025-02-25 16:50:50 -050024.. code-block:: python
Ashlesh Gawande6c86e302019-09-17 22:27:05 -050025
26 topo = Topo()
27 root = topo.addHost('root', inNamespace=False)
28 a = topo.addHost('a')
29 topo.addLink(root, a, delay='10ms')
30
31 ndn = Minindn(topo=topo)
Ashlesh Gawande6c86e302019-09-17 22:27:05 -050032 ...
33
34Configuration
35_____________
36
Davide Pesavento750d0402025-02-25 16:50:50 -050037Run Mini-NDN with the above code and issue ``ifconfig`` on the local
Ashlesh Gawande6c86e302019-09-17 22:27:05 -050038machine to confirm the addition of the interface. You should be able to
39locate "root-eth0":
40
Davide Pesavento750d0402025-02-25 16:50:50 -050041.. code-block:: none
Ashlesh Gawande6c86e302019-09-17 22:27:05 -050042
43 root-eth0 Link encap:Ethernet HWaddr 3e:eb:77:d2:6f:1f
44 inet addr:1.0.0.9 Bcast:1.0.0.11 Mask:255.255.255.252
45 inet6 addr: fe80::3ceb:77ff:fed2:6f1f/64 Scope:Link
46 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
47 RX packets:34 errors:0 dropped:0 overruns:0 frame:0
48 TX packets:33 errors:0 dropped:0 overruns:0 carrier:0
49 collisions:0 txqueuelen:1000
50 RX bytes:2667 (2.6 KB) TX bytes:2797 (2.7 KB)
51
52To make the IP address associated with this interface persistent, add
Davide Pesavento750d0402025-02-25 16:50:50 -050053the following line to ``/etc/network/interfaces`` and reboot your machine:
Ashlesh Gawande6c86e302019-09-17 22:27:05 -050054
Davide Pesavento750d0402025-02-25 16:50:50 -050055.. code-block:: none
Ashlesh Gawande6c86e302019-09-17 22:27:05 -050056
57 iface root-eth0 inet manual
58
59Check connection
60________________
61
62After rebooting, run Mini-NDN and issue the following command:
63
Davide Pesavento750d0402025-02-25 16:50:50 -050064.. code-block:: none
Ashlesh Gawande6c86e302019-09-17 22:27:05 -050065
66 mini-ndn>net
67 a a-eth0:b-eth0 a-eth1:c-eth0 a-eth2:root-eth0
68
Davide Pesavento750d0402025-02-25 16:50:50 -050069Node "a" is connected to "root-eth0". Now issue ``ifconfig a-eth2`` on
Ashlesh Gawande6c86e302019-09-17 22:27:05 -050070node "a":
71
Davide Pesavento750d0402025-02-25 16:50:50 -050072.. code-block:: none
Ashlesh Gawande6c86e302019-09-17 22:27:05 -050073
74 mini-ndn>a ifconfig a-eth2
75 a-eth2 Link encap:Ethernet HWaddr fa:76:d4:86:d3:ba
76 inet addr:1.0.0.10 Bcast:1.0.0.11 Mask:255.255.255.252
77
78As learned from the previous step, the IP address of root-eth0 is
791.0.0.9.
80
Davide Pesavento750d0402025-02-25 16:50:50 -050081.. code-block:: none
Ashlesh Gawande6c86e302019-09-17 22:27:05 -050082
83 mini-ndn>a ping 1.0.0.9
84 PING 1.0.0.9 (1.0.0.9) 56(84) bytes of data.
85 64 bytes from 1.0.0.9: icmp_seq=1 ttl=64 time=0.137 ms
86 64 bytes from 1.0.0.9: icmp_seq=2 ttl=64 time=0.123 ms
87
88The host machine will also be able to ping node "a":
89
Davide Pesavento750d0402025-02-25 16:50:50 -050090.. code-block:: none
Ashlesh Gawande6c86e302019-09-17 22:27:05 -050091
92 VirtualBox:~$ ping 1.0.0.10
93 PING 1.0.0.10 (1.0.0.10) 56(84) bytes of data.
94 64 bytes from 1.0.0.10: icmp_seq=1 ttl=64 time=0.086 ms
95
96Run NFD on local machine and register route
97___________________________________________
98
99Start NFD on the local machine by using:
100
Davide Pesavento750d0402025-02-25 16:50:50 -0500101.. code-block:: sh
Ashlesh Gawande6c86e302019-09-17 22:27:05 -0500102
103 sudo nfd
104
Davide Pesavento750d0402025-02-25 16:50:50 -0500105The ``nfd-start`` script cannot be used, since the script allows only one
Ashlesh Gawande6c86e302019-09-17 22:27:05 -0500106instance of NFD at a time. The NFD processes running on the Mini-NDN
Davide Pesavento750d0402025-02-25 16:50:50 -0500107nodes will prevent the ``nfd-start`` script from working.
Ashlesh Gawande6c86e302019-09-17 22:27:05 -0500108
Davide Pesavento750d0402025-02-25 16:50:50 -0500109Now, using ``nfdc register``, we can register a route from node "a" in
Ashlesh Gawande6c86e302019-09-17 22:27:05 -0500110Mini-NDN to the NFD process on the host machine and from the host
111machine to an external machine.
112
113Also, if the local machine has a public IP, Mini-NDN nodes can be
114reached via external machines.
Alex Lane587b78f2020-08-13 18:43:14 -0500115
116Generate NDN testbed topology
Davide Pesavento750d0402025-02-25 16:50:50 -0500117_____________________________
Alex Lane587b78f2020-08-13 18:43:14 -0500118
Davide Pesavento750d0402025-02-25 16:50:50 -0500119Visit the `NDN Play testbed <https://play.ndn.today/?testbed=1>`__
120page and utilize the "MiniNDN Config" button after setting loss
awlane73add712024-08-12 21:49:00 -0500121and latency parameters. This will export an up to date topology
122modeled on the testbed. We also provide a topology at
Davide Pesavento750d0402025-02-25 16:50:50 -0500123``topologies/testbed.conf``, which is based on a sample from 2020
124which has latencies based on measurements from that configuration.