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 | |
| 14 | If we want node "a" to connect to the host machine, we need to add a "root" node which has a link with |
| 15 | node "a." |
| 16 | |
| 17 | To do so, the following lines can be added to bin/minindn before net.start(): |
| 18 | |
| 19 | ```python |
| 20 | root = Node( 'root', inNamespace=False ) |
| 21 | net.addLink(root, 'a') |
| 22 | ``` |
| 23 | |
| 24 | Adding these before net.start() is important as node "root" would then be assigned an IP automatically. |
| 25 | Re-install Mini-NDN by issuing the following command in the mini-ndn folder: |
| 26 | |
| 27 | sudo ./install.sh -i |
| 28 | |
| 29 | ## Configuration |
| 30 | |
| 31 | Run Mini-NDN with the simple topology and issue ifconfig on the local machine to confirm the addition of |
| 32 | the 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 | |
| 43 | To 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 | |
| 50 | After 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 | |
| 55 | Node "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 | |
| 61 | As 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 | |
| 68 | The 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 | |
| 76 | Start NFD on the local machine by using: |
| 77 | |
| 78 | sudo nfd |
| 79 | |
| 80 | The "nfd-start" script cannot be used, since the script allows only one instance of NFD at a time. |
| 81 | The NFD processes running on the Mini-NDN nodes will prevent the "nfd-start" script from working. |
| 82 | |
| 83 | Now, using "nfdc register", we can register a route from node "a" in Mini-NDN to the NFD process on the |
| 84 | host machine and from the host machine to an external machine. |
| 85 | |
| 86 | Also, if the local machine has a public IP, Mini-NDN nodes can be reached via external machines. |