HTTP exercises
For this experiment, you will need two hosts on GENI, and one of them should be configured a web server.
- If you still have access to resources from the “Basic home gateway services: DHCP, DNS, NAT” experiment, AND they are still configured as decribed there (including NAT), you can use one client node and the webserver from that experiment.
- Alternatively, if you have lost access to those resources, reserve two nodes for this experiment using the following Rspec: https://raw.githubusercontent.com/ffund/tcp-ip-essentials/gh-pages/rspecs/two-hosts-one-public.xml. On the webserver, install Apache2:
sudo apt-get update
sudo apt-get -y install apache2
Review the slice details in the GENI Portal and find the hostname assigned to the “website” host. For example, in the following screenshot, the hostname is website.nat.ch-geni-net.instageni.research.umich.edu
:
Exercise: send an HTTP request with telnet
In this exercise, we will use telnet
to manually write and send an HTTP request, and observe the response from the HTTP server.
If you are using the network topology with a gateway, run
sudo tcpdump -i eth1 -w http-$(hostname -s).pcap 'tcp port 80'
on the “gateway”. If you are using the topology with just one client and the web server, run
sudo tcpdump -i eth0 -w http-$(hostname -s).pcap 'tcp port 80'
on the client
While this is running, run
telnet website.nat.ch-geni-net.instageni.research.umich.edu 80
on a “client” node, but substitute the hostname of your own “website” host. You should see the following indication of a successful connection:
Trying 199.109.64.53...
Connected to pcvm2-3.instageni.nysernet.org.
Escape character is '^]'.
(but with a different address and hostname.)
At the console, type the following HTTP request line by line:
GET /index.html HTTP/1.0
From: guest@client
User-Agent: HTTPTool/1.0
Note that you need to type “Enter” to input the last line, which is blank, and then “Enter” again to send it.
When the telnet
process is terminated, save the output for your lab report. Identify the HTTP response header, and the HTML file sent from the HTTP server.
Terminate tcpdump
and transfer the packet capture to your laptop with scp
. Analyze the captured HTTP packets.
Lab report: Show the HTTP request and response headers (only the headers!).
Lab report: In the HTTP response header, identify these key elements:
- the version of the HTTP protocol
- the status code and the status message (for a successful HTTP request, the standard is “200 OK”)
- the header fields that indicate the type of file that is returned, and its length