Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lesson 4 IPv4&v6, The IP Packets their Headers.

Similar presentations


Presentation on theme: "Lesson 4 IPv4&v6, The IP Packets their Headers."— Presentation transcript:

1 Lesson 4 IPv4&v6, The IP Packets their Headers

2 Lesson Objectives Structure of an IPv6 packet IPv4 header IPv6 header
IPv6 extension headers IPv6 MTU Upper layer checksums

3 IPv4與IPv6 封包結構

4 IPv6 vs. IPv4 Packet structure (IP封包結構)
maximum 65535 octets minimum 20 octets Upto 40 octets payload Option Header Transport-level PDU IPv4 Header Data Field IHL (Header length) payload Maximum 65535 octets 這是 IPv4 和 IPv6 PDU 之比較圖示, IPv4 和 IPv6 PDU之最大長度皆為 octets, 其中 IPv4 packet header 之長度最少為 20 octets, 而 IPv6 packet header 則固定為 40 octets, 但其後接有 0 個或 0 個以上之 Extension header. Fixed 40 octets 0 or more IPv6 Header Extension Header Extension Header Transport-level PDU IPv6 PDU

5

6 IPv4 vs. IPv6 Header IPv4 Packet Header IPv6 Packet Header
Service Type Traffic Class Ver IHL Total Length Ver Flow Label Next Header Hop Limit Identification Flags Offset Payload Length TTL Protocol Header Checksum Source Address Source Address Destination Address Options + Padding 這是 IPv4 和 IPv6 packet Header 之比較圖示, 其中 IPv4 之 Source 及 Destination address 皆為 32 bits, 而 IPv6 則皆為 128 bits, 且 IPv4 packet header 之長度為變數 (最少為 20 bytes), IPv6 packet header 則固定為 40 bytes, 原因在於 IPv6 header 有 Options + Padding 之變動長度欄位, 而 IPv6 則將之移至後續之 Extension header 內了 . 32 bits Destination Address

7 Header Options (0~40 bytes)
IPv4 Packet Header Ver IHL Service Type Total Length Identification Flags Offset TTL Protocol Header Checksum Source Address Destination Address Header Options (0~40 bytes)

8 IPv4表頭結構及選項Option

9 Structure of the IPv4 Header
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-4 byte as a unit~ 5*4 to 15*4) (three bits Precedence + TOS bits) (~65536 bytes) Flags:XDM 3bits: D=1means must not Fragment, M=1 not the last frag. M=0, means is the last. (1, ICMP, 2, IGMP, 6,TCP, 17 UDP, 89, OSPF) . . .

10 Type of Service D T R C Type of Service: 8 bits, how the datagram should be handled by the routers This field is divided into 2 subfields: precedence (3 bits ) and TOS service type (4 bits) Precedence is a 3-bit subfield ranging from 0 to 7, defines the priority of the datagram. TOS bits is a 4-bit subfield, each bit having a special meaning. D: minimize delay, T: Maximize throyghput, R: maximize the reliability, C: minimize cost. Application programs can request a specific type of service. However, the defaults for some applications: e.g., TELNET, minimize delay, FTP (data) Max. throught, FTP(control) minimize delay, SMTP(control) minimize delay, ,…

11 練習: What is the length of the data field given an IHL value of 12 and total length value of 40000? The IP header size? A best-effort delivery service such as IP does not include: a) error checking, b) error correction, c) datagram acknowledgement, d) all of the above. The checksum in the IP packet covers: a) just the header, b) just the data, c) the header and the data. An IP datagram has arrived with the following information in the header (in hexadecimal): C 4E B4 0E 0F 02 a. Are there any options? b.Is the packet fragmented? c.What is the size of the data? d.Is a checksum used? e. How many more routers can the packet travel to? f.what is the type of service? What is the max. number of IP address recorded if the value of the length field in the record route option is 27?

12 問題 電腦甲欲送IP封包到電腦乙 over Ethernet: 請問 整個IP 封包,經幾次Ethernet傳送?
第二次Ethernet傳送時,之MAC frame之欄位值 內容為何? 所有Ethernet傳送中,整個IP 封包表頭,表頭之欄位值 內容為何?

13 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. (checksum with zeros filled) The final result is complemented to make the checksum. Question: Compare with parity check which is better?

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

15 Fragmentation in IPv4 protocol MTU Hyperchannel 65,535
IP datagram Header MTU in a frame Trailer Fields related to fragmentation (router to host) Identification: source host mark this fields Flags: three bits, xDM, x: reserved D: don’t fragment bit stands for don’t fragment , 0 can if necessary. M: stands for more fragments, means the datagram is not the last, 0 means the last or only fragment. fragmentation offset: 13-bit shows the relative position of this fragment. 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 (1500)

16 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 1420 bytes The value of offset is measured in units of eight bytes Byte 2800 Byte 3999

17 fragment example (without considering options and upper layer header)
???? ??? ? 14567 4020 000 SA DA Fragment 1 ????? ??? ? Byte 0000~3,999 Fragment 2 ????? ??? ? Original datagram (total 4020 bytes) Fragment 3

18 Detailed IP fragment Byte 0000~3,999 Original datagram 14567 1420 000
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

19 IPv4 Header Option (40=60-20 bytes)
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)

20 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.

21 Record route concept (code(1 byte)+length(1 byte)+pointer(1 byte)+data field) Max. record route number :(40-4)/4, 9 Code: 1 (NOP) Code: 7 Length (Total length) Pointer First IP address (Empty when started) Second IP address (Empty when started) Last IP address (Empty when started) Op: length >= pointer? If yes, stop, else put the outgoing IP address to the field, pointed by pointer and then pointer value plus 4.

22 Strict source route concept
Dictation of a route use strict source route options as follows: Code: 137 Length (Total length) Pointer First IP address (filled when started) Second IP address (filled when started) Last IP address (filled when started) Op: while (length>=pointer) to the ip address pointed by pointer, place the outgoing IP address to the field, and then the pointer value plus 4.

23 Loose source route concept
Loose dictation of a route use loose source route options as follows: Code: 131 Length (Total length) Pointer First IP address (filled when started) Second IP address (filled when started) Last IP address (filled when started) Op: Each router in the list must be visited, but the datagram can visit other Routers as well.

24 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: 68 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

25 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 ? 2450 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)

26 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,

27 IPv6表頭結構

28 Structure of the IPv6 Header
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

29 Values of the Next Header Field
Hop-by-Hop Options Header 6 TCP 17 UDP 41 Encapsulated IPv6 Header 43 Routing Header 44 Fragment Header 50 Encapsulating Security Payload 51 Authentication Header 58 ICMPv6 59 No next header 60 Destination Options Header

30 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

31 In IPv6, router perform the following:
Verify the value of Version field Decrement the value of Hop Limit Field, if minus…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

32 IPv6 Extension Headers Hop-by-hop options header (NF=0)
40 octets 0 or more IPv6 Header Extension Header Extension Header Transport-level PDU Hop-by-hop options header (NF=0) Routing header (NF=43) Fragment header (NF=44) Authentication header (NF=51) Encapsulating security payload header (NF=41) Destination options header (NF=60) 這是 IPv6 Extension header 之示意圖, 其中 Extension header 掛在 IPv6 Header 之後, 它可以出現 0 個或0 個以上, 而它的型式有下面 6 種: 1. Hop-by-hop options header -- 定義一些需要 hop-by-hop 處理之特殊 options. Only one option is so far specified: the jumbo payload option, used to send IPv6 packets with payloads longer than 2^16 = 65,536 octets. 2. Routing header -- 提供 extended routing, 功能與 IPv4 source routing 相同,內容包括 packet 傳至 destination 所經過之一系列 nodes (IP addresses). 3. Fragment header -- 包括 fragment 及 reassembly 資訊, 內容包括 Fragment Offset (13 bits), M Flag (1 bit, more/last fragment), Identification (32bits). 4. Authentication header -- 提供 packet integrity (完整性) 及 authentication (認證) 之功能. 5. Encapsulating security payload header -- 提供 privacy (隱密) 之功能. 6. Destination options header -- 包括一些需要 destination node 來處理之 optional 資訊, 其 format 與 hop-by-hop options header 完全相同.

33 The Chain of Pointers Formed by the Next Header field
IPv6 Header Next Header = 6 (TCP) TCP Segment (header + data) IPv6 Header Next Header = 43 (Routing) Routing Header Next Header = 6 (TCP) TCP Segment (header + data) IPv6 Header Next Header = 43 (Routing) Routing Header Next Header = 51 (AH) Authentication Header Next Header = 6 (TCP) TCP Segment (header + data)

34 IPv6 Extension Headers IPv6 packet with all extension headers Octets:
40 IPv6 specification recommended order: IPv6 header Hop-by-hop options header Destination options header(for intermediate dest. When the routing header is present) Routing header Fragment header Authentication header Encapsulation security payload header Destination options header IPv6 header Hop-by-hop options header Variable Variable Routing header 8 Fragment header Variable Authentication header Variable Encap security payload header Variable Destination options header 這是 IPv6 packet 包括所有種類 header 之一例, 其中 IPv6 header 和每一 extension header 皆具一 next header field. 當有多個 extension header 出現時, IPv6 spec. 建議其排列次序如右. 20 (optional variable part) TCP header Application data Variable = Next header field IPv6 packet with all extension headers

35 Structure of the Routing Header
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. HEL: 8-byte unit, not include self-8-byte.

36 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

37 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

38 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

39 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)

40 Structure of the Fragment Header (8 bytes)
Next Header Reserved Fragment Offset More Fragments Flag Identification Used for IPv6 fragmentation and reassembly services

41 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

42 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

43 Quiz(4_2)-Example of fragment header
Q4-2: For a TCP segment of 4000 bytes, find the fragment header of IPv6 with MTU=1420 bytes. How many IP datagram are needed? What kind of IPv6 extension header are needed? Marked the fields value for those IP datagram related to fragmentation ? IPv6 Header Extension Header Transport-level PDU

44 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.

45 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.

46 Structure of the Pad1 Option
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,

47 Structure of the PadN Option
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,

48 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.

49 Header Extension Length Options
Quiz (5_1) Quiz (5_1): fill the hop-by-hop extension header with Jumbo Payload Option (value of 224 bytes). Fill out all the fields and draw block diagram i.e., structure between IPv6 header, extension header, and the Data. IPv6 Header Hop by hop Header Transport-level PDU Next Header Header Extension Length Options = 194 = 4 . . .

50 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).

51 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

52 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.

53 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

54 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 . . .

55 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

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

57 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.

58 Structure of the Authentication Header
Next Header Payload Length Reserved Security Parameters Index Sequence Number Authentication Data . . .

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

60 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

61 Structure of the IPv6 Pseudo-Header
Source Address Destination Address Upper Layer Packet Length Zero Next Header = 0

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

63 Internet 封裝 網際層訊框包裝( IP in in 802.2+802.3 LLC/SNAP)
區域網路封裝:網際層封包與 802.2/802.3 訊框包裝

64 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


Download ppt "Lesson 4 IPv4&v6, The IP Packets their Headers."

Similar presentations


Ads by Google