blob: eb3f5b62183168bafb226557028b332e1a09f98d [file] [log] [blame] [view]
Ashlesh Gawande37bffa92015-09-23 16:25:30 -05001Connect Mini-NDN nodes to an outside network
2============================================
3
4Mini-NDN nodes can be connected to an outside network indirectly by running NFD on the local machine:
5
6 (Mini-NDN node) ------ (NFD running on the host machine where Mini-NDN is running) ------- (External Network)
7
8## Add a node in root namespace
9
10For this simple example, we use the default topology:
11
12 c----a----b----d
13
Ashlesh Gawandee626b632016-08-12 16:50:14 -050014If we want node "a" to connect to the host machine, we need to add a "root" node which has a link with node "a."
Ashlesh Gawande37bffa92015-09-23 16:25:30 -050015
Ashlesh Gawandee626b632016-08-12 16:50:14 -050016To do so, we need to add the following import statement at the top of `bin/minindn`:
17
18```python
19from mininet.node import Node
20```
21
22Then the following lines can be added to `bin/minindn` before net.start():
Ashlesh Gawande37bffa92015-09-23 16:25:30 -050023
24```python
25root = Node( 'root', inNamespace=False )
26net.addLink(root, 'a')
27```
28
29Adding these before net.start() is important as node "root" would then be assigned an IP automatically.
30Re-install Mini-NDN by issuing the following command in the mini-ndn folder:
31
32 sudo ./install.sh -i
33
34## Configuration
35
36Run Mini-NDN with the simple topology and issue ifconfig on the local machine to confirm the addition of
37the interface. You should be able to locate "root-eth0":
38
39 root-eth0 Link encap:Ethernet HWaddr 3e:eb:77:d2:6f:1f
40 inet addr:1.0.0.9 Bcast:1.0.0.11 Mask:255.255.255.252
41 inet6 addr: fe80::3ceb:77ff:fed2:6f1f/64 Scope:Link
42 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
43 RX packets:34 errors:0 dropped:0 overruns:0 frame:0
44 TX packets:33 errors:0 dropped:0 overruns:0 carrier:0
45 collisions:0 txqueuelen:1000
46 RX bytes:2667 (2.6 KB) TX bytes:2797 (2.7 KB)
47
48To make the IP address associated with this interface persistent, add the following line to
49/etc/network/interfaces and reboot your machine:
50
51 iface root-eth0 inet manual
52
53## Check connection
54
55After rebooting, run Mini-NDN and issue the following command:
56
Ashlesh Gawande95789cc2017-02-27 12:38:04 -060057 mini-ndn>net
Ashlesh Gawande37bffa92015-09-23 16:25:30 -050058 a a-eth0:b-eth0 a-eth1:c-eth0 a-eth2:root-eth0
59
60Node "a" is connected to "root-eth0". Now issue "ifconfig a-eth2" on node "a":
61
Ashlesh Gawande95789cc2017-02-27 12:38:04 -060062 mini-ndn>a ifconfig a-eth2
Ashlesh Gawande37bffa92015-09-23 16:25:30 -050063 a-eth2 Link encap:Ethernet HWaddr fa:76:d4:86:d3:ba
64 inet addr:1.0.0.10 Bcast:1.0.0.11 Mask:255.255.255.252
65
66As learned from the previous step, the IP address of root-eth0 is 1.0.0.9.
67
Ashlesh Gawande95789cc2017-02-27 12:38:04 -060068 mini-ndn>a ping 1.0.0.9
Ashlesh Gawande37bffa92015-09-23 16:25:30 -050069 PING 1.0.0.9 (1.0.0.9) 56(84) bytes of data.
70 64 bytes from 1.0.0.9: icmp_seq=1 ttl=64 time=0.137 ms
71 64 bytes from 1.0.0.9: icmp_seq=2 ttl=64 time=0.123 ms
72
73The host machine will also be able to ping node "a":
74
75 VirtualBox:~$ ping 1.0.0.10
76 PING 1.0.0.10 (1.0.0.10) 56(84) bytes of data.
77 64 bytes from 1.0.0.10: icmp_seq=1 ttl=64 time=0.086 ms
78
79## Run NFD on local machine and register route
80
81Start NFD on the local machine by using:
82
83 sudo nfd
84
85The "nfd-start" script cannot be used, since the script allows only one instance of NFD at a time.
86The NFD processes running on the Mini-NDN nodes will prevent the "nfd-start" script from working.
87
88Now, using "nfdc register", we can register a route from node "a" in Mini-NDN to the NFD process on the
89host machine and from the host machine to an external machine.
90
91Also, if the local machine has a public IP, Mini-NDN nodes can be reached via external machines.