29 | | [[CollapsibleStart(5. Execute the experiment)]] |
30 | | `omf exec test:exp:tutorial:hello-world-wireless -- --res1 node1-1.sb1.orbit-lab.org --res2 node1-2.sb1.orbit-lab.org` |
31 | | [[Include(Software/cOMF/aExec)]] |
32 | | Execute "Hello World" experiment. This is a simple wireless experiment that establishes the !WiFi link between two nodes and transfers data for 60 seconds. Be sure to specify the fully qualified domain names (FQDNs) of the two nodes involved. For the output below, it is assumed that the domain is: '''sb1.orbit-lab.org''' and the two nodes are '''node1-1.sb1.orbit-lab.org''' and '''node1-2.sb1.orbit-lab.org'''. |
33 | | {{{ |
34 | | username@console.sb1:~$ omf exec test:exp:tutorial:hello-world-wireless -- --res1 node1-1.sb1.orbit-lab.org --res2 node1-2.sb1.orbit-lab.org |
35 | | INFO NodeHandler: OMF Experiment Controller 5.4 (git c005675) |
36 | | INFO NodeHandler: Slice ID: default_slice (default) |
37 | | INFO NodeHandler: Experiment ID: default_slice-2013-01-29t01.03.19-05.00 |
38 | | INFO NodeHandler: Message authentication is disabled |
39 | | INFO Experiment: load system:exp:stdlib |
40 | | INFO property.resetDelay: resetDelay = 230 (Fixnum) |
41 | | INFO property.resetTries: resetTries = 1 (Fixnum) |
42 | | INFO Experiment: load system:exp:eventlib |
43 | | INFO Experiment: load test:exp:tutorial:hello-world-wireless |
44 | | INFO property.duration: duration = 60 (Fixnum) |
45 | | INFO property.graph: graph = false (FalseClass) |
46 | | INFO Topology: Loading topology 'system:topo:imaged'. |
47 | | INFO Topology: Loading topology '/tmp/pxe_slice-2013-01-26t22.21.22-05.00-topo-success'. |
48 | | INFO ALL_UP_AND_INSTALLED: Event triggered. Starting the associated tasks. |
49 | | INFO exp: This is my first OMF experiment |
50 | | INFO exp: Request from Experiment Script: Wait for 15s.... |
51 | | INFO node1-1.sb1.orbit-lab.org: Device 'net/w0' reported Not-Associated |
52 | | INFO node1-2.sb1.orbit-lab.org: Device 'net/w0' reported Not-Associated |
53 | | INFO node1-1.sb1.orbit-lab.org: Device 'net/w0' reported 12:B2:78:8E:8D:4F |
54 | | INFO node1-2.sb1.orbit-lab.org: Device 'net/w0' reported 12:B2:78:8E:8D:4F |
55 | | INFO exp: All my Applications are started now... |
56 | | INFO exp: Request from Experiment Script: Wait for 60s.... |
57 | | INFO exp: All my Applications are stopped now. |
58 | | INFO EXPERIMENT_DONE: Event triggered. Starting the associated tasks. |
59 | | INFO NodeHandler: |
60 | | INFO NodeHandler: Shutting down experiment, please wait... |
61 | | INFO NodeHandler: |
62 | | INFO run: Experiment default_slice-2013-01-29t01.03.19-05.00 finished after 1:23 |
63 | | |
64 | | username@console.sb1:~$ |
65 | | }}} |
66 | | [[CollapsibleEnd]] |
67 | | [[CollapsibleStart(6. View experiment results)]] |
68 | | You can view the results by pointing a web browser to url of this form: |
69 | | {{{ |
70 | | http://console.sb1.orbit-lab.org:5054/result/dumpDatabase?expID=EXPERIMENT_ID. |
71 | | }}} |
72 | | The EXPERIMENT_ID is an auto-generated string that is reported during the run of the experiment. In this case it was |
73 | | {{{ |
74 | | INFO NodeHandler: Experiment ID: default_slice-2013-01-29t01.03.19-05.00 |
75 | | }}} |
76 | | It should look something like:[[BR]] |
77 | | [[Image(Result.png,500px)]][[BR]] |
78 | | More information on result analysis can be found [wiki:/Tutorials/a0Basic/Tutorial3 here] |
79 | | [[CollapsibleEnd]] |
80 | | [[CollapsibleStart(7. (optionally) Save the node image)]] |
| 36 | == 5. Run your experiment == |
| 37 | In this example, our "experiment" will be to use one node as a wireless access point, which the other node will connect to. This is meant to demonstrate the basic way in which experimenters interact with testbed resources, along with |
| 38 | some basic skills which will be useful during your use of the testbed. |
| 39 | |
| 40 | === Preliminary steps === |
| 41 | 1. First, we want to make sure that the wireless interfaces on both nodes are on. By default, wireless interfaces on ORBIT nodes are disabled to reduce RF noise for experiments. On both nodes, run `ip a` to list the |
| 42 | current network interfaces. You should see something like |
| 43 | {{{ |
| 44 | 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 |
| 45 | link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 |
| 46 | inet 127.0.0.1/8 scope host lo |
| 47 | valid_lft forever preferred_lft forever |
| 48 | inet6 ::1/128 scope host |
| 49 | valid_lft forever preferred_lft forever |
| 50 | 2: DATA1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000 |
| 51 | link/ether 70:8b:cd:bc:82:8d brd ff:ff:ff:ff:ff:ff |
| 52 | inet6 fe80::728b:cdff:febc:828d/64 scope link |
| 53 | valid_lft forever preferred_lft forever |
| 54 | 3: CTRL: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000 |
| 55 | link/ether 70:8b:cd:bc:82:8c brd ff:ff:ff:ff:ff:ff |
| 56 | inet 10.11.1.1/16 brd 10.11.255.255 scope global dynamic CTRL |
| 57 | valid_lft 5170sec preferred_lft 5170sec |
| 58 | inet6 fe80::728b:cdff:febc:828c/64 scope link |
| 59 | valid_lft forever preferred_lft forever |
| 60 | }}} |
| 61 | These are the default wired interfaces available on all ORBIT nodes: CTRL is the interface that is used to connect to the nodes from the console. It is also the interface over which internet traffic is routed. '''Note: be |
| 62 | very careful when modifying the CTRL interface-- you may make your node inaccessible over ssh.''' |
| 63 | |
| 64 | You can also see the DATA interface. This interface is meant to be configured as part of experiments, which is why it does not have an IP address. |
| 65 | |
| 66 | If we run `iw list` to list wireless interfaces, we should see that there are currently no wireless interfaces. First we must check what wireless devices are present to determine which driver module to load. Run `lshw -c network` |
| 67 | to list network devices available on the node. You should see in the output that there is an AR928X wireless network card. For this particular card, we need to run the following to load the proper driver: `modprobe ath9k`. |
| 68 | |
| 69 | Now, we should be able to see the wireless interface in the output of the `ip` and `iw` commands: |
| 70 | {{{ |
| 71 | 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 |
| 72 | link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 |
| 73 | inet 127.0.0.1/8 scope host lo |
| 74 | valid_lft forever preferred_lft forever |
| 75 | inet6 ::1/128 scope host |
| 76 | valid_lft forever preferred_lft forever |
| 77 | 2: DATA1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000 |
| 78 | link/ether 70:8b:cd:bc:82:8d brd ff:ff:ff:ff:ff:ff |
| 79 | inet6 fe80::728b:cdff:febc:828d/64 scope link |
| 80 | valid_lft forever preferred_lft forever |
| 81 | 3: CTRL: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000 |
| 82 | link/ether 70:8b:cd:bc:82:8c brd ff:ff:ff:ff:ff:ff |
| 83 | inet 10.11.1.1/16 brd 10.11.255.255 scope global dynamic CTRL |
| 84 | valid_lft 6797sec preferred_lft 6797sec |
| 85 | inet6 fe80::728b:cdff:febc:828c/64 scope link |
| 86 | valid_lft forever preferred_lft forever |
| 87 | 4: wlp3s0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000 |
| 88 | link/ether 00:15:6d:84:3f:20 brd ff:ff:ff:ff:ff:ff |
| 89 | }}} |
| 90 | |
| 91 | Make sure you have enabled the wireless interface on both nodes in the sandbox. Now, use the `ip` command to bring up the new wireless interface: |
| 92 | {{{ |
| 93 | root@node1-1:~# ip link set wlp3s0 up |
| 94 | }}} |
| 95 | The interface is now running, but it isn't connected to any networks. We can use either node to scan for the available networks, to ensure that we don't start a new network with the same ssid as an existing one. |
| 96 | Running `iw dev wlp3s0 scan` will print out all available information about all available networks (make sure to substitute in the name of your wireless interface if it is different). To find the exact information |
| 97 | we're looking for, we can use the grep utility: `iw dev wlp3s0 scan | grep SSID`. Grep has many capabilities, but we can see it's simplest use case here: it outputs lines containing a search string. We have also taken |
| 98 | advantage of the pipe utility provided by the linux command line to feed the output of one command into another. |
| 99 | |
| 100 | === Set up Access Point === |
| 101 | We will use node1-1 as the access point. |
| 102 | |
| 103 | 1. First install hostapd and dnsmasq on node1-1: |
| 104 | {{{ |
| 105 | root@node1-1:~# apt install hostapd dnsmasq |
| 106 | }}} |
| 107 | You'll see some error messages because dnsmasq is unable to start automatically. That's ok for now. |
| 108 | |
| 109 | 2. Now we need to configure the services we just installed. We'll start with hostapd, the service that creates the access point. Open a file called `hostapd.conf` in `/etc/hostapd/` using your editor of choice. Nano is a good option for beginners: |
| 110 | {{{ |
| 111 | root@node1-1:~# nano /etc/hostapd/hostapd.conf |
| 112 | }}} |
| 113 | Note the commands listed at the bottom of the nano interface, especially exit and write out (save to file). The `^` in the command stands for control. So to save your changes and exit, you would press CTRL+O then CTRL+X. |
| 114 | |
| 115 | Enter the following into the new file, making sure to change the first line if your wireless interface has a different name: |
| 116 | {{{ |
| 117 | interface=wlp3s0 |
| 118 | logger_syslog=-1 |
| 119 | logger_syslog_level=2 |
| 120 | logger_stdout=-1 |
| 121 | logger_stdout_level=2 |
| 122 | ctrl_interface=/var/run/hostapd |
| 123 | ctrl_interface_group=0 |
| 124 | ssid=hello-wireless |
| 125 | hw_mode=g |
| 126 | channel=1 |
| 127 | beacon_int=100 |
| 128 | dtim_period=2 |
| 129 | max_num_sta=20 |
| 130 | rts_threshold=-1 |
| 131 | fragm_threshold=-1 |
| 132 | auth_algs=1 |
| 133 | ignore_broadcast_ssid=0 |
| 134 | wpa=2 |
| 135 | wpa_passphrase=t0pS3cr3t |
| 136 | wpa_key_mgmt=WPA-PSK |
| 137 | wpa_pairwise=CCMP |
| 138 | }}} |
| 139 | These parameters are mostly default values, but note in particular the ssid name and passphrase. We will need these to connect to the network. For an explanation of what these parameters do, you can read the example file `/usr/share/doc/hostapd/examples/hostapd.conf`. |
| 140 | |
| 141 | 3. Now we will set up the configuration for dnsmasq, which is used to provide ip addresses to clients that connect to the access point. A configuration file already exists at /etc/dnsmasq.conf, although it doesn't have any configuration to start. Open the file to add the following lines: |
| 142 | {{{ |
| 143 | bogus-priv |
| 144 | bind-interfaces |
| 145 | listen-address=192.168.100.1 |
| 146 | dhcp-range=192.168.100.50,192.168.100.150,2h |
| 147 | }}} |
| 148 | This is a very minimal configuration, but it should be all we need. |
| 149 | |
| 150 | 4. You can see we're telling dnsmasq to listen on the ip address 192.168.100.1, but we haven't put that address on our wireless interface yet. We can do that with the following command: |
| 151 | {{{ |
| 152 | root@node1-1:~# ip addr add 192.168.100.1/24 dev wlp3s0 |
| 153 | }}} |
| 154 | |
| 155 | 5. Now we can start the services. We have to first enable hostapd, which is disabled after you first install it. |
| 156 | {{{ |
| 157 | root@node1-1:~# systemctl unmask hostapd.service |
| 158 | root@node1-1:~# systemctl start hostapd.service |
| 159 | root@node1-1:~# systemctl start dnsmasq.service |
| 160 | }}} |
| 161 | |
| 162 | === Connect to Access Point === |
| 163 | 1. First, verify that you can see the "hello-wireless" network from node1-2 by running the prior command to scan for interfaces and grepping for SSID. |
| 164 | |
| 165 | 2. We'll use a utility called wpa_supplicant to connect to the access point. Run the following to install it: |
| 166 | {{{ |
| 167 | root@node1-2:~# apt install wpasupplicant |
| 168 | }}} |
| 169 | |
| 170 | 3. To set up wpa_supplicant to connect to "hello-wireless", we'll use its built-in utility to modify the configuration file: |
| 171 | {{{ |
| 172 | root@node1-2:~# wpa_passphrase "hello-wireless" "t0pS3cr3t" > /etc/wpa_supplicant.conf |
| 173 | }}} |
| 174 | |
| 175 | 4. Now we can connect to the network: |
| 176 | {{{ |
| 177 | root@node1-2:~# wpa_supplicant -B -i wlp3s0 -c /etc/wpa_supplicant.conf |
| 178 | }}} |
| 179 | |
| 180 | 5. We need to manually request an ip address after connecting: |
| 181 | {{{ |
| 182 | root@node1-2:~# dhclient wlp3s0 |
| 183 | }}} |
| 184 | |
| 185 | 6. Verify that you can see an ip address in the 192.168.100.X ip space on the wireless interface. You should also be able to use the ping utility to test connectivity to node1-1 over the wireless interface: |
| 186 | {{{ |
| 187 | root@node1-2:~# ping 192.169.100.1 |
| 188 | }}} |
| 189 | |
| 190 | 7. As a final test , we can bring down the wired interfaces on node1-2 and ssh to it from node1-1 over the wireless network. Use the ip command to turn off first DATA1, then CTRL. You'll use the same command you used to bring the interfaces up, |
| 191 | except now you'll use `down` instead of `up`. Make sure to use the correct interface names. After you bring down CTRL, your ssh connection will become unresponsive. |
| 192 | |
| 193 | Now, from node1-1, ssh to root at the ip address that node1-2 had on the wireless interface. From there, you can bring the interfaces back up. This concludes the demo experiment. |
| 194 | |
| 195 | == 6. (optionally) Save the node image == |