| 164 | == Setup == |
| 165 | |
| 166 | Divide the hosts that you want to use into pairs. You'll run an HTTPS server on the server, and run wget on the client to fetch files from it. |
| 167 | |
| 168 | Identify the precise IP address on each server that you'll want to connect to. Make a table to keep track of which server you'll want to connect to from each client, e.g. |
| 169 | |
| 170 | || '''client''' || '''server''' || '''server address''' || |
| 171 | || ganel.gpolab.bbn.com || planetlab5.clemson.edu || server=10.42.101.105 || |
| 172 | || planetlab4.clemson.edu || pl5.myplc.grnoc.iu.edu || server=10.42.101.73 || |
| 173 | || of-planet1.stanford.edu || wings-openflow-3.wail.wisc.edu || server=10.42.101.96 || |
| 174 | |
| 175 | You'll use the "server=<ipaddr>" parts when you run the experiment. |
| 176 | |
| 177 | Identify a port that you'd like to use for the connection; call it <port>, and use it below when you run the netcat server and client commands. |
| 178 | |
| 179 | On each server, install an HTTPS server. One way is to install pyOpenSSL, the 'patch' program, and use the Python server at http://code.activestate.com/recipes/442473-simple-http-server-supporting-ssl-secure-communica/, with a patch to allow you to bind to an address and port specified on the command line: |
| 180 | |
| 181 | {{{ |
| 182 | sudo yum install pyOpenSSL patch |
| 183 | rm -rf ~/gigaweb |
| 184 | mkdir -p ~/gigaweb/docroot |
| 185 | cd ~/gigaweb |
| 186 | wget http://code.activestate.com/recipes/442473-simple-http-server-supporting-ssl-secure-communica/download/1/ -O httpsd.py |
| 187 | wget http://groups.geni.net/geni/attachment/wiki/PlasticSlices/Experiments/httpsd.py.patch?format=raw -O httpsd.py.patch |
| 188 | patch httpsd.py httpsd.py.patch |
| 189 | rm httpsd.py.patch |
| 190 | }}} |
| 191 | |
| 192 | On each server, generate a self-signed SSL key: |
| 193 | |
| 194 | {{{ |
| 195 | openssl genrsa -passout pass:localhost -des3 -rand /dev/urandom -out localhost.localdomain.key 1024 |
| 196 | openssl req -subj /CN=localhost.localdomain -passin pass:localhost -new -key localhost.localdomain.key -out localhost.localdomain.csr |
| 197 | openssl x509 -passin pass:localhost -req -days 3650 -in localhost.localdomain.csr -signkey localhost.localdomain.key -out localhost.localdomain.crt |
| 198 | openssl rsa -passin pass:localhost -in localhost.localdomain.key -out decrypted.localhost.localdomain.key |
| 199 | mv decrypted.localhost.localdomain.key localhost.localdomain.key |
| 200 | cat localhost.localdomain.key localhost.localdomain.crt > localhost.localdomain.pem |
| 201 | rm localhost.localdomain.key localhost.localdomain.crt localhost.localdomain.csr |
| 202 | }}} |
| 203 | |
| 204 | Identify a file that you'd like to transfer from the servers to the clients; call it <file>. Find out how many times you'll need to copy it to get more than 1 GB: |
| 205 | |
| 206 | {{{ |
| 207 | echo $((10**9/$(du -b <file> | awk '{print $1;}')+1)) |
| 208 | }}} |
| 209 | |
| 210 | Divide that number by the number of host pairs you have (the number of rows in your table); call this number <count>, and use it below when you run the wget command on the clients. |
| 211 | |
| 212 | Copy the file to each of the servers, and put it into ~/gigaweb/docroot. (When you run the experiment, you'll download it repeatedly from each of the clients.) |
| 213 | |
| 214 | == Execution == |
| 215 | |
| 216 | On each server, run |
| 217 | |
| 218 | {{{ |
| 219 | server=<ipaddr> |
| 220 | cd ~/gigaweb/docroot |
| 221 | python ../httpsd.py $server <port> |
| 222 | }}} |
| 223 | |
| 224 | using the "server=<ipaddr>" line from your table, and the <count>, <port>, and <file> values you identified earlier. |
| 225 | |
| 226 | That should print a line on your terminal like |
| 227 | |
| 228 | {{{ |
| 229 | Serving HTTPS on <ipaddr> port <port> ... |
| 230 | }}} |
| 231 | |
| 232 | immediately, and then lines like |
| 233 | |
| 234 | {{{ |
| 235 | <ipaddr> - - [17/May/2011 19:53:21] "GET / HTTP/1.1" 200 - |
| 236 | }}} |
| 237 | |
| 238 | for each client connection when clients connect. |
| 239 | |
| 240 | On each client, run |
| 241 | |
| 242 | {{{ |
| 243 | server=<ipaddr> |
| 244 | rm -rf ~/gigaweb |
| 245 | mkdir ~/gigaweb |
| 246 | cd ~/gigaweb |
| 247 | for i in {1..<count>} ; do wget --no-check-certificate https://$server:<port>/<file> -O <file>.$i ; done |
| 248 | }}} |
| 249 | |
| 250 | You'll see output typical of wget as each transfer runs. |
| 251 | |
| 252 | ''FIXME: Should we capture this in a log file? We don't need it, but I suppose it could make debugging easier.'' |
| 253 | |
| 254 | When the downloads are finished, on the server, hit ctrl-c to kill the httpsd.py process. |
| 255 | |
| 256 | == Results == |
| 257 | |
| 258 | On each client, check the total size of the data transfered: |
| 259 | |
| 260 | {{{ |
| 261 | du -sb . |
| 262 | }}} |
| 263 | |
| 264 | Add up the results for all the clients; they should add up to 1 GB (or more). |
| 265 | |
| 266 | On the server, calculate the md5sum checksum for the file: Do |
| 267 | |
| 268 | {{{ |
| 269 | md5sum <file> | awk '{print $1;}' |
| 270 | }}} |
| 271 | |
| 272 | Call the result of this command <md5sum>. |
| 273 | |
| 274 | On each client, calculate the md5sum checksums for all of the copies of the file, and find any that differ from the server: Do |
| 275 | |
| 276 | {{{ |
| 277 | md5sum * | grep -v <md5sum> || echo "All checksums match." |
| 278 | }}} |
| 279 | |
| 280 | and expect "All checksums match" as the only output. |
| 281 | |
| 282 | == Cleanup == |
| 283 | |
| 284 | On each client, remove the gigaweb directory: |
| 285 | |
| 286 | {{{ |
| 287 | cd |
| 288 | rm -rf ~/gigaweb |
| 289 | }}} |
| 290 | |