0% found this document useful (0 votes)
18 views16 pages

Practical - 2 NS

Uploaded by

Devarshi kansara
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views16 pages

Practical - 2 NS

Uploaded by

Devarshi kansara
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 16

Practical-2

AIM: Understand and identify header fields of layers of TCP/IP protocol stack.

Tools Required: WordPad or Notepad.


Submission: After writing the answer into this word document, Student needs to change name to his
ID followed by a practical number. Ex 20ce005_Pr1.docx. Upload on assignment segment.
Rubrics: Nicely drafted document with clarity in answers leads to full marks. Otherwise, submission
carries a proportional mark.
---------------------------------------------------------------------------------------------------------------
Watch and refer following videos for a better understanding of the header fields of layers of
TCP/IP:
Material 1. Ethernet frame (): https://www.youtube.com/watch?v=SoTRqDLND6Y
Material 2. IPv4 header format (): https://www.youtube.com/watch?v=3Y70y6dM7Cs
Material 3. IPv4 Vs IPv6(): https://www.youtube.com/watch?v=NkE9_iRPi1I
Material 4. TCP and UDP (): https://www.youtube.com/watch?v=r4HbLQuqvrM

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.

Figure 2.1 Real Scenario

2.1 Input data stream: TCP

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.

Data Link (Ethernet) Network Transport Data


Header Header Header

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).

2.2 Header format of Ethernet

Figure 2.2 Ethernet Header Format

Section 2.1 contains bit stream. copy and paste respected number of bits into following table 2.1 to
prepare ethernet header field boundary.

Table 2.1 Header format of ethernet


00000000000110101000110001101011 11101000110110001101000101000110 0000100000
0111011010101100 1111001111110001 000000

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.

Reference Link : https://en.wikipedia.org/wiki/Ethernet_frame#Header


https://en.wikipedia.org/wiki/EtherType

Table 2.2 Header fields of Ethernet


Header Field Length of Header field Value Meaning
Name Field (in bits) (Hex Value)
Destination 48 bits 00:1A:8C:6B:76:AC Receiver’s MAC address

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

2.3 Header format of Network

Figure 2.3 IPv4 header format

Section 2.1 contains bit stream. copy and paste respected number of bits into following table 2.3 to
prepare ethernet header field boundary.

Table 2.3 Header format of network


0100 0101 000000 00 0000000000101000

0001010110111101 010 0000000000000

10000000 00000110 0000000000000000

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

Table 2.4 Header fields of Network


Header Field Length of Header field Value Meaning
Name Field (in bits) (Hex Value)
Version 4 bits 0x4 IP Datagram version 4
IHL 4 bites 0x5 5*32bits=160bits=20bytes
DSCP 6 bits 0x0 ---
ECN 2 bits 0x0 ---

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

2.4 Header format of transport layer: TCP

Figure 2.4 TCP Header format

Section 2.1 contains bit stream. copy and paste respected number of bits into following table 2.5 to
prepare ethernet header field boundary.

Table 2.5 Header fields of transport layer


1100010101110011 0000000110111011

01001001111011110111110100011010

11110010000010000001101000100111

0101 000000 0 1 0 0 0 0 0001000000001010

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/

Table 2.6 Header fields of Transport Layer: ______________


Header Field Length of Header field Meaning
Name Field (in Value (Hex
bits) Value)
Source Port 16 Bits 50547 Sender machine’s application’s logical port
number 50547.
Destination Port 16 Bits 443 Receiver machine’s receiving logical port
number 443 which indicates source wants
communicate security using https protocol.
Sequence Number 32 Bits 0x49EF7D1A Unique ID assigned by sender to maintain
order of packers at receiver side.
Acknowledgemen 32 Bits 0xF2081A27 This is acknowledge of sent packet.
t Number
Header Length 4 Bits 0x5 Total header Length is
5*32bits=160bits=20bytes
Reserved Bits 6 Bits 0x0 -
URG 1 Bit 0
ACK 1 Bit 1 This packet contains valid
acknowledgement number.
PSH 1 Bit 0 No Push
RST 1 Bit 0 No RST
SYN 1 Bit 0 No SYN
FIN 1 Bit 0 NO Fin
Window Size 16 Bits 0x100A 4106
Checksum 16 Bits 0xFEEE Error identification in packet.
Urgent Pointer 16 Bits 0x0 No urgent content in this packet.

Page 5 of 16
Exercise-1: Input Sequence TCP

11101000110110001101000101000110111100111111000100000000000110101000110001101011
01110110101011000000100000000000010001010000000000000000001010001011111111010010
01000000000000000100000000000110110011101101000001100111001110111000110001100110
10101100000100000000110001111011000000011011101111110010110010000011000100010000
00000101111000001110010000000000010000101001101001010000000100000000000011111011
10110000100111010000000000000000000000000000000000000000000000000000000000000000

Header fields of Ethernet

Header Field Length of Header field Meaning


Name Field (in bits) Value (Hex
Value)
Destination 48 bits 1110 1000 MAC Address of the recipient.
MAC Address 1101 1000
1101 0001
0100 0110
1111 0011
1111 0001 =
E8:D8:D1:46:F
3:F1
Source MAC 48 bits Next 48 bits = MAC Address of the sender.
Address 0000 0000
0000 1101
1010 1000
1100 1011
0111 1011
1010 =
00:0D:A8:C6:B
7:BA
Type 16 bits Next 16 bits = Ethernet protocol type (e.g., IPv4 = 0800, ARP
0000 1000 = 0806).
1010 0010 =
08A2

Page 6 of 16
Header fields of Network

Header Field Length of Header field Meaning


Name Field (in bits) Value (Hex
Value)
Version and 4 bits + 4 bits First 8 bits = IPv4 with header length 20 bytes.
Header Length 0100 0101 =
45
Differentiated 8 bits Next 8 bits = Default service.
Services Field 0000 0000 =
00
Total Length 16 bits Next 16 bits = Total IP packet length in bytes.
0010 0000
0000 0001 =
2001
Identification 16 bits Next 16 bits = Unique packet identifier.
0000 0000
0000 1010 =
000A
Flags and 3 bits + 13 Next 16 bits = No fragmentation.
Fragment bits 0000 0000
Offset 0000 0000 =
0000
Time to Live 8 bits Next 8 bits = TTL value of 80.
(TTL) 0101 0000 =
50
Protocol 8 bits Next 8 bits = Protocol (e.g., TCP = 06, UDP = 11).
0000 0011 =
03
Header 16 bits Next 16 bits = Verifies integrity of the header.
Checksum 1101 1010
0011 0010 =
DA32
Source IP 32 bits Next 32 bits = IP Address of the sender.
Address 1011 1101
1110 1110
Destination IP 32 bits Next 32 bits = IP Address of the recipient.
Address 1100 1101
1101 1011
1101 1011
0111 0011 =
CD:DB:DB:73

Header fields of Transport Layer: _______

Header Field Length of Header field Meaning


Name Field (in bits) Value (Hex
Value)
Source Port 16 bits First 16 bits = Port of the sender.
0100 0111
0011 1000 =
4738
Destination 16 bits Next 16 bits = Port of the recipient.
Port 0100 0010

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

Header fields of Ethernet

Header Field Length of Header field Meaning


Name Field (in bits) Value (Hex
Value)
Destination 48 bits E8:34:11:1B:7F The MAC address of the destination device
MAC Address :81
Source MAC 48 bits 00:16:83:AB:D The MAC address of the source device.
Address A:B0
Type 16 bits 0x01 This field indicates the protocol used in the
payload (IP in this case).

Header fields of Network

Header Field Length of Header field Meaning


Name Field (in bits) Value (Hex
Value)
Version and IHL 8 bits 0x45 IPv4 version and Internet Header Length
(IHL). Here, 0x45 means IPv4 with a header
length of 5 (20 bytes).
Total Length 16 bits 0xD4C3 Total length of the IP packet (header + data).
Identification 16 bits 0x5801 Identifier for fragmenting the IP packet, if
needed.
Flags and 16 bits 0x4001 Flags (DF=Don't Fragment) and fragment
Fragment offset.
Offset
TTL (Time to 8 bits 0xFF Time to live, indicating the maximum number
Live) of hops the packet can make before being
discarded.
Protocol 8 bits 0x11 The transport layer protocol used is UDP.

Header fields of Transport Layer: _______

Header Field Length of Header field Meaning


Name Field (in bits) Value (Hex
Value)
Source Port 16 bits 0xA1A1 The source port number.
Destination 16 bits 0x8041 The destination port number.
Port
Length 16 bits 0x8001 Length of the UDP packet.
Checksum 16 bits 0xFF64 The checksum used to verify the integrity of
the UDP header and data.

Page 9 of 16
Exercise-3: Input Sequence: ARP Broadcast

11111111111111111111111111111111111111111111111111100000011000111101101001010100
01110001010001000000100000000110000000000000000100001000000000000000011000000100
00000000000000011110000001100011110110100101010001110001010001001010110000010000
00001000001000010000000000000000000000000000000000000000000000001010110000010000
00000111100111010000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000

Header fields of Ethernet

Header Field Length of Header field Meaning


Name Field (in bits) Value (Hex
Value)
Destination 48 bits FF:FF:FF:FF:FF: This is a broadcast MAC address (all ones),
MAC Address FF used for sending the ARP request to all
devices on the local network.
Source MAC 48 bits E0:6F:CA:50:7 The MAC address of the source device
Address 1:44 sending the ARP request.
Type 16 bits 0x0806 This field indicates the protocol used in the
payload (ARP in this case).

Header fields of ARP Protocol Fields

Header field Length of Header field Meaning


Name Field (in bits) Value (Hex
Value)
Hardware Type 16 bits 0x0001 ARP uses Ethernet, so the hardware type is
0x0001
Protocol Type 16 bits 0x0800 The protocol is IPv4.
Hardware Size 8 bits 0x06 The size of the hardware address (MAC
address) is 6 bytes.

Page 10 of 16
Exercise-4: Input Sequence: ARP Reply

11111111111111111111111111111111111111111111111101001100000100011011111110011101
11110011100010110000100000000110000000000000000100001000000000000000011000000100
00000000000000100100110000010001101111111001110111110011100010111010110000010000
00001110011010110000000000000000000000000000000000000000000000001010110000010000
00001110011010110000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000

Header fields of Ethernet

Header Field Length of Header field Meaning


Name Field (in bits) Value (Hex
Value)
Destination 48 bits FF:FF:FF:FF:FF: Broadcast MAC address used for ARP reply.
MAC Address FF
Source MAC 48 bits E0:6F:CA:50:7 The MAC address of the source device
Address 1:44 responding to the ARP request.
Type 16 bits 0x0806 This field indicates the protocol used in the
payload (ARP).

Header fields of ARP Protocol Fields:

Header Field Length of Header field Meaning


Name Field (in bits) Value (Hex
Value)
Hardware Type 16 bits 0x0001 ARP uses Ethernet, so the hardware type is
0x0001
Protocol Type 16 bits 0x0800 The protocol is IPv4.
Hardware Size 8 bits 0x06 The size of the hardware address (MAC
address) is 6 bytes.

Page 11 of 16
Questions and answers:

1. What do you mean by TTL (Time to Live)?


Answer: TTL is a field in the IP header that specifies the maximum number of hops (routers) a packet
can pass through before being discarded. It prevents packets from circulating indefinitely in the
network.

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.

4. What is the full form of IP, TCP, UDP and ARP?


Answer: IP: Internet Protocol
TCP: Transmission Control Protocol
UDP: User Datagram Protocol
ARP: Address Resolution Protocol

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

4. Which one of the following statements is FALSE?


A) TCP guarantees a minimum communication rate
B) TCP ensures in-order delivery
C) TCP reacts to congestion by reducing sender window size
D) TCP employs retransmission to compensate for packet loss
Ans: A

5. In TCP, a unique sequence number is assigned to each


A) byte
B) word
C) segment
D) message
Ans: A

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.

Which of the following statements is/are correct?


A) Two fragments are created at R and the IP datagram size carrying the second fragment is
620 bytes.
B) If the second fragment is lost, R will resend the fragment with the IP identification value
0×1234.
C) If the second fragment is lost, P is required to resend the whole TCP segment.
D) TCP destination port can be determined by analysing only the second fragment.
Ans: A). Two fragments are created at R and the IP datagram size carrying the second fragment is
620 bytes.

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.

The fragmentation offset value stored in the third fragment is______________.


Ans: 144

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

You might also like