5.7k views

$\text{Host A}$ sends a $\text{UDP}$ datagram containing $8880\text{ bytes}$ of user data to $\text{host B}$ over an $\text{Ethernet LAN}.$ Ethernet frames may carry data up to $1500\text{ bytes (i.e. MTU = 1500 bytes)}.$ Size of $\text{UDP}$ header is $8\text{ bytes}$ and size of $\text{IP}$ header is $20\text{ bytes}.$ There is no option field in $\text{IP}$ header. How many total number of $\text{IP}$ fragments will be transmitted and what will be the contents of offset field in the last fragment?

1. $6$ and $925$
2. $6$ and $7400$
3. $7$ and $1110$
4. $7$ and $8880$
edited | 5.7k views
0
its already given UDP DATAGRAM is 8880 B which mean it is send to network layer without more addition of 8 B  then why u adding 8 and making DATAGRAM 8888?

simply if we forward 8880 and let it go for fragmentation

(A)
+4

in question its clearly written that 8880 bytes of user data so header will be added before user data.

I too skipped this word and wasted a lot of time...

0
in this for last fragment we will take 1472 from options

Number of fragments  $=\large\Big\lceil\frac{8888}{1480}\Big\rceil = 7$
Offset of last fragment $=\dfrac{(1500 - 20)\times 6} {8}=1110$
(scaling factor of $8$ is used in offset field).

$\text{TCP or UDP header}$ will be added to the DataUnit received from Transport Layer to Network Layer. And fragmentation happens at Network Layer. So no need to add $\text{TCP or UDP}$ header into each fragment.

edited
0
@ vikrant...it is 1109....not exactly in option...
0

number of fragments  = ceil(8888/1480) = 7

y & how????????????

+17
In each fragment we are sending 1480 bytes of data. Total data to be sent is 8888. So, number of fragments = ceil(8888/1480). Ceil is used because even if 1 byte is extra we need a full fragment.
0
can you please explain what is a scaling factor?
+6
Only first fragment contain UDP header else don't, right?

This makes sense too, as router don't need UDP header and at the destination, after reassembly at destination it's going to be one packet anyway.
To travel intermediate routers we don't need UDP header.
0
sir mera ek basic doubt hai.. plz make it clear.. sir sometimes we subtract header length sometimes not as actualy frame division we only need the actual data so why not we subtract 20 here... ??
0
In this question why are we not considering Ethernet header, it should be substracted from MTU right???
+3
We fragment the payload of IP packet and not the whole packet. So we will always subtract header length.
0
In the question, ethernet frame's max size is given 1500 B. So the framing should happen in data link layer of sender. Why we are doing that in network layer?

0
+9

Why are we adding 8 and making it 8888 ?

To answer this, ask yourself, what is inside a IP datagram ? Inside a IP datagram (or call it IP packet) we keep  a TCP segment. (or a UDP segment).

Now, a UDP (or TCP) has to be there with its header. Question clearly mentions that 8880 Bytes of user data is there and 8 Bytes of UDP header. So this makes up the UDP segment size as 8880+8 = 8888B

+3
@sachin mittal 1

UDP header is not added to the first fragment, instead, it is added to the datagram and then this entire package (of 8880 bytes data and 8 bytes header is passed to the network layer) as one unit of 8888 bytes. And at the network layer, this is fragmented and IP header is added to individual fragments. Am I right?
0
Why 6 is multiplied in second step instead of 7?

+1
Since there are 7 fragments hence till now we have sent 6 fragments and so to find out the fragment offset of the 7th fragment we find out the total data sent till now in 6 fragments and scale it by a factor of 8.
0
sir why are we dividing by 8?

Answer is : 7 fragments and last fragment offset is 1110

edited
0
during my classes we were taught that we cannot take 0- 1479 because 1480 is not divisible by 8 ..so we have to take number which is less than 1480 nd divisible by 8 i.e 1476?? solve this query please??
+1
@vamp_vaibhav

1480 is divisible by 8 :) 185*8
0
hmm i realized my mistake earlier ..forgot to mention :)
1500 is MTU . And header length of ip is 20 . So net data can go is 1500-20 =1480 . and no. of fragment needed  (8880+8)/1472 = 6.something so 7 . and offset 6*1480/8= 1110 .
edited
0
all have different explanation then wch one shd correct m getting u even correct but some one mark a option
+1

To me i am correct and none of the options are matching for offset (1104)  . It is closed to 1110 .

And the guy who mark option A ( @sameer ) actually did what i did . But he has made a mistake while computing -

Fragment 5,  2292 - 1472 = 820,  Offset = (1472 * 4) / 8 = 736 it should be

Fragment 5,  2992 - 1472 = 1520,  Offset = (1472 * 4) / 8 = 736  .peace

+2
Transport is at a higher level than network. There won't be multiple UDP headers for the same UDP datagram.
0
I miss that again .  Yeah you are right .
0
ok.. thx..
0
0
0
y r u dividing by 1472 ?? not by 1480 ?? anyone ??
UDP data = 8880 bytes

Total Size excluding IP Header = 8888 bytes.

Number of fragments  = ⌈ 8888 / 1480 ⌉
= 7
Offset of last segment = (1480 * 6) / 8 = 1110 
0
@ Paras Nath  excluding IP Header or Udp header ??????
A.   6 and 925

Fragment 1,  8880 - 1472 = 7408,  Offset = (1472 * 0) / 8 = 0

Fragment 2,  7408 - 1472 = 5936,  Offset = (1472 * 1) / 8 = 184

Fragment 3,  5936 - 1472 = 4464,  Offset = (1472 * 2) / 8 = 368

Fragment 4,  4464 - 1472 = 2992,  Offset = (1472 * 3) / 8 = 552

Fragment 5,  2292 - 1472 = 820,  Offset = (1472 * 4) / 8 = 736

Fragment 6,  820,  Offset = (1472 * 5) / 8 = 920
edited
+5
+3
@Arjun

Yes, correct.

TCP or UDP header will be added to the DataUnit received from Transport Layer to Network Layer.

And fragmentation happens at Network Layer. So no need to add TCP or UDP header into each fragment.

Thanks.
0
fragment shd 7 if ceil then y 6 plz say
0
how will think we have to include data size in data size itself. i mean in this question we are considering data as 1480+20 why not 1500+20, in some question we include header explicitly. In this question how do we know header is included implicitly , i am very much confused please help me in this
0
@Soumya

Most of the time MTU size is given which is 1500 which includes (data+header) . IP header is given to 20 bytes so (total - header) is data . This is always true .
Caption

The concept that you should be clear with before or after attempting this question is how UDP datagram is handled during fragmentation at IP layer

You can read whole thing here https://notes.shichao.io/tcpv1/ch10

Or remember following

The UDP header that contains the source and destination port numbers appears only in the first fragment (a complicating factor for firewalls and NATs). Fragmentation is controlled by the IdentificationFragment Offset, and More Fragments (MF) fields in the IPv4 header.

Rest calculation is easy

Total size of IP payload =ceil( 8888 /1480)=7

Fragmentation offset is (1480*6)/8=1180

1
2