ICMPv6 Checksum calculation

Even
Nov 6, 2020

根據IPv6 (RFC 4443 Section2.3) 和 ICMPv6 (RFC2460 Section8.1)

我們需要將上述做相加並取1’s 補數

以下用wireshark packet 來做相加的解說

IPv6 Packet with hex

  1. Source Address = ::
  2. Destionation = ff02::1
  3. Next Header = 58 (ICMPv6)

58 to hex is 0x3a

— — — — — — — —

ICMPv6 total length is 24

24 to hex is 0x18

  1. Upper-Layer Packet Length = 0x18

2. ICMP Data (checksum is 0)

Data = 8200 + 03e8 (7ac1忽略)

接下來就算ICMPv6 checksum

  1. Source Address = ::
  2. Destionation = ff02::1
  3. Next Header = 0x3a
  4. Upper-Layer Packet Length = 0x18
  5. ICMPv6 Data = 8200 +03e8

sum = ff02 + 0001 + 0x3a + 0x18 +8200 + 03e8

sum = 0x1853D , 1進位補上

sum = 0x853E, 取1's補數

checksum = 0x7ac1 (跟ICMPv6 封包的checksum 一致)

— — — — — — — — — — — — — — — — — — — — — — — — — — — —

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

No responses yet

Write a response