blob: b95bde3996256a2c9f959da648a6c316117aa7a2 [file] [log] [blame]
Ashlesh Gawande6c86e302019-09-17 22:27:05 -05001Howtos
2======
3
4Connect Mini-NDN nodes to an outside network
5---------------------------------------------
6
7Mini-NDN nodes can be connected to an outside network indirectly by
8running NFD on the local machine:
9
10::
11
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
17For this simple example, we can use a single node topology with node 'a'
18
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
24.. code:: python
25
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)
32
33 ...
34
35Configuration
36_____________
37
38Run Mini-NDN with the above code and issue ifconfig on the local
39machine to confirm the addition of the interface. You should be able to
40locate "root-eth0":
41
42::
43
44 root-eth0 Link encap:Ethernet HWaddr 3e:eb:77:d2:6f:1f
45 inet addr:1.0.0.9 Bcast:1.0.0.11 Mask:255.255.255.252
46 inet6 addr: fe80::3ceb:77ff:fed2:6f1f/64 Scope:Link
47 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
48 RX packets:34 errors:0 dropped:0 overruns:0 frame:0
49 TX packets:33 errors:0 dropped:0 overruns:0 carrier:0
50 collisions:0 txqueuelen:1000
51 RX bytes:2667 (2.6 KB) TX bytes:2797 (2.7 KB)
52
53To make the IP address associated with this interface persistent, add
54the following line to /etc/network/interfaces and reboot your machine:
55
56::
57
58 iface root-eth0 inet manual
59
60Check connection
61________________
62
63After rebooting, run Mini-NDN and issue the following command:
64
65::
66
67 mini-ndn>net
68 a a-eth0:b-eth0 a-eth1:c-eth0 a-eth2:root-eth0
69
70Node "a" is connected to "root-eth0". Now issue "ifconfig a-eth2" on
71node "a":
72
73::
74
75 mini-ndn>a ifconfig a-eth2
76 a-eth2 Link encap:Ethernet HWaddr fa:76:d4:86:d3:ba
77 inet addr:1.0.0.10 Bcast:1.0.0.11 Mask:255.255.255.252
78
79As learned from the previous step, the IP address of root-eth0 is
801.0.0.9.
81
82::
83
84 mini-ndn>a ping 1.0.0.9
85 PING 1.0.0.9 (1.0.0.9) 56(84) bytes of data.
86 64 bytes from 1.0.0.9: icmp_seq=1 ttl=64 time=0.137 ms
87 64 bytes from 1.0.0.9: icmp_seq=2 ttl=64 time=0.123 ms
88
89The host machine will also be able to ping node "a":
90
91::
92
93 VirtualBox:~$ ping 1.0.0.10
94 PING 1.0.0.10 (1.0.0.10) 56(84) bytes of data.
95 64 bytes from 1.0.0.10: icmp_seq=1 ttl=64 time=0.086 ms
96
97Run NFD on local machine and register route
98___________________________________________
99
100Start NFD on the local machine by using:
101
102::
103
104 sudo nfd
105
106The "nfd-start" script cannot be used, since the script allows only one
107instance of NFD at a time. The NFD processes running on the Mini-NDN
108nodes will prevent the "nfd-start" script from working.
109
110Now, using "nfdc register", we can register a route from node "a" in
111Mini-NDN to the NFD process on the host machine and from the host
112machine to an external machine.
113
114Also, if the local machine has a public IP, Mini-NDN nodes can be
115reached via external machines.