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