in Computer Networks edited by
29,580 views
48 votes
48 votes

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:

  1. Last fragment, $2400$ and $2789$
  2. First fragment, $2400$ and $2759$
  3. Last fragment, $2400$ and $2759$
  4. Middle fragment, $300$ and $689$
in Computer Networks edited by
by
29.6k views

4 Comments

@Arjun how are we assuming that the last fragment is full ??

0
0

@YOGESH11 bro we are considering fragments and every fragment has an IP header so in the header of a fragment M is 0 and total length field is 400 which means that last fragment contains 400-40 i.e 360 bytes of data. 

0
0
why we did fragment offset * 8 ?
0
0

7 Answers

85 votes
85 votes
Best answer

$M=0$ meaning no more fragments after this. Hence, its the last fragment.

IHL = internet header length = $10 \times 4 = 40B$ coz $4$ is the scaling factor for this field.
Total Length = $400B$
Payload size = Total length - Header length = $400 - 40 = 360B$

fragment offset = $300 \times 8 = 2400B$ = represents how many Bytes are before this. $8$ is the scaling factor here.
$\therefore$ the first byte  = $2400$

Last byte = first byte  + total bytes in payload - 1 = $2400 + 360 - 1 = 2759$

Option C is correct.

edited by

4 Comments

I have the same doubt as @HiteshRishi

Offset given is 300 which means (300*8=2400)2400 bytes are ahead of that packet, and in one packet we can store 360 bytes after removing header of 40 bytes as total length is 400 bytes but 2400 is not multiple of 360 so how can we divide packets?

 

0
0
edited by
@Abhilash Behera I think, it is not necesaary to divide since it is last fragment. Suppose total payload data is of  2760 bytes .Rest of packet size can be 400*6=2400. and remaining 2760-2400=360 bytes for this last fragment. Correct me if wrong.
0
0

@Arjun how are we assuming that the last fragment is full ??

0
0
28 votes
28 votes
payload =total length-header

             =400-40

              =360

M bit is 0 so it is last fragment

offset is 300

so packet's first bit  300*8=2400

last bit =2400+359=2759

so ans is c

4 Comments

You have assumed that sequence number has started from 0 for 1st Byte of first fragment but as for as I know sequence number is allotted randomly. So, we can only be sure that difference between sequence number for first Byte and last Byte must be 359. We can't surely tell that it must start with 2400.
Please, do reply me if I get it wrong.
5
5
@arjun sir @pooja could you please tell me why payload is taking initial bits instead of header. Header should take first 40 bytes here then the payload. Are we assuming according to the options given?
0
0
edited by

I think range of sequence number must cover 360 byte. For the last fragmented packet offset range would be 300 - 344 ]. So offset field contains number = 300. Only option C satisfies both the conditions of last fragment (MF = 0) and total 360 Byte (400-10*4 byte).i.e. possible sequence number can be [ 2400 - 2759 ] . That's why option C. I don't think initial sequence number assumption (as zero) is valid always. correct if wrong !

What if option C is given as = Last fragment,5000 and 5359. is it correct too ?

0
0
anyone please help .

how can we assume that the last fragment is full ??
0
0
26 votes
26 votes

there is a similar problem has been given in "Forouzan book" 

http://erdos.csie.ncnu.edu.tw/~ccyang/TCPIP/TCPIPSlide.html

2 Comments

why we multipluy by 8??
0
0
For Fragment Offset we divide the first fragment by 8. For getting the first fragment, we multiply the Offset by 8.
0
0
8 votes
8 votes
Since M=0; It is indication of last fragment.

Data length=Total Length-header length

Data length=400-10*4=360

Fragments offset=300

Number of data byte ahead from this fragments is=300*8=2400

Last byte of last frame is=2400+360=2760

Last byte=2759(Because we starting our counting from 0---5---59)

4 Comments

I think 10 means number of 4 bytes i.e 32-bit rows in the header is equal to 10

hence we are getting 10 * 4 = 40byte?
2
2
yes,correct
0
0
A very layman answer to your question is see if you have been given anything in the range of [5,15] think it to be the HLEN needed to be multiplied by our scaling factor 4 since the range of header length is [20,60]. Anything given above 20, consider it has already been converted using the scaling factor
0
0
Answer:

Related questions