# Lesson 4 The IPv4&v6 Header.

## Presentation on theme: "Lesson 4 The IPv4&v6 Header."— Presentation transcript:

IPv6 extension headers IPv6 MTU Upper layer checksums

IPv6 vs. IPv4 Packet Data Unit

Version Internet Header Length Type of Service Total Length Identification Flags Fragment Offset Time to Live Protocol Header Checksum Source Address Destination Address Options (5 to 15~ 5*4 to 15*4) (three bits Precedence + TOS bits) (~65536 bytes) (1, ICMP, 2, IGMP, 6,TCP, 17 UDP, 89, OSPF) . . .

Checksum: data integrity check:
The packet is divided into k sections, each of n bits. (n=16) All sections are added together using one’s complement arithmetic. The final result is complemented to make the checksum. Question: Compare with parity check which is better?

IP Packet Example with checksum
For Example; (For the following IP header without option) 4 5 1 28 17

Fragmentation in IPv4 protocol MTU Hyperchannel 65,535
IP datagram Header MTU in a frame Trailer protocol MTU Hyperchannel 65,535 Token ring (16Mbps) 17,914 Token ring (4Mbps) 4,464 FDDI 4,352 Ethernet 1,500 X.25 576 PPP 296 Fields related to fragmentation (router to host) Identification: source host mark this fields Flags: three bits, xDM, D stands for don’t fragment (1), M stands for more fragments, 0 means the last or only fragment. fragmentation offset: 13-bit shows the relative position of this frament.

Fragmentation example
Offset = 0000/8 =0 Byte 0000 Byte 1399 Offset = 0000/8 =0 Offset = 1400/8 =175 Byte 0000 Byte 3999 Byte 1400 Byte 2799 Offset = 2800/8 =350 Assume: MTU equals 1400 bytes The value of offset is measured in units of eight bytes Byte 2800 Byte 3999

Detailed fragment example (without considering options and upper layer header)
14567 1420 000 1 14567 820 175 1 14567 4020 000 Fragment 1 14567 1420 175 1 Fragment 2.1 14567 620 275 1 Byte 0000~3,999 Fragment 2 14567 1220 350 Original datagram Fragment 2.2 Fragment 3

Option format Code 8 bits Length 8 bits Data Variable length Number End of Option (one byte) No operation (one byte) Loose source route (multiple bytes) Timestamp (multiple bytes) Record route (multiple bytes) Strict source route (multiple bytes) Copy 1 bit Class 2 bits Number 5 bits Copy (when fragmented) 0 Copy only in first fragment 1 Copy into all fragments Class 00 Datagram control 01 Reserved 10 Debugging and management 11 Reserved Length: defines the total length of the option including the code field and itself. (not all present)

Padding options No Operation: End of option:
a one-byte option used as a filler between options; coded as End of option: a one-byte option used for padding at the end of the option field. It can only be used as the last option. coded as if more than one byte is needed to align the option field, some no operations must be used followed by an end of option.

Record route concept (code(1 byte)+length(1 byte)+pointer(1 byte)+data field) Code: 7 Length (Total length) Pointer First IP address (Empty when started) Second IP address (Empty when started) Last IP address (Empty when started)

Strict source route concept
Code: 137 Length (Total length) Pointer First IP address (filled when started) Second IP address (filled when started) Last IP address (filled when started)

Time Stamp Concept First IP address (filled when started) Timestamp 1
O-Flow: Add the number of routers that could not add their timestamp due to no more fields available. Code: 137 Length (Total length) O-Flow 4 bits Pointer Flags 4 bits First IP address (filled when started) Timestamp 1 Flags: 0: add for each router the timestamp 1: add the timestamp and the outgoing IP address 3: the IP address is given, each router check IP address, if match, the same operation as in flag 1. Last IP address (filled when started) Timestamp last

Practice Quiz For an the following IP header plus Record route option : Problem 1: What is the value of header length? Problem 2; What is the value of check sum? 4 ? 28 1 4 17 ? Code: 7 15 4 First IP address (Empty when started) Second IP address (Empty when started) Last IP address (Empty when started)

In IPv4, router perform the following:
Checksum Verification [may skip it] Verify the version Decrement the value of TTL field. If it is less than 1, send an ICMPv4 Time Exceeded-Time to Live to source packet, if not, place the new value in the TTL field, Check for the presence of IPv4 header option, Determine a forwarding interface and a next-hop IPv4 address: Use the value of the destination address field and the contents of the local routing table to, MTU check: If MTU is less than the value of total length, perform IPv4 fragmentation. Recalculate the new header checksum,

Destination Address Source Address Ver Flow Label Payload Length Next Header Hop Limit Traffic Class IPv6 Packet Header Ver: 4 bits (0110 for IPv6, 0100 for IPv4), Traffic Class: 8 bits with Service type in IPv4 Structure Flow Label: 20 bits with Label ID to attend the Qos Service Payload length: 16 bits length number exclude the 40 byte header. Next Header: 8 bits Hop Limit: 8 bits

Values of the Next Header Field

Comparing the IPv4 and IPv6 Headers
IPv4 Header Field Change in IPv6 Version New value of 6 Internet Header Length Removed Type of Service Traffic Class field Total Length Payload Length field Identification Removed to Fragment header Fragmentation Flags Fragment Offset Time to Live Hop Limit field Protocol Next Header field Header Checksum Source Address Same, new 128-bit length Destination Address Options Removed (extension headers) 增加 Flow Label 20 bits

In IPv6, router perform the following:
Verify the value of Version field Decrement the value of Hop Limit Field, if …send ICMPv6…, if not, place the new value Check the next Header field for a value of 0, if 0, process the Hop-by-Hop Options header Use the value of Dest. Address and the contents of routing table to determine a forwarding, If the link MTU of the forwarding is less than 40+payload, send an ICMPv6 TOO Big Forwarding

The Chain of Pointers Formed by the Next Header field

The same as Record route, strict source, and loose source routing option in IPv4 Next Header Header Extension Length Routing Type Segments Left Routing type-specific data . . . Routing header: specify a source route which is a list of intermediate dest. For the packet to travel to on its path to the final dest.

Structure of the Routing Type 0 Header
Next Header Header Extension Length Routing Type Segments Left Reserved Address 1 Address N . . . = 0 (loose source routing) First IP address (filled when started) Second IP address (filled when started) Last IP address (filled when started) Code: 131 Length (Total length) Pointer

When the IPv6 packet reaches an intermediate destination, the routing header is processed and:
The current destination address and the address in the (N-Segments Left +1) position in the list of addresses are swapped The Segments Left field is decremented The packet is forwarded

Quiz(4_1)-loose source routing Example
G4_1: Fill out the loose source with three intermediate destination address: 2001::C001, 2001::C010, 2001::C122 Next Header Header Extension Length Routing Type Segments Left Reserved Address 1 Address N . . . = 0 (loose source routing)

Example Monitor Capture Ipv6: Routing ; Proto =ICMPv6: Len =40
Version =6, Traffic class =0, Flow Label=0, Payload Length=64, Next Header =43,…., Source address: fec0::2:2b0:d0ff:fee9:4143. Destination address: Fec2::2:260:97ff:fe02:6e8f IPv6: Routing Header IPv6:Next Header =58 (ICMPv6) IPv6: Length =2, IPv6: Type =0 IPv6: Segments Left =1 IPv6 : Reserved IPv6: Route IPv6: address = fec0::1:260:8ff:fe52:f9d8 IPv6: Payload: number of remaining =40

Next Header Reserved Fragment Offset More Fragments Flag Identification Used for IPv6 fragmentation and reassembly services

IPv6 Fragmentation Process
Original IPv6 Packet Unfragmentable part Fragmentable part Unfragmentable part Fragment header First fragment Unfragmentable part Fragment header Second fragment Unfragmentable part Fragment header Third fragment

IPv6 Reassembly Process
Unfragmentable part Fragment header Fragmentable part Unfragmentable part Fragment header Fragmentable part Unfragmentable part Fragment header Fragmentable part Unfragmentable part Fragmentable part Original IPv6 Packet

Q4-2: For a TCP segment of 4000 bytes, find the fragment header of IPv6 with MTU=1280 bytes

Structure of the Hop-by-Hop Options Header
Next Header Header Extension Length Options . . . Header Extension Length describes the number of 8-byte blocks, not including the first 8 bytes. E.g., for an 8-byte Hop-by-Hop, the value is 0, padding options are used.

Structure of an Option Option Type Option Length Option data . . .
An option is a set of fields that either describes a specific characteristic of the packet delivery or provides padding. Options are sent in Hop-by-Hop and Destination Options headers. Each option is encoded in the type-length-value (TLV) format. Option type Field: option type field both identifies the option and determines the way it is handled. Two high-order bits indicate how the option is handled by the node, 00 skip the option, 01 silently Discard the packet, 10 discard the packet and send an ICMPv6 .., 11 discard the packet and send an ICMPv6 .for not a multicast address. Third high-order bit indicates the option data can (1) or can not be changed (0) in the path to the destination.

Option Type = 0 Option type Field: [Two high-order bits indicate how the option is handled by the node, 00 skip the option, 01 silently Discard the packet, 10 discard the packet and send an ICMPv6 .., 11 discard the packet and send an ICMPv6 .for not a multicast address. Third high-order bit indicates the option data can (1) or can not be changed (0) in the path to the destination.] Option type of 0: mean skipped if not recognized, not be changed,

Option Type Option Length Option data = 1 . . . Option type Field: [Two high-order bits indicate how the option is handled by the node, 00 skip the option, 01 silently Discard the packet, 10 discard the packet and send an ICMPv6 .., 11 discard the packet and send an ICMPv6 .for not a multicast address. Third high-order bit indicates the option data can (1) or can not be changed (0) in the path to the destination.] Option type of 1: mean skipped if not recognized, not be changed,

Structure of the Jumbo Payload Option
Option Type Option Length Jumbo Payload Length = 194 = 4 Option type Field: The size in the IPv6 header is invalid, instead the jumbo payload length is used. Option type of 194 ( ): indicates an ICMPv6 parameter problem if the option is not recognized and the destination address is not a multicast address.

Quiz (5_1) Quiz (5_1): fill the hop-by-hop extension header with Jumbo Payload Option (value of bytes). Fill out all the fields and draw block diagram i.e., structure between IPv6 header, extension header, and the Data.

Structure of the Router Alert Option
Option Type Option Length Router Alert Value = 5 = 2 = 0 This option Indicates to a router that the contents of the packet require additional processing . Router Alert Option is used for Multicast Listener Discovery (MLD) and the Resource ReSerVation Protocol (RSVP).

Monitor Capture (5_2) Ipv6: Version =6, Traffic class =0, Flow Label=0, Payload Length=32, Next Header =0,…. IPv6: Hop-by-Hop Options Header IPv6:Next Header =58 (ICMPv6) IPv6: Length =0, IPv6:Router Alert Option IPv6: Type =5 IPv6: Length =2 IPv6 Router Alert Value=0 IPv6: padding (2 bytes) IPv6: Type=1 (PadN) IPv6: length =0 IPv6: Palyload: number of remaining =24

Quiz (5_2) Quiz (5_2): fill the values in the network capture in 5_2 into the relative fields in the hop-by-hop option. and draw the values and relation within the IPv6 header, extension header, and the Data.

Structure of the Destination Options Header
Next Header Header Extension Length Options . . . Dest. Options Header specify delivery parameters for either intermediate dest. or The final dest. If a routing header is present, it specifies delivery or processing options at each Intermediate destination. If no routing header is present, it specifies delivery or processing options at the final destination. Dest. Options Header used to supports Mobility in IPV6

Structure of the Binding Update Option
Option Type Option Length Flags Reserved Prefix Length Sequence Number Lifetime Sub-Options = 198 Used by the mobile IPv6 node to update another node with its new care-of-address . . .

Structure of the Binding Acknowledgement Option
Option Type Option Length Status Sequence Number Lifetime Refresh Sub-Options = 7 . . . Used of acknowledge the receipt of a binding update

Structure of the Binding Request Option
Option Type Option Length Sub-Options = 8 . . . Used to request the binding from a mobile node.

Structure of the Home Address Option
Option Type Option Length Home Address Sub-Options = 201 . . . Used to indicate the home address of the mobile node.

Next Header Payload Length Reserved Security Parameters Index Sequence Number Authentication Data . . .

Structure of the ESP Header and Trailer
Security Parameters Index Sequence Number Payload Data Padding Padding Length Next Header Authentication Data . . . . . . . . .

IPv6 MTU Link layer must support a 1280-byte MTU
Otherwise, link layer must use a transparent fragmentation and reassembly scheme For configurable MTU link layers, MTU size of at least 1500 bytes Example: Maximum Receive Unit (MRU) of a Point- to-Point Protocol (PPP) link Path MTU Discovery process uses the ICMPv6 Packet Too Big message

Internet 封裝 網際層訊框包裝(Ethernet II) Internet 封裝：網際層封包與 Ethernet 訊框包裝
Type 0800 ：IP v4 封包 Type 86DD: IP v6封包 Type 0806：ARP 封包 Type 0835：RARP 封包

Internet 封裝 網際層訊框包裝( IP in in 802.2+802.3 LLC/SNAP)

Ethernet II (DIX)Frame
Preamble SFD Destination address Source Type Data CRC Preamble: 56 bits of alternating 0s and 1s that alert the receiving system to the coming frame. SFD: one-byte field( ) is used as a flag. Destination address: Source address: Data: 46 bytes to 1500 bytes CRC: CRC-32