Fishnet Assignment 4: A Firewall

Out: Friday, February 28, 2002

Due: Tuesday, March 14, 2002.

CSE/EE461 Winter 2002; Anderson.

In this assignment, you will work in teams of two to develop a Fishnet node that implements a firewall. The program you write builds on your solution so far. The goal of this assignment is for you to understand firewalls.

  1. What You Need To Write

Write a C program called hw4.c that implements a filter-based firewall with dynamic port selection, as described below. This specification may leave some points ambiguous; do what you think is best as long as your program can interoperate with the sample solution and other nodes, and document the design decisions you make.

Drop a packet

Drop: SA:SP -> DA:DP\n

Open a connection

Open: SA:SP -> DA:DP\n

Time out an idle connection

Timeout: SA:SP -> DA:DP\n

Close connection after seeing FINs and ACKs

Teardown: SA:SP -> DA:DP\n

  1. Step-by-Step Development and Test Instructions

Here is a suggested set of steps to develop the required functionality.

  1. Try running fishhead with the "–-topology hierarchy" and building a network out of hw3 nodes to see how fishhead builds a hierarchical network. Or, look at the class network at http://jimbo:7777/
  2. Start with hw2.c by copying it to the new file hw4.c.
  3. Begin by modifying your forwarding code to drop any packets with a source outside the subnet and a destination inside the subnet. Also add the related output, since it’s helpful for debugging. It may help to classify transport packets as interior (between two nodes within the subnet), exterior (between two nodes outside the subnet), outbound (from a node within the subnet to the outside), or inbound (from a node outside the subnet to within).
  4. Test your classification using a fishhead configured for a hierarchical topology. Run hw4 with address 9810 (for example), to make it a border router. Then start a hw3 node with address 9811 (in the same subnet as the firewall) and another with address 1 (on the internetwork). Try to transfer a file from inside the subnet to outside the subnet and check that packets can leave the subnet, but can’t enter.
  5. Then, add the code to open a transport connection through the firewall and test it. You may wish to reuse or modify data structures or code from implementing transport in assignment 3 to accomplish steps 4, 5, and 6.
  6. Next, add the code to close the connection at the firewall if the transport connection is idle for IDLE_TIMEOUT seconds.
  7. Finally, add and test the code to close the connection at the firewall after seeing FIN packets sent and acknowledged in both directions.
  8. Try introducing loss to your Fishnet. How does your firewall do?
  9. Try adding a subnet with a firewall to the class network.
  1. Turn In and Discussion Questions

Submit your source file(s) and the modified Makefile, if needed, using the turnin program. Hand in a paper copy of the discussion questions and test cases below as well as your source code.

  1. Construct a network including a firewall, two hw3 or hw3-sample nodes belonging to the firewall’s subnet, and two unfirewalled nodes. Try to transfer a file between two inside nodes, two outside nodes, from an outside node to an inside node, and from an inside node to an outside node. Capture the output from all five nodes and turn in as your test cases. Mark up the output to indicate which output belongs to which test.
  2. Leave a firewall node running on the class Fishnet, as in the previous assignments.
  3. Why wait MAX_RETRANSMIT * RETRANSMIT_TIMEOUT seconds after seeing acknowledgements of FIN packets sent in both directions to close the connection, rather than closing the connection immediately?
  4. In this project, we specified that the firewall should not participate as a client or server in a transport connection. In general, why might it be a good idea to disable this and other unessential services on a firewall?