# Solve Number of Bytes to be Transferred Not Being in Multiples of Eight in IPv4

• MHB
• shivajikobardan
In summary: For example, in your case, if the total length of the first packet was 555 instead of 556, the data transmitted would be reduced to 555 - 20 = 535 bytes. This way, the total length is divisible by 8.You also asked if the "only data" part should be divisible by 8. In this case, the total length of the packet can be increased by adding padding bits to the data so that the "only data" part is divisible by 8. For example, if the total length of the first packet was 557 instead of 556, then 557 - 20 = 537 bytes would be the "only data" part. We can add 1 byte of padding to make
shivajikobardan
Theory that I am trying to understand-:

So i found a question that is relevant to this-:
->a total of 1440 bytes that is routed through an interface with MTU of 576 bytes. Calculate flag, fragmented offset, total length and data transmitted in each packet after fragmentation. Assume IP header to be 20 bytes.

Solution-:

1440=20+1420

MTU is 576.
Number of fragments=1420/576=3

So let’s call 3 packets P1,P2,P3.

P1=>20+556
P2=>20+556
P3=>20+308

So I am trying to understand what the above picture is trying to say.

There are 2 cases-:
-> Is it trying to say that total length of P1 should be divisible by 8?

-> Is it trying to say that “only data” part should be divisible by 8?

I have even further questions about it.

->Say, the total length of P1 should be divisible by 8. What will we do if it is not?

->(I believe) Say the “only data” part should be divisible by 8, then what should we do as neither 556 nor 308 is divided by 8.

So say I reiterate and do this arrangement(I believe this is correct way)-:
P1->20+552
P2>20+552
P3->20+316

Still 316 isn’t divisible by 8, what should I do now?

i don't understand the solution that is written in the picture that i attested above. how can we use that solution to our case?

IRRESPECTIVE OF WHATEVER I WROTE,if you want,YOU CAN EXPLAIN LIKE I AM BEGINNER TO ALL THESE

THINGS.The picture you attached is showing the format of an IP packet header. It has a total of 20 bytes of header information. This includes fields like source, destination, protocol and flags. The Flag field is used to indicate whether the packet is fragmented or not (1 indicates fragmented and 0 indicates not fragmented). The Fragmented Offset field indicates the offset of the fragment from the start of the original packet. The Total Length field indicates how many bytes the packet contains.In your case, you have a total of 1440 bytes that is routed through an interface with MTU of 576 bytes. This means that the packet needs to be divided into 3 fragments in order to be sent. The first fragment will have a total length of 576 (20 bytes of header + 556 bytes of data). The flag will be set to 1 indicating that it is a fragmented packet. The offset will be 0. The second fragment will also have a total length of 576 (20 bytes of header + 556 bytes of data). The flag will still be set to 1 indicating that it is a fragmented packet. The offset will be 576. The third fragment will have a total length of 288 (20 bytes of header + 308 bytes of data). The flag will still be set to 1 indicating that it is a fragmented packet. The offset will be 1152. So all the packets need to have a total length that is divisible by 8. If the total length of any packet is not divisible by 8, the data part of the packet can be reduced so that the total length is divisible by 8.

## 1. What is the significance of bytes not being in multiples of eight in IPv4?

The number of bytes being transferred in IPv4 is important because it determines the size of the data packet being sent over a network. When the number of bytes is not a multiple of eight, it can result in inefficient use of network resources and slower data transfer speeds.

## 2. How does this issue affect data transfer?

When the number of bytes is not a multiple of eight, it can lead to an increase in the number of data packets being sent, which can result in slower data transfer speeds. This is because the network has to process more packets, leading to potential congestion and delays.

## 3. What is the solution for this issue?

The solution for this issue is to use padding, which involves adding extra bits to the data packet so that the total number of bytes becomes a multiple of eight. This ensures that the data is transferred efficiently and without any delays or congestion.

## 4. Can this issue be avoided altogether?

Yes, this issue can be avoided by using protocols such as TCP/IP, which automatically adds padding to data packets to ensure that the number of bytes is a multiple of eight. Additionally, using larger data packets can also help avoid this issue.

## 5. How does IPv6 address this issue?

IPv6 uses a fixed packet size of 40 bytes, which is a multiple of eight. This ensures that the issue of bytes not being in multiples of eight is avoided altogether. Additionally, IPv6 also has a larger address space, which allows for larger data packets to be transferred without the need for padding.

Replies
3
Views
1K
Replies
1
Views
2K
Replies
1
Views
2K
Replies
8
Views
2K
Replies
2
Views
2K
Replies
177
Views
29K
Replies
9
Views
3K
Replies
5
Views
3K
Replies
8
Views
2K
Replies
2
Views
7K