T-110.5102 Laboratory Works in Networking and Security (5-10 cr)

Lab A1 & B1: Network tools


Description of the exercise

In this exercise you will learn to use the basic networking tools which will help you to successfully complete the rest of the assignments.

Additional reading

  • RFC 854 - Telnet Protocol Specification
  • RFC 2616 - Hypertext Transfer Protocol

Notation

Parenthesized numbers after certain keywords refer to corresponding manual page sections, where you will find further information about the keyword. For example man(1) refers to section 1 of the manual pages, and you will find further information about the keyword with command "man 1 man".

Note

By default the virtual machines don't include command man. You can install it by typing "sudo apt-get install man" without quotes.


1. Networking basics

1.1 Using ip(8), find all the active interfaces on your machine.  1 p
1.2 Using netstat(8) and arp(8), find the MAC address of the default router of your machine.  1 p
1.3 From resolv.conf(5), find the default name servers and the internet domain of your machine. How is this file generated?
 1 p
1.4 Using dig(1), find the responsible name servers for the cse.hut.fi domain.  1 p
1.5 Using dig(1), find the responsible mail exchange servers for cse.hut.fi domain.  1 p
1.6 Using ping(8), send 5 packets to aalto.fi and find out the average latency. Try then pinging Auckland University of Technology, aut.ac.nz, and see if the latency is different.   1 p
1.7 Using traceroute(1), find out how many hops away is google.fi
Why does this address sometimes produce different results on different traceroute runs? 
 1 p
1.8 Configure /etc/network/interfaces from each machine to correspond the structure shown in picture on assignment Lab A3: IPv6.

(Be sure not to touch eth0 since there's a great risk of disconnecting yourself from the remote machine.)

lo0: Local loopback
eth0: Dynamic address from DHCP
eth1: Static local address 172.16.x.y/24
eth2: Static local address 172.16.z.y/24

Reactivate the interfaces and apply the changes by using ifdown(8) and ifup(8).
 2 p

2. Examining the request and response messages of clients and servers using netcat

2.1 Using netcat, nc(1), capture the version number of the ssh daemon running on your machine.  1 p
2.2 Using netcat, nc(1), craft a valid HTTP/1.1 request for getting HTTP headers (not the html file itself) from the front page of www.aalto.fi. What request method did you use? Which headers did you need to send to the server? What was the status code for the request? Which headers did the server return? Explain the purpose of each header.  2 p
2.3 Using netcat, nc(1), start a bogus web server listening on the loopback interface port 8080. Verify with netstat(8), that the server really is listening where it should be. Direct your browser lynx(1) to the bogus server and capture the User-Agent: header.  2 p
2.4 With similar setup to 2.3, startup a bogus ssh server with nc and try to connect to it with ssh(1). Copy-paste the server version string you captured in 2.1 and see if you get a response from the client. What is the client trying to negotiate?  1 p

3. Examining telnet connection using tcpdump

3.1 Start a telnetd(8) server, if it's not already running. Also start capturing traffic on the loopback interface with tcpdump(8). Connect to the server with a telnet(1) client. What kind of option negotiation are the telnet server and the client going through? Read the RFC describing the options, and explain in your own words, what do they agree upon echoing characters (pay attention to port numbers for direction of the messages).  2 p