Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lesson 4-1 資 管 Lesson 4 IPv4&v6, The  IP Packets  their Headers.

Similar presentations


Presentation on theme: "Lesson 4-1 資 管 Lesson 4 IPv4&v6, The  IP Packets  their Headers."— Presentation transcript:

1 Lesson 4-1 資 管 Lesson 4 IPv4&v6, The  IP Packets  their Headers

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

3 Lesson 4-3 資 管 IPv4 與 IPv6 封包結構

4 Lesson 4-4 資 管 IPv6 vs. IPv4 Packet structure (IP 封包結構 ) minimum 20 octets maximum 65535 octets Fixed 40 octets payload Maximum 65535 octets IPv6 PDU 0 or more IPv4 Header Data Field Transport-level PDU IPv6 Header Extension Header Extension Header Option Header Upto 40 octets Transport-level PDU payload IHL (Header length)

5 Lesson 4-5 資 管

6 Lesson 4-6 Destination Address Source Address IdentificationFlagsOffset TTL ProtocolHeader Checksum Source Address Destination Address Options + Padding VerFlow Label Payload Length Next Header Hop Limit Traffic Class IPv4 vs. IPv6 Header IPv4 Packet Header IPv6 Packet Header 32 bits Ver IHL Total Length Service Type

7 Lesson 4-7 VerIHLService TypeTotal Length IdentificationFlags Offset TTLProtocolHeader Checksum Source Address Destination Address Header Options (0~40 bytes) IPv4 Packet Header

8 Lesson 4-8 資 管 IPv4 表頭結構及選項 Option

9 Lesson 4-9 資 管 Version Internet Header Length Type of Service Total Length Identification Flags Fragment Offset Time to Live Protocol Header Checksum Source Address Destination Address Options... Structure of the IPv4 Header (5 to 15-4 byte as a unit~ 5*4 to 15*4) (three bits Precedence + TOS bits) (~65536 bytes) (1, ICMP, 2, IGMP, 6,TCP, 17 UDP, 89, OSPF) Flags:XDM 3bits: D=1means must not Fragment, M=1 not the last frag. M=0, means is the last.

10 Lesson 4-10 資 管 Type of Service DTRC 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 Lesson 4-11 資 管 練習 : 1. What is the length of the data field given an IHL value of 12 and total length value of 40000? 2. The IP header size? 3. 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. 4. The checksum in the IP packet covers: a) just the header, b) just the data, c) the header and the data. 5. An IP datagram has arrived with the following information in the header (in hexadecimal): 45 00 00 54 00 03 00 00 20 06 00 00 7C 4E 03 02 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? 6. What is the max. number of IP address recorded if the value of the length field in the record route option is 27?

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

13 Lesson 4-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 Lesson 4-14 資 管 IP Packet Example with checksum 450 1 28 0 4 17 10.12.14.5 0 12.6.7.9 0 For Example; (For the following IP header without option)

15 Lesson 4-15 資 管 Fragmentation in IPv4 protocolMTU Hyperchannel65,535 Token ring (16Mbps) 17,914 Token ring (4Mbps)4,464 FDDI4,352 Ethernet1,500 X.25576 PPP296 (1500) IP datagram MTU in a frameHeaderTrailer Fields related to fragmentation (router to host) Identification: source host mark this fields Flags: three bits, xDM, x: reserved D: don’t fragment bit 1 stands for don’t fragment, 0 can if necessary. M: stands for more fragments, 1 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.

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

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

18 Lesson 4-18 資 管 Detailed IP fragment 14567 4020 000 0 14567 1420 000 1 14567 1420 175 1 14567 1220 350 0 14567 820 175 1 14567 620 275 1 Byte 0000~3,999 Original datagram Fragment 1 Fragment 2 Fragment 3 Fragment 2.1 Fragment 2.2

19 Lesson 4-19 資 管 IPv4 Header Option (40=60-20 bytes) Option format Code 8 bits Data Variable length Length 8 bits Copy 1 bit Number 5 bits Class 2 bits Number 00000 End of Option (one byte) 00001 No operation (one byte) 00011 Loose source route (multiple bytes) 00100 Timestamp (multiple bytes) 00111 Record route (multiple bytes) 01001 Strict source route (multiple bytes) Class 00 Datagram control 01 Reserved 10 Debugging and management 11 Reserved Copy (when fragmented) 0 Copy only in first fragment 1 Copy into all fragments Length: defines the total length of the option including the code field and itself. (not all present)

20 Lesson 4-20 資 管 Padding options No Operation: ◦ a one-byte option used as a filler between options; coded as 00000001 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 00000000. 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 Lesson 4-21 資 管 Record route concept (code(1 byte)+length(1 byte)+pointer(1 byte)+data field) Max. record route number :(40-4)/4,  9 First IP address (Empty when started) Second IP address (Empty when started) Last IP address (Empty when started) Code: 7 00000111 Length (Total length) Pointer Code: 1 (NOP) 00000001 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 Lesson 4-22 資 管 Strict source route concept First IP address (filled when started) Second IP address (filled when started) Last IP address (filled when started) Code: 137 10001001 Length (Total length) Pointer Dictation of a route use strict source route options as follows: 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 Lesson 4-23 資 管 Loose source route concept First IP address (filled when started) Second IP address (filled when started) Last IP address (filled when started) Code: 131 10000011 Length (Total length) Pointer Loose dictation of a route use loose source route options as follows: Op: Each router in the list must be visited, but the datagram can visit other Routers as well.

24 Lesson 4-24 資 管 Time Stamp Concept First IP address (filled when started) Timestamp 1 Last IP address (filled when started) Code: 68 01000100 Length (Total length) Pointer O-Flow 4 bits Flags 4 bits Timestamp last 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. O-Flow: Add the number of routers that could not add their timestamp due to no more fields available.

25 Lesson 4-25 資 管 Practice Quiz 4?0 1 2450 0 4 17 10.12.14.5 0 12.6.7.9 ? 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? First IP address (Empty when started) Second IP address (Empty when started) Last IP address (Empty when started) Code: 7 00000111 15 4

26 Lesson 4-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 Lesson 4-27 資 管 IPv6 表頭結構

28 Lesson 4-28 資 管 Structure of the IPv6 Header Destination Address Source Address VerFlow 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 Lesson 4-29 資 管 Values of the Next Header Field ValueHeader 0Hop-by-Hop Options Header 6TCP 17UDP 41Encapsulated IPv6 Header 43Routing Header 44Fragment Header 50Encapsulating Security Payload 51Authentication Header 58ICMPv6 59No next header 60Destination Options Header

30 Lesson 4-30 資 管 Comparing the IPv4 and IPv6 Headers IPv4 Header FieldChange in IPv6 VersionNew value of 6 Internet Header LengthRemoved Type of ServiceTraffic Class field Total LengthPayload Length field IdentificationRemoved to Fragment header Fragmentation FlagsRemoved to Fragment header Fragment OffsetRemoved to Fragment header Time to LiveHop Limit field ProtocolNext Header field Header ChecksumRemoved Source AddressSame, new 128-bit length Destination AddressSame, new 128-bit length OptionsRemoved (extension headers) 增加 Flow Label 20 bits

31 Lesson 4-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 Lesson 4-32 資 管 IPv6 Extension Headers 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) Transport-level PDU IPv6 Header Extension Header Extension Header 40 octets0 or more

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

34 Lesson 4-34 資 管 IPv6 Extension Headers 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 packet with all extension headers Octets: 40 Variable 8 20 (optional variable part) = Next header field IPv6 header Hop-by-hop options header Routing header Fragment header Authentication header Encap security payload header TCP header Application data Destination options header

35 Lesson 4-35 資 管 Next Header Header Extension Length Routing Type Segments Left Routing type-specific data... Structure of the Routing Header 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. The same as Record route, strict source, and loose source routing option in IPv4

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

37 Lesson 4-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 Lesson 4-38 資 管 When the IPv6 packet reaches an intermediate destination, the routing header is processed and: 1.The current destination address and the address in the (N-Segments Left +1) position in the list of addresses are swapped 2.The Segments Left field is decremented 3.The packet is forwarded

39 Lesson 4-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 Lesson 4-40 資 管 Next Header Reserved Fragment Offset Reserved More Fragments Flag Identification Structure of the Fragment Header (8 bytes) Used for IPv6 fragmentation and reassembly services

41 Lesson 4-41 資 管 Unfragmentable partFragmentable part Unfragmentable partFirst fragment Fragment header Unfragmentable partSecond fragment Fragment header Unfragmentable partThird fragment Fragment header Original IPv6 Packet IPv6 Fragmentation Process

42 Lesson 4-42 資 管 Unfragmentable partFragmentable part Unfragmentable partFragmentable part Fragment header Unfragmentable partFragmentable part Fragment header Unfragmentable part Fragmentable part Fragment header Original IPv6 Packet IPv6 Reassembly Process

43 Lesson 4-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. 1)How many IP datagram are needed? 2)What kind of IPv6 extension header are needed? 3)Marked the fields value for those IP datagram related to fragmentation ? Transport-level PDU IPv6 Header Extension Header

44 Lesson 4-44 資 管 Next Header Header Extension Length Options... Structure of the Hop-by-Hop Options Header 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 Lesson 4-45 資 管 Option Type Option Length Option data... Structure of an Option 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 Lesson 4-46 資 管 Option Type = 0 Structure of the Pad1 Option 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 Lesson 4-47 資 管 Option Type Option Length Option data... = 1 Structure of the PadN Option 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 Lesson 4-48 資 管 Option Type Option Length Jumbo Payload Length = 194 = 4 Structure of the Jumbo Payload Option Option type Field: The size in the IPv6 header is invalid, instead the jumbo payload length is used. Option type of 194 (11000010): indicates an ICMPv6 parameter problem if the option is not recognized and the destination address is not a multicast address.

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

50 Lesson 4-50 資 管 Option Type Option Length Router Alert Value = 5 = 2 = 0 Structure of the Router Alert Option 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 Lesson 4-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 Lesson 4-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 Lesson 4-53 資 管 Next Header Header Extension Length Options... Structure of the Destination Options Header 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 Lesson 4-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 Lesson 4-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 Lesson 4-56 資 管 Option Type Option Length Sub-Options = 8... Structure of the Binding Request Option Used to request the binding from a mobile node.

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

58 Lesson 4-58 資 管 Next Header Payload Length Reserved Security Parameters Index Sequence Number Authentication Data... Structure of the Authentication Header

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

60 Lesson 4-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 Lesson 4-61 資 管 Source Address Destination Address Upper Layer Packet Length Zero Next Header = 0 Structure of the IPv6 Pseudo- Header

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

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

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


Download ppt "Lesson 4-1 資 管 Lesson 4 IPv4&v6, The  IP Packets  their Headers."

Similar presentations


Ads by Google