Ashlesh Gawande | 6c86e30 | 2019-09-17 22:27:05 -0500 | [diff] [blame] | 1 | Howtos |
| 2 | ====== |
| 3 | |
| 4 | Connect Mini-NDN nodes to an outside network |
| 5 | --------------------------------------------- |
| 6 | |
| 7 | Mini-NDN nodes can be connected to an outside network indirectly by |
| 8 | running 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 | |
| 14 | Add a node in root namespace |
| 15 | ____________________________ |
| 16 | |
| 17 | For this simple example, we can use a single node topology with node 'a' |
| 18 | |
| 19 | If 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 | |
| 22 | Then 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 | |
| 35 | Configuration |
| 36 | _____________ |
| 37 | |
| 38 | Run Mini-NDN with the above code and issue ifconfig on the local |
| 39 | machine to confirm the addition of the interface. You should be able to |
| 40 | locate "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 | |
| 53 | To make the IP address associated with this interface persistent, add |
| 54 | the following line to /etc/network/interfaces and reboot your machine: |
| 55 | |
| 56 | :: |
| 57 | |
| 58 | iface root-eth0 inet manual |
| 59 | |
| 60 | Check connection |
| 61 | ________________ |
| 62 | |
| 63 | After 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 | |
| 70 | Node "a" is connected to "root-eth0". Now issue "ifconfig a-eth2" on |
| 71 | node "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 | |
| 79 | As learned from the previous step, the IP address of root-eth0 is |
| 80 | 1.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 | |
| 89 | The 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 | |
| 97 | Run NFD on local machine and register route |
| 98 | ___________________________________________ |
| 99 | |
| 100 | Start NFD on the local machine by using: |
| 101 | |
| 102 | :: |
| 103 | |
| 104 | sudo nfd |
| 105 | |
| 106 | The "nfd-start" script cannot be used, since the script allows only one |
| 107 | instance of NFD at a time. The NFD processes running on the Mini-NDN |
| 108 | nodes will prevent the "nfd-start" script from working. |
| 109 | |
| 110 | Now, using "nfdc register", we can register a route from node "a" in |
| 111 | Mini-NDN to the NFD process on the host machine and from the host |
| 112 | machine to an external machine. |
| 113 | |
| 114 | Also, if the local machine has a public IP, Mini-NDN nodes can be |
| 115 | reached via external machines. |
Alex Lane | 587b78f | 2020-08-13 18:43:14 -0500 | [diff] [blame] | 116 | |
| 117 | Generate NDN testbed topology |
| 118 | ___________________________________________ |
| 119 | |
| 120 | Run the following install.sh command |
| 121 | |
| 122 | :: |
| 123 | |
| 124 | python3 util/testbed_topo_generator.py |
| 125 | |
| 126 | This will place a "testbed.conf" file in the topologies subdirectory, |
| 127 | where it can be referenced as desired. To update the topology, simply |
| 128 | rerun this command. |