Out: Sept 6/7, 2016
Due: Sept 21, 2016 (start of lecture)
Total Marks: 30 Bonus: 6

Lab 1: TCP/IP Network Monitoring

EXERCISE 1.1: Determining Host and Network IP Addresses (12 marks)
Do Exercise 1.1 both using Windows and then Linux running under VMWare.

  1. Using the ipconfig command in the Windows and Linux cmd line, record the following information for your workstation: (7 marks)
  2. interface names
  3. physical address (MAC). Supply the 1st 6 hex digits of this address to the lookup tools @ and report the name of the company that supplies this address.
  4. ip address (V4 and V6 if both applicable)
  5. subnet mask(IPv4 only)
  6. broadcast address. (IPv4 only)
  7. Research question: Find out and record how to change the mac address both under Windows and under Unix. Try it out. Were you successful? (2 marks)
  8. Use the IPv4 address and netmask for your workstation to find: (3 marks)
  9. the subnet id.
  10. the number of possible subnets
  11. the range of possible subnet addresses for the Humber site (Humber's IP address is 142.214.0.0)
  12. the number of possible hosts on the subnet.
  13. the range of host addresses on the subnet.
  14. Apply the netstat -in command to determine (2 marks)
  15. interface name
  16. IP addresses of the interfaces
  17. network address.
  18. Does the information agree with your calculations in the previous question? If not, what are the differences

EXERCISE 1.2: IP Routing (8 marks/2 each)
Use both Windows and Linux running under VMware for the following. In each case explain any differences in the results.

  1. Using the netstat -rn command, determine the IP address used to reach the attached network and the IP addresses of the routers used to reach remote networks.
  2. Using the ping command, check the connectivity from the workstation to munro. What is the round trip time and what % of the packets were lost.
  3. Use the traceroute (in Windows tracert) command, determine the route used when an IP datagram is sent from the workstation to munro. (a) List the IP addresses of all gateways/routers in the path.

(b) Make a sketch of the route showing the networks and routers in the path. Using thearp -a (or netstat -[n]p) command to examine the arpcache, determine the physical address of any gateways on the workstation's locally attached network.

(b) What physical address does the workstation use when it sends an IP datagram to munro?

  1. Examine the arp cache and note the entries that belong to locally attached stations.
    Now ping a locally attached station that does not have an entry in the cache. (Use the ip address of some other workstation in the lab.)
    Re-examine the cache. Does it contain a new entry? Explain.

Exercise 1.3 Pipes. (10 marks)
In this exercise you are going to write a simple chat program that works between two terminals on munro by communicating through named pipes. The sample program uses the fork function to create two processes that talk to each other. Here you are going to create 2 programs and run them in 2 different terminal windows. Later in the term you are going to create a similar program using sockets that communicates between 2 different machines.

  1. Use the mkfifo command to create 2 named pipes
  2. Write a program server that takes the names of the pipes as command line arguments. Your program will open the 1st pipe for writing and the 2nd pipe for reading.
  3. Your program should prompt the user to enter a message at the terminal – the message is ended by a newline. That message should then be written to the 1st pipe. Your program should then try and read the 2nd pipe for a response. When the response is there, output it to the terminal.
  4. Create a 2nd version of the program client that takes the names of the same 2 pipes which you will supply in reverse order. The 2nd program should try and read first and then write. Otherwise it’s the same program.
  5. Start up client and server in different terminal sessions. Verify that you can run a chat session. Hand in a copy of both programs along with a status report. (6 marks)

  6. Now use fork to separate the reader from the writer so that they can work in any order so that either A or B can go first or can send several messages while the other person just watches.. In this case you’ll only need 1 version of the program. Hand in a listing along with a final program status. (4)
  7. Bonus (6 marks)
  8. Create a command whoRUwhich when sent to the other terminal, has the other terminal respond with its tty (2)
  9. Create a command again that has the other terminal resend its last response. If there are no previous responses it should send the string (none). This means that the terminal has to save its last responses. (2)
  10. When we revisit this program using sockets you will be asked to add a command last nnn which will resend the last n responses. Without actually implementing the code, describe how you would have to modify the program to achieve this. (2)