CSC 175 Final Exam Study Guide The exam will cover mostly subjects since the first exam, but may overlap in some areas 0. iptables -t nat (part of iptables not covered on midterm) 1. TCP protocol including opening and closing handshakes, flow control (sliding window), congestion control, the Jacobson/Karels algorithm, and Nagel's algorithm (all covered in section 5.2). Also covered is the difference between TCP and UDP. 2. Linux connection tracking (iptables -m conntrack (-m state)) and its meaning relative to TCP and UPD 3. ***NOT ON EXAM***: The domain name system (DNS). 4. TCP Socket programming in Java or C (you can choose between the two): You will be asked to write a program that implements a simple protocol that will be specified on the exam. You will upload your source code as well as communicate with a peer program. Partial credit will be given if your program doesn't work, based on the source code submitted. No multi-threading will be required. -------------------- Sample Problems (ignore numberings, solutions in separate file) (Note, most of the iptables questions on the exam will concern NAT) 1. Explain what's wrong with the following rules. Don't correct it. Describe what's wrong a. iptables -A INPUT -p udp -p tcp --dport 53 ! -s 10.1.0.0/16 -j DROP b. iptables -A OUTPUT -i ens1 -p tcp --dport 79 -j DROP c. iptables -t nat -A POSTROUTING -p udp --dport 53 -j DNAT --to 10.1.0.1:53 2. Suppose you used the following rules on a router: iptables -A FORWARD -d 147.4.180.0/24 -p udp --dport 53 -j DROP iptables -t nat -A PREROUTING -d 147.4.180.0/24 -p udp --dport 53 -j DNAT --to 10.1.0.3 Assume there are no other rules in effect and the the default policy of FORWARD is ACCEPT. Explain carefully the effect of the above two rules. What will happen to udp dport 53 packets going to 147.4.180.0/24? 3. Suppose you're running a router for the subnet 10.1.0.0/16 on interface ens1 so they can share your real IP address, 96.57.41.74, on the internet. Write a iptables rule to affect that. 4. Explain what does it mean for a udp "connection" to be in --state ESTABLISHED Why is udp called a "connectionless" protocol if a connection can be established? 6. Explain as precisely as possible how a TCP sender uses the "advertised window" of the receiving side. 6b. Does a TCP agent acknowledge a packet as soon as it's received? If not, describe a specific situation in which the acknowledgement will be delayed. 7. In what way is the Jacobson/Karels algorithm an improvement over the original algorithm, which only took the weighted average of sample RTTs? 7b. Will a larger average deviation value lead to a longer or shorter timeout value with the Jacobson/Karels algorithm? Explain using either math, or careful reasoning. 10. Explain why the TCP congestion control algorithm is needed in addition to the sliding window algorithm. That is, what's the difference between "flow control" and "congestion control". --- I will probably not ask the following questions on the exam, since you can easily lookup the answer, but these questions are still useful for reviewing the basics: 11. Given a Socket object cfd, explain the meaning of the call: cfd.setTcpNoDelay(true); When might you want to use this? ---------- Additional problems (ignore numbering): 4. In a statement such as: int r = din.read(buffer,0,128) Explain the precise meaning of: a. the last parameter b. the return value 4b. in a java call to new ServerSocket(x); What value does x represent? 4c. Given a ServerSocket sfd, what value (if any) does sfd.accept() return? 4d. What is ntohs in C for and explain why it's needed. Why is there no equivalent command in Java? 4e. Java has a DataInputStream.readUnsignedShort function but no DataOutputStream.writeUnsignedShort function. Explain why. 4f. In in Unix/C call to socket(AF_INET,SOCK_STREAM,0), what do the parameters AF_INET and SOCK_STREAM signify? If this type of question is asked on the final, you will have the choice of answering either this question or a java-oriented question. 5. Given a buffer in java byte[] A of length A.length, or a buffer unsigned char A[] of length Alength in C. Write a fragment of code that reads in exactly A.length (or Alength) number of bytes into the buffer (fill the buffer). hint: need while loop. 6. Can multiple packets sent from the same UDP socket be destined for different destination addresses? Can this be true in TCP? 7. Explain why a general-purpose proxy server would require multiple threads. What would the threads do?