CCN Lab Revision PDF
Document Details
Uploaded by Deleted User
Tags
Summary
This document contains questions/revision notes focused on HTTP, TCP, and DNS concepts. It covers topics such as header lines, message formats, and connection types. It also includes questions about DNS and network layer.
Full Transcript
HTTP 1. Which header lines are absent when a HTTP reply does not carry an object? Last modified, Content length and Content type 2. What is the difference between a HTTP GET message and conditional GET message? Conditional GET message contains the If-Modified-Since header line which is not pr...
HTTP 1. Which header lines are absent when a HTTP reply does not carry an object? Last modified, Content length and Content type 2. What is the difference between a HTTP GET message and conditional GET message? Conditional GET message contains the If-Modified-Since header line which is not present in the GET message 3. What is the difference between Date and Last Modified header line in HTTP response? Date refers to the time when the web server replies to a HTTP request. Last modified refers to the time when the object at the server was created/modified 4. Give examples of HTTP status code and phrase combination. 200 OK 301 Moved Permanently 302 Found 304 Not Modified 400 Bad Request 404 Not Found 502 Bad Gateway 5. Write the HTTP request line for a client using the URL www.school.edu/homepage.html GET /homepage.html HTTP/1.1 6. How is the name of a web server referred to in HTTP message format? How are the client process and the server process referred to in HTTP message format? Give one example of the server process. Name of the web server is referred to as Host. The client process and server process are referred to as User-agent and Server respectively. Examples of server process: Apache Server; Microsoft Internet Information Server 7. Where do you find the following header line: Host, Server, Date, Accept Language and Connection? Host and Accept Language are found in HTTP request (i.e., GET message) Server and Date are found in HTTP reply Connection is found in HTTP request and reply 8. Distinguish persistent and non-persistent TCP in the context of a HTTP message? How are they specified in a HTTP message? Persistent TCP: Multiple objects are fetched over one TCP connection. In HTTP it is specified as Connection: Keep alive Non-persistent TCP: Each object is fetched over a separate TCP connection. In HTTP it is specified as Connection: Close 9. Suppose a webpage having three embedded objects are to be sequentially downloaded from the same web server for the first time using a (lossless) persistent TCP connection. Let each object have size of one MSS. How many HTTP requests are involved? Calculate the total access delay (connection time + download time) using an illustration. 4 HTTP requests will be sent by the client. Total access delay is given by 5 RTT. 1 10. Suppose a webpage having two embedded images are to be sequentially downloaded from the same web server for the first time using (lossless) non-persistent TCP connection. Let each object have size of one MSS. How many HTTP requests are involved? Calculate the total access delay (connection time + download time) using an illustration. 4 HTTP requests will be sent by the client. Total access delay is given by 8 RTT. DNS 1. What are the port numbers of DNS server and client respectively? What are the transport protocols used for HTTP and DNS? Server port 53 and client port is any 16-bit random number (excluding some well define server port numbers). HTTP: TCP and DNS: UDP 2. What is contained in a DNS message? A DNS message contains DNS header (i.e., Identification, Flags, No. of questions, No. of answers, No. of authoritative resource records, No. of additional resource records) and the body (i.e., Questions, Answers (if reply), Authoritative RRs (if any), Additional RRs (if any)). 3. What is the length of the header in a DNS message? Given a transport layer segment containing the DNS message, how to calculate the length of a DNS message? 2 The size of the header in a DNS message is 12 bytes. The length of the DNS message is given by Length field in UDP minus 8 bytes. 4. Write the command line request to fetch the canonical name of www.school.edu. Write the command line request to fetch the IP address of www.school.edu. Canonical name: nslookup –Type=CNAME www.school.edu IP address: nslookup –Type=A www.school.edu 5. Give four ways to identify a query and a response by observing the DNS messages in Wireshark? i. Find out the IP address of the client and DNS servers using nmcli dev show enp2s0. Then the IP address can be used to distinguish the packets in Wireshark (e.g., query has source IP = client IP and destination IP = server IP). ii. UDP source port will be 53 in response whereas destination port is 53 in query. iii. Response flag is set in a response but equals 0 in a query iv. Recursion available flag may be set in a response but equals 0 in a query 6. Suppose a client has never contacted the web server before but sends a request for a webpage. What is the order of segments sent out by the client and what do they contain? The client sends in the given order: i. A DNS query in a UDP segment to the DNS server ii. It sends TCP SYN segment to the web server iii. It sends TCP ACK segment to the web server iv. It sends TCP segment having HTTP request (iii and iv can be combined) TCP 1. What are the sizes of a TCP header and typical size of an IPv4 header? TCP header: 20 bytes and IP header: 20 bytes 2. Explain TCP connection establishment. Client sends SYN segment to server. Server replies with SYNACK segment. In response, the client sends the ACK segment to the server. 3. Explain how a client closes TCP connection. Client sends FIN segment to server (and enters wait state) and server replies with ACK segment. Sever sends FIN segment to client and client responds with ACK segment. Client waits for 30 seconds and closes the connection. 4. What are the sizes of the following in bits: sequence number, source port number, urgent data pointer, receive window and header length? Seq. no. (32), source port (16), urgent data pointer (16), receive window (16) & header length (4) 5. How do sequence number of client and sequence number of the server change when the client downloads objects over a TCP connection? 3 Client’s sequence number stays constant while server’s sequence number increments by the size of the TCP segments received 6. How do sequence number of client and sequence number of the server change when the client uploads objects over a TCP connection? Server’s sequence number stays constant while client’s sequence number increments by the size of the TCP segments sent 7. How do the acknowledgement number of client and the acknowledgement number of the server change when the client downloads objects over a TCP connection? Server’s acknowledgement number stays constant while client’s acknowledgement number increments by the size of the TCP segments received 8. How do the acknowledgement number of client and the acknowledgement number of the server change when the client uploads objects over a TCP connection? Client’s acknowledgement number stays constant while server’s acknowledgement number increments by the size of the TCP segments sent 9. Name the fields in the TCP segment which are used for congestion control and flow control. Sequence number, acknowledgement number, ACK, receive window 10. What are various flags in the TCP segment? Which flag is activated when an ACK segment has payload? Which flag is activated for closing unused TCP ports? Flags: SYN, ACK, FIN, PSH, URG, RST. PSH is used along with ACK when payload is piggy-backed RST is used for closing unused TCP posts 11. What TCP field is used for negotiating the MSS between the sender and the receiver? What is the effect of this field on the size of the TCP header? Options field is used. Options field causes TCP header size to be greater than 20 bytes. 12. What is the difference between TCP and UDP? Name one routing protocol which uses UDP and one routing protocol which uses TCP. TCP is connection oriented and UDP is connectionless. TCP provides reliable data transfer and congestion control whereas UDP doesn’t. RIP uses UDP whereas OSPF and BGP use TCP. 13. How is the message fragmentation performed under TCP? Suppose a client is downloading a long object from the server. How can you tell if all segments of the object have been received by the client using Wireshark? Fragmentation is done by dividing the message size by the size of the MSS negotiated by the client and the server during the TCP connection. When all segments have been received client acknowledges the FIN segment sent by the server. 4 14. Suppose the socket library has been imported. Write python commands to declare opening and closing of a TCP connection by a client. socket.connect((“server_IP”,server_port)) socket.close() 15. Write python commands to declare a UDP socket and to declare a TCP socket. s = socket(AF_INET,SOCK_DGRAM) # UDP socket s = socket(AF_INET,SOCK_STREAM) # TCP socket 16. Write python commands for sending and receiving data using UDP socket. socket.sendto(data, (“host_IP”,host_port)) socket.recvfrom(2048) Network layer + GNS3 1. Write one line command to check the line statuses of all interfaces in a router. Write a one line command to see the network reachability of a router. show ip interface brief show ip route 2. How is checksum calculation different in network layer and in transport layer? Why do we need error detection in both layers? Checksum is computed over the entire segment in transport layer but only in network layer only network layer header part is considered. Error detection is needed in both places to ensure support of various upper layer protocols, addressing formats and network devices that may exist between the source and destination. The earlier the error is detected the better. 3. What is the usable range of IP addresses under the address space 192.168.1.128/28? Provide a suitable subnet mask. 192.168.1.129 – 192.168.1.142 Subnet mask: 255.255.255.240 4. Give two differences between static addressing and dynamic addressing. Static addressing is simple and works well in small networks. Dynamic addressing is complex and works well for large networks. Dynamic addressing is done via the DHCP protocol while static addressing has no protocol 5. How is checksum calculated in network layer by a sender? What is the size of checksum field? The network layer header is split into 16 bit words and summed. Any carry generated is added back to the sum. Ones complement of the final sum is taken and stored as checksum. Size of checksum is 16 bits 6. What are the sizes of the Identification, TTL, fragmentation offset and datagram length fields in bits? Name one common field between TCP and IP header having same size? 5 Identification (16), TTL (16), fragmentation offset (13) and datagram length fields (16) in bits Header length (also checksum) is common in both the TCP and IP header. 7. What are the Types and codes of the Echo messages (Ping) exchanged by a sender and a receiver? What is the purpose of the Echo messages? Echo request: 8 and 0 Echo reply: 0 and 0 Purpose of Echo messages is to know node reachibility. 8. What is the command to send the echo message to a host having IP 192.168.1.10 from a host 192.168.1.1? What statistics do you expect to see? ping 192.168.1.10 Statistics: RTT, number of successes out the packets sent 9. What is the command to send the echo message to a host having IP 192.168.1.10 from a host 192.168.1.1 over TCP? What is expected to happen in Wireshark? ping 192.168.1.10 –P 6 5 Echo messages will be exchanged. Each message exchange will have its own connection establishment and closing. 10. What are the advantages of dynamic routing over static routing? Dynamic routing is efficient, simple to configure and the best path is chosen based on the link metrics. Static routing is cumbersome for large networks and may result in looping. 11. Draw a simple 2 hop network (i.e., network having 2 routers and at most 2 hops) having subnets 10.0.0.0/24, 20.0.0.0/24 and 192.168.1.240/30. Assign IP addresses to all router interfaces manually. Write the dynamic routing configuration for the routers using RIP. R1(config)# router rip R2(config)# router rip R1(config-router)#version 2 R2(config-router)#version 2 R1(config-router)#network 10.0.0.0 R2(config-router)#network 20.0.0.0 R1(config-router)#network 192.168.1.252 R2(config-router)#network 192.168.1.252 R1(config-router)#end R2(config-router)#end 6 12. Draw a simple 2 hop network (i.e., network having 2 routers and at most 2 hops) having subnets 10.0.0.0/24, 20.0.0.0/24 and 192.168.1.240/30. Assign IP addresses to all router interfaces. Write static routes between for the routers. Same figure as in 11 R1(config)# ip route 20.0.0.0 255.255.255.0 192.168.1.254 R2(config)# ip route 10.0.0.0 255.255.255.0 192.168.1.253 13. What are the four messages exchanged between the DHCP client and DHCP server? What is the source and destination IP address of the first message? Discovery, Offer, Request and Acknowledgement Source IP: 0.0.0.0 and Destination IP: 255.255.255.255 14. How to exclude the address range 10.0.1.10 to 10.0.1.20 from being assigned by the DHCP server running on router R1? Explain the meaning of the command R1(dhcp-config)# network 10.0.1.0 /24. R1(dhcp-config)# ip dhcp excluded-address 10.0.1.10 10.0.1.20 The command indicates that the DHCP server will assign IP addresses from the space 10.0.1.0/24 15. Write GNS3 commands to specify the gateway and the DNS server when configuring the DHCP server on router R1. R1(dhcp-config)# default-router R1(dhcp-config)# dns-server 16. How to view the number of messages exchanged between the DHCP server and the DHCP clients? Type the following in the DHCP server: show ip dhcp server statistics 17. State one advantage and one disadvantage of NAT. Advantages: Increased address space under IPv4 without intervention of an ISP. Disadvantage: Establishing TCP connections to private hosts are complex; Slows down transitions to IPv6; Destroys the end-to-end principle in TCP connections 18. What is the meaning of the commands 1st line: Declare the public IP addresses to be used along with the prefix 2nd line: Declare the private network address and the wild card number 3rd line: Enable static NAT mapping between public IP addresses and private IP addresses 7