Practical - 2 NS
Practical - 2 NS
AIM: Understand and identify header fields of layers of TCP/IP protocol stack.
Students need to fill the empty table and write answers to questions.
As per the discussion in classroom, any user starts internet access through browser or network
applications. Following figure 2.1 explain scenario of receiving data at NIC Card. NIC card receives
signals and it converts into sequence of 0’s and 1‘s. After receiving data it sends data for the further
processing to TCP/IP protocol stack. In this exercise you need to identify boundaries of fields of
headers, describe and understand flow of information in protocol stack.
Page 1 of 16
This is the data stream which receiver NIC card receives from wire and stores into memory. Length
of bits stream is 432 bits.
00000000000110101000110001101011011101101010110011101000110110001101000101000110
11110011111100010000100000000000010001010000000000000000001010000001010110111101
01000000000000001000000000000110000000000000000010101100000100000000110001111011
10001110111110101011011101001110110001010111001100000001101110110100100111101111
01111101000110101111001000001000000110100010011101010000000100000001000000001010
11111110111011100000000000000000
Abstract view of data with respect to the location of headers and data in the actual data stream.
Initial 112 bits contains Ethernet Header (Refer section 2.2), Next 160 bits contains IP Header (Refer
section 2.3), Next 160 bits contains TCP Header (Refer section 2.4).
Section 2.1 contains bit stream. copy and paste respected number of bits into following table 2.1 to
prepare ethernet header field boundary.
From table 2.1, fill table 2.2 with respected value and explanation meaning of each field. Refer the
following link for better understanding. Refer video 1 in material 1 for further understanding.
Page 2 of 16
MAC Address
Source MAC 48 bits E8:D8:D1:46:F3F1 Sender’s MAC address
Address
Type 16 bits 0x800 0x800 indicates, Network Header type is
IPv4 Header
Section 2.1 contains bit stream. copy and paste respected number of bits into following table 2.3 to
prepare ethernet header field boundary.
10101100000100000000110001111011
10001110111110101011011101001110
From table 2.3, fill table 2.4 with respected value and explanation meaning of each field. Refer the
following link for better understanding. Refer video 2 in material 2 for further understanding.
Reference Links:
https://en.wikipedia.org/wiki/IPv4#Header
DCSP & ECN: https://en.wikipedia.org/wiki/Type_of_service#DSCP_and_ECN
Flags: https://en.wikipedia.org/wiki/IPv4#Flags
Protocol: https://en.wikipedia.org/wiki/List_of_IP_protocol_numbers
Page 3 of 16
Total length 16 bits 0x28 Total length of 40 bytes
Identification 16 bits 0x15BD
flags 3 bits 0x2 2 bit More Fragment (MF)
Fragment 13 bits 0x0 This packet does not contain fragments.
offset
Time to live 8 bits 0x80 128 Hops / Routers
Protocol 8 bits 0x06 This packet should be give to TCP receive
procedure. As its value indicates TCP.
Header 16 bits 0x0 No checksum included in this header.
checksum
Source IP 32 bits 172.16.12.123 Source IP: 172.16.12.123, its local machine
Address
Destination IP 32 bits 142.250.183.78 Destination: 142.250.183.78, it is situated
Address in ____ country
Section 2.1 contains bit stream. copy and paste respected number of bits into following table 2.5 to
prepare ethernet header field boundary.
01001001111011110111110100011010
11110010000010000001101000100111
1111111011101110 0000000000000000
Page 4 of 16
From table 2.5, fill table 2.6 with respected value and explanation meaning of each field. Refer the
following link for better understanding. Refer video 4 in material 4 for further understanding.
Reference Link :
https://en.wikipedia.org/wiki/Transmission_Control_Protocol#TCP_segment_structure
Flags: https://www.gatevidyalay.com/transmission-control-protocol-tcp-header/
Port : https://www.adminsub.net/tcp-udp-port-finder/
Page 5 of 16
Exercise-1: Input Sequence TCP
11101000110110001101000101000110111100111111000100000000000110101000110001101011
01110110101011000000100000000000010001010000000000000000001010001011111111010010
01000000000000000100000000000110110011101101000001100111001110111000110001100110
10101100000100000000110001111011000000011011101111110010110010000011000100010000
00000101111000001110010000000000010000101001101001010000000100000000000011111011
10110000100111010000000000000000000000000000000000000000000000000000000000000000
Page 6 of 16
Header fields of Network
Page 7 of 16
0111 0100 =
4274
Sequence 32 bits Next 32 bits = Sequence number of data.
Number 0010 1000
0001 0111
1111 1111
1110 0101 =
2817FFE5
Page 8 of 16
Exercise-2: Input Sequence of UDP
11101000110110001101000101000110111100111111000100000000010100000101011010101011
11110010011001110000100000000000010001010000000000000000001010000010000101011001
00000000000000001000000000010001101010011000100110101100000100000000101101000111
10101100000100000000110001111011111001110010000000001101001111010000000000010100
10001101001111111111010010000000000001011110011100000100000000000000000000000100
00000000000000010000111111011001000000000000000000000000000000000000000000000000
Page 9 of 16
Exercise-3: Input Sequence: ARP Broadcast
11111111111111111111111111111111111111111111111111100000011000111101101001010100
01110001010001000000100000000110000000000000000100001000000000000000011000000100
00000000000000011110000001100011110110100101010001110001010001001010110000010000
00001000001000010000000000000000000000000000000000000000000000001010110000010000
00000111100111010000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000
Page 10 of 16
Exercise-4: Input Sequence: ARP Reply
11111111111111111111111111111111111111111111111101001100000100011011111110011101
11110011100010110000100000000110000000000000000100001000000000000000011000000100
00000000000000100100110000010001101111111001110111110011100010111010110000010000
00001110011010110000000000000000000000000000000000000000000000001010110000010000
00001110011010110000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000
Page 11 of 16
Questions and answers:
2. What is the significance of Sequence Number and Acknowledgment Number in TCP format?
Answer: The Sequence Number in TCP helps in ensuring data is received in the correct order, while
the Acknowledgment Number is used to confirm receipt of data packets.
3. What is the full form of the MAC address? What is the significance of source and destination
MAC address?
Answer: MAC stands for Media Access Control. The Source MAC address identifies the sender’s
network interface, while the Destination MAC address identifies the receiver's network interface in
a local network.
Page 12 of 16
Gate Questions:
1. What is the maximum size of data that the application layer can pass on to the TCP layer
below?
A) Any size
B) 216 bytes - size of TCP header
C) 216 bytes
D) 1500 bytes
Ans: D
2. The protocol data unit (PDU) for the application layer in the Internet stack is:
A) Segment
B) Datagram
C) Message
D) Frame
Ans: C
3. A TCP message consisting of 2100 bytes is passed to IP for delivery across two networks. The
first network can carry a maximum payload of 1200 bytes per frame and the second network
can carry a maximum payload of 400 bytes per frame, excluding network overhead. Assume
that IP overhead per packet is 20 bytes. What is the total IP overhead in the second network
for this transmission?
A) 40 bytes
B) 80 bytes
C) 120 bytes
D) 160 bytes
Ans: B
6. Consider the following statements about the timeout value used in TCP.
i. The timeout value is set to the RTT (Round Trip Time) measured during TCP connection
establishment for the entire duration of the connection.
ii. Appropriate RTT estimation algorithm is used to set the timeout value of a TCP
connection.
iii. Timeout value is set to twice the propagation delay from the sender to the receiver.
Which of the following choices hold?
A) (i) is false, but (ii) and (iii) are true
B) (i) and (iii) are false, but (ii) is true
Page 13 of 16
C) (i) and (ii) are false, but (iii) is true
D) (i), (ii) and (iii) are false
Ans: B). (i) and (iii) are false, but (ii) is true
7. Consider an IP packet with a length of 4,500 bytes that includes a 20-byte IPv4 header ans 40-
byte TCP header. The packet is forwarded to an IPv4 router that supports a Maximum
Transmission Unit (MTU) of 600 bytes. Assume that the length of the IP header in all the
outgoing fragments of this packet is 20 bytes. Assume that the fragmentation offset value
stored in the first fragment is 0.
The fragmentation offset value stored in the third fragment is ______ .
Note –This was ..Numerical Type question.
A) 0
B) 72
C) 144
D) 216
Ans: C ). 144
8. Consider two hosts P and Q connected through a router R. The maximum transfer unit (MTU)
value of the link between P and R is 1500 bytes, and between R and Q is 820 bytes.
A TCP segment of size 1400 bytes was transferred from P to Q through R, with IP identification
value as 0×1234. Assume that the IP header size is 20 bytes. Further, the packet is allowed to
be fragmented, i.e., Don’t Fragment (DF) flag in the IP header is not set by P.
9. One of the header fields in an IP datagram is the Time to Live(TTL)field.Which of the following
statements best explains the need for this field?
A) It can be used to prioritize packets
B) It can be used to reduce delays
C) It can be used to optimize throughput
D) It can be used to prevent packet looping
Ans: D). It can be used to prevent packet looping.
10. In an IPv4 datagram, the M bit is 0, the value of HLEN is 10, the value of total length is 400 and
the fragment offset value is 300. The position of the datagram, the sequence numbers of the
first and the last bytes of the payload, respectively are:
A) Last fragment, 2400 and 2789
B) First fragment, 2400 and 2759
Page 14 of 16
C) Last fragment, 2400 and 2759
D) Middle fragment, 300 and 689
Ans: B). First fragment, 2400 and 2759
11. The maximum number of IPv4 router addresses that can be listed in the record route (RR)
option field of an IPv4 header is__________________.
Ans: 9
12. Consider an IP packet with a length of 4, 500 bytes that includes a 20 − byte IPv4 header ans 40
− byte TCP header. The packet is forwarded to an IPv4 router that supports a Maximum
Transmission Unit (MTU) of 600 bytes. Assume that the length of the IP header in all the
outgoing fragments of this packet is 20 bytes. Assume that the fragmentation offset value
stored in the first fragment is 0.
13. For which one of the following reasons does internet protocol(IP) use the time-to-live(TTL)
field in IP datagram header?
A) Ensure packets reach destination within that time
B) Discard packets that reach later than that time
C) Prevent packets from looping indefinitely
D) Limit the time for which a packet gets queued in intermediate routers
Ans: C). Prevent packets from looping indefinitely.
14. One of the header fields in an IP datagram is the Time-to-Live (TTL) field. Which of the
following statements best explains the need for this field?
A) It can be used to prioritize packets.
B) It can be used to reduce delays.
C) It can be used to optimize throughput.
D) It can be used to prevent packet looping.
Ans: D). It can be used to prevent packet looping.
15. Host A (on TCP/IP v4 network A) sends an IP datagram D to host B (also on TCP/IP v4 network
B). Assume that no error occurred during the transmission of D. When D reaches B, which of
the following IP header field(s) may be different from that of the original datagram D?
i. TTL
ii. Checksum
iii. Fragment Offset
A) i only
B) i and ii only
C) ii and iii only
D) i, ii and iii
Ans: B). I and ii only
16. Host A sends a UDP datagram containing 8880 bytes of user data to host B over an Ethernet
LAN. Ethernet frames may carry data up to 1500 bytes (i.e. MTU = 1500 bytes). Size of UDP
header is 8 bytes and size of IP header is 20 bytes. There is no option field in IP header. How
many total number of IP fragments will be transmitted and what will be the contents of offset
field in the last fragment?
A) 6 and 925
B) 6 and 7400
Page 15 of 16
C) 7 and 1110
D) 7 and 8880
Ans: A). 6 AND 925
17. An IP datagram of size 1000 bytes arrives at a router. The router has to forward this packet on
a link whose MTU (maximum transmission unit) is 100 bytes . Assume that the size of the IP
header is 20 bytes .
The number of fragments that the IP datagram will be divided into for transmission is
__________________________.
Ans: 10
18. In the TCP/IP protocol suite, which one of the following is NOT part of the IP header?
A) Fragment Offset
B) Source IP address
C) Destination IP address
D) Destination port number
Ans: D). Destination port number.
Page 16 of 16