Fragmented ip protocol wireshark что это

Обновлено: 05.07.2024

Whwn we create a SIP call INVITE do not appears in Wireshark trace. When we filter the trace as SIP the flow starts with "100 Trying". When i search full trace the psition that belongs to INVITE is covered with "Fragmented IP Protocol". It seems like wireshark can not produce the INVITE Message normally.

Is there ant option to have INVITE message with correct format with Wireshark?

Thanks Best Regards

asked 29 Nov '11, 03:45

m_ayazici
1 ● 1 ● 1 ● 1
accept rate: 0%

Disable the option "Reassemble fragmented IPv4 datagrams" in wireshark. Edit -> Preferences -> Protocols -> IPv4.

Once this is done, you will see the pcap correctly.

answered 23 Apr '14, 00:43

dpombo
26 ● 2
accept rate: 0%

No idea if this helps, but you could try to toggle the "Reassemble fragmented IPv4 datagrams" in the IPv4 protocol preferences setting. Sometimes the Reassembly setting fools around with the decoding, so it might help to try to change it.

answered 29 Nov '11, 12:09

Jasper ♦♦
23.8k ● 5 ● 51 ● 284
accept rate: 18%

"Reassemble fragmented IPv4 datagrams" was selected in the configuration of wireshark as default. I deselect it and tried again but it still seems as "Fragmented IP Protocol"

I tried it in SIP protocol also but it didn't effect also.

Thanks a lot for your help

The traffic probably is fragmented, and there's something preventing the IPv4 dissector from reassembling the fragments. such as packets having been cut short by a snapshot length when capturing or IP checksum offloading causing outgoing packets to appear to have bad checksums.

There's nothing that can be done about the first of those, other than "don't capture with a snapshot length". For the second of those, if the "Fragmented IP Protocol" packets have a bad IP header checksum, turn off the "Validate the IPv4 checksum if possible" preference for IP.

(And if you've turned off "Reassemble fragmented IPv4 datagrams", turn it back on! If it's off, Wireshark won't even try to reassemble fragmented IPv4 datagrams.)

Фрагментация

Рассмотрим, как работает фрагментация на том же самом примере, большого пакета размером 4000 байт, который нужно передать через сеть Ethernet MTU 1500 байт.

p, blockquote 12,0,0,0,0 -->

Фрагментация пример

p, blockquote 13,0,0,0,0 -->

Формируется первый фрагмент, здесь показаны поля IP заголовка, которые имеют отношение к фрагментации.

p, blockquote 14,1,0,0,0 -->

Формируется первый фрагмент

p, blockquote 15,0,0,0,0 -->

Маршрутизатор сгенерировал номер пакета 81, номер может быть любой, главное чтобы этот номер был одинаковым во всех фрагментов. Смещение фрагмента равно нулю это означает, что во фрагменте находится самое начало большого пакета. Устанавливается поле More Fragments, и затем записывается первая порция данных 1480 байт.

p, blockquote 16,0,0,0,0 -->

После этого формируется второй фрагмент с тем же самым номером пакета, значение смещения фрагмента равно 185, 1480 разделенное на 8, и поле More Fragments говорит о том, что будут ещё фрагменты.

p, blockquote 17,0,0,0,0 -->

Второй фрагмент в протоколе IP

p, blockquote 18,0,0,0,0 -->

Формируется третий пакет с тем же самым номером пакетов 81, смещением 370 и так как это последний фрагмент, то поле More Fragments устанавливается в 0.

p, blockquote 19,0,0,0,0 -->

Третий фрагмент в протоколе ip

p, blockquote 20,0,0,0,0 -->

10 thoughts on “Fragmented IP packet forwarding”

Thanks for that!

I am not psychic:) but happy to hear that it helped. Thanks for the feedback.

How can we sent a fragmented ICMP packet ?

I used the following code to send out-of-order fragments to my destination.

I am able to achieve what I want with this (send fragment 2 at the last). However, on the linux interface, the proto is not being detected as ICMP. On Wireshark, proto field is like below:

Protocol: IPv6 Hop-by-Hop Option (0)

What could be the issue?

Hi Sandeep, I had the same problem and opened an issue on the scapy github issue tracker. It seems the issue resolved in the dev version.

hope this helps,

Thanks a lot! This is really helped me with understanding how reassembly really works.
Especially the note about that Wireshark default setting (which is really mess).

Фрагментация и Сборка IP пакетов в Компьютерных Сетях

Напомню, что протокол IP работает на сетевом уровне модель взаимодействия открытых систем, и одна из задач этого уровня объединения сетей построенных на основе разных технологий.

p, blockquote 1,0,0,0,0 -->

Фрагментация ip пакетов

p, blockquote 2,0,0,0,0 -->

Одно из возможных различий в сетях, это максимальный размер передаваемых данных или Maximum Tranmission Unit, MTU. Для Ethernet это 1 500 байт, для Token Ring 4 464 байта, для FDDI 4 352 байта, а также раньше встречались сети и с другим размером в MTU. Что делать, если на маршрутизатор пришел пакет, размер которого больше, чем может передать сеть?

p, blockquote 3,0,0,0,0 -->

В этом случае используется фрагментация, разделение пакета на отдельные части, так называемые фрагменты, каждый из которых меньше чем MTU сети.

Заключение

p, blockquote 26,0,0,0,0 -->

В заголовке Ip пакета для фрагментации используются три поля: идентификатор пакета, флаги и смещение фрагмента. Следует отметить, что в следующей версии протокола ipv6 отказались от фрагментации на маршрутизаторах, в IPv6 узлы отправителей должны сами подобрать максимальный размер пакета с помощью технологии Path MTU Discovery.

Сборка пакета

Сборка пакета происходит в обратном порядке, принимающий маршрутизатор должен определить, что он получил не полный пакет, а фрагмент. Для этого маршрутизатор используют либо поле More Fragments, если поле установлено в единицу, значит это фрагмент. Другим признакам фрагментации является ненулевое значение в поле смещения фрагмента, например, 185 или 370.

p, blockquote 21,0,0,1,0 -->

Сборка пакета происходит в обратном порядке

p, blockquote 22,0,0,0,0 -->

Когда маршрутизатор принимает фрагмент пакета, он сохраняют его в память, и затем сохраняет все фрагменты с тем же самым номером, в нашем случае 81. После того как пришел последний фрагмент, маршрутизатор может посчитать размер большого пакета 4000 байт, затем из отдельных фрагментов используя смещение собираются большой пакет.

p, blockquote 23,0,0,0,0 -->

Сборка пакета в протоколе IP

p, blockquote 24,0,0,0,0 -->

Fragmented IP packet forwarding

Scapy is a fantastic tool to generate your own packets. It is exremely flexible and in our example, we will perform the fragmentation of a packet via our script.

Once you install scapy, you create the following lovely script.

Let me explain each line what happens here.

1st Packet

2nd packet

3rd packet

So far we have found the answers to first two questions. Now we need to see how our stateful firewall forwards these packets. I am running tcpdump on hostE destination device this time.

We can see that we have received 2 fragmented packets first of which has the UDP header.

You can see reassembly being done if you enable flow traceoptions as the firewall forwards fragmented packets as is to the destination host.

I have tried to give a bit of information about fragmentation and its relation to transport layer protocol UDP. I hope this was helpful!

Related

About: rtoodtoo

Флаг DF

p, blockquote 25,0,0,0,0 -->

IP_Reassembly

IP Reassembly is a feature in Wireshark and TShark to automatically reassemble all fragmented IP Datagrams into a full IP packet before calling the higher layer dissector.

This feature will require a lot of extra memory to be consumed by wireshark in order to store the reassembly buffers and is disabled by default.

ipreassembly.jpg

To enable IP Reassembly, go to preferences and tick the box for reassembly

When you enable IP Reassembly several things in TShark and Wireshark change. First of all, Wireshark will no longer dissect the UDP or TCP header (or any protocol above these) in the frame that contained the header of the IP packet any more. Instead, the calling of the UDP or TCP protocol dissectors will be deferred until all IP fragments have been received and the full IP datagram has been fully reassembled.

This difference shows up as that without IP Reassembly the upper layer protocol, UDP or TCP and whatever sits above it, as much as was present in this frame of the initial fragment (where fragment offset is 0) will be dissected and displayed for that particular frame. This frame will also usually have an information text in the packet summary line along the lines of "[Short Frame]". All the other IP Fragments for this IP datagram will be dissected only up to and including the IP layer.

When this feature is enabled, dissection of the IP datagram will be deferred until that packet in the capture where the full IP datagram was completely reassembled.

This means that some packets that are using reassembly, such as NFSoverUDP, will dissect differently, and even in different frames when IP Reassembly is enabled.

IP Reassembly is an all-or-nothing feature. If not every single IP Fragment required to complete the reassembly can be found in the capture, then nothing at all will be dissected. Not even the TCP or UDP layer.

Beware

This feature WILL consume a lot of additional memory at runtime if there are IP Fragments present in the trace. It is a very very bad idea to enable this feature for huge NFSoverUDP traces since that will eat memory like there is no tomorrow.

Display

ipreassembly.jpg

To enable IP Reassembly tick this preference setting

Preference String

Reassemble fragmented IP datagrams.

Формат заголовок IP-пакета

В протоколе IP для реализации фрагментации используются три поля заголовка. Идентификатор пакета, флаги и смещение фрагмента.

p, blockquote 5,0,0,0,0 -->

Формат заголовка IP адреса

p, blockquote 6,0,0,0,0 -->

Пакет

Идентификатор пакета задает номер пакета, который разбит на фрагменты, это поле должно быть одинаковое во всех фрагментах пакета.

p, blockquote 7,0,1,0,0 -->

Флаги

p, blockquote 8,0,0,0,0 -->

Смещение фрагмента

p, blockquote 9,0,0,0,0 -->

p, blockquote 10,0,0,0,0 -->

Давайте рассмотрим пример, чтобы лучше понять.

  • У нас есть большой пакет размером 4 тысячи байт, в этом пакете 20 байт, это заголовок IP, а полезных данных 3980 байт.
  • Мы хотим передать полученные пакет по сети Ethernet, у который максимальный размер передаваемых данных 1 500 байт. Опять же с 1500 байт, 20 байт отдается под заголовок IP, и 1480 байт под полезные данные.
  • Таким образом, исходные данные размером 3 980 байт, будут разделены на три фрагмента, от 0 до 4179 байт, от 1480 до 2959, от 2960 до 3890.
  • Для того чтобы получить смещение каждого фрагмента, мы должны взять значение первого байта (это 0, 1480 и 2960), и разделить на 8, таким образом смещение получается 0 для первого фрагмента, 185 для второго фрагмента, и 370 для третьего фрагмента.

Читайте также: