Ashlesh Gawande | 37bffa9 | 2015-09-23 16:25:30 -0500 | [diff] [blame] | 1 | Connect Mini-NDN nodes to an outside network |
| 2 | ============================================ |
| 3 | |
| 4 | Mini-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 | |
| 10 | For this simple example, we use the default topology: |
| 11 | |
| 12 | c----a----b----d |
| 13 | |
Ashlesh Gawande | e626b63 | 2016-08-12 16:50:14 -0500 | [diff] [blame] | 14 | If 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 Gawande | 37bffa9 | 2015-09-23 16:25:30 -0500 | [diff] [blame] | 15 | |
Ashlesh Gawande | e626b63 | 2016-08-12 16:50:14 -0500 | [diff] [blame] | 16 | To do so, we need to add the following import statement at the top of `bin/minindn`: |
| 17 | |
| 18 | ```python |
| 19 | from mininet.node import Node |
| 20 | ``` |
| 21 | |
| 22 | Then the following lines can be added to `bin/minindn` before net.start(): |
Ashlesh Gawande | 37bffa9 | 2015-09-23 16:25:30 -0500 | [diff] [blame] | 23 | |
| 24 | ```python |
| 25 | root = Node( 'root', inNamespace=False ) |
| 26 | net.addLink(root, 'a') |
| 27 | ``` |
| 28 | |
| 29 | Adding these before net.start() is important as node "root" would then be assigned an IP automatically. |
| 30 | Re-install Mini-NDN by issuing the following command in the mini-ndn folder: |
| 31 | |
| 32 | sudo ./install.sh -i |
| 33 | |
| 34 | ## Configuration |
| 35 | |
| 36 | Run Mini-NDN with the simple topology and issue ifconfig on the local machine to confirm the addition of |
| 37 | the 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 | |
| 48 | To 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 | |
| 55 | After rebooting, run Mini-NDN and issue the following command: |
| 56 | |
Ashlesh Gawande | 95789cc | 2017-02-27 12:38:04 -0600 | [diff] [blame] | 57 | mini-ndn>net |
Ashlesh Gawande | 37bffa9 | 2015-09-23 16:25:30 -0500 | [diff] [blame] | 58 | a a-eth0:b-eth0 a-eth1:c-eth0 a-eth2:root-eth0 |
| 59 | |
| 60 | Node "a" is connected to "root-eth0". Now issue "ifconfig a-eth2" on node "a": |
| 61 | |
Ashlesh Gawande | 95789cc | 2017-02-27 12:38:04 -0600 | [diff] [blame] | 62 | mini-ndn>a ifconfig a-eth2 |
Ashlesh Gawande | 37bffa9 | 2015-09-23 16:25:30 -0500 | [diff] [blame] | 63 | 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 | |
| 66 | As learned from the previous step, the IP address of root-eth0 is 1.0.0.9. |
| 67 | |
Ashlesh Gawande | 95789cc | 2017-02-27 12:38:04 -0600 | [diff] [blame] | 68 | mini-ndn>a ping 1.0.0.9 |
Ashlesh Gawande | 37bffa9 | 2015-09-23 16:25:30 -0500 | [diff] [blame] | 69 | 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 | |
| 73 | The 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 | |
| 81 | Start NFD on the local machine by using: |
| 82 | |
| 83 | sudo nfd |
| 84 | |
| 85 | The "nfd-start" script cannot be used, since the script allows only one instance of NFD at a time. |
| 86 | The NFD processes running on the Mini-NDN nodes will prevent the "nfd-start" script from working. |
| 87 | |
| 88 | Now, using "nfdc register", we can register a route from node "a" in Mini-NDN to the NFD process on the |
| 89 | host machine and from the host machine to an external machine. |
| 90 | |
| 91 | Also, if the local machine has a public IP, Mini-NDN nodes can be reached via external machines. |