• Tidak ada hasil yang ditemukan

IP datagram format

Dalam dokumen TCP/IP Tutorial and Technical Overview (Halaman 114-120)

TCP/IP

Chapter 3. Internetworking protocols

3.1 Internet Protocol (IP)

3.1.8 IP datagram

3.1.8.1 IP datagram format

• Type 4: Those providers that perform inter-domain routing using only default routes.

The CIDR implementation began with the Type 1 network providers, then the Type 2, and finally the Type 3 providers.

VERS

1 1 2 3 0 4 8 6 9 4 1

HLEN Service

Type Total Length

ID FLG Fragment

Offset

TTL Protocol Header

Checksum Source IP Address

Destination IP Address

IP Options Padding

Data ...

...

...

Chapter 3. Internetworking protocols 91

Figure 27. IP - Format of an IP datagram header

Where:

• VERS: The field contains the IP protocol version. The current version is 4.

5 is an experimental version. 6 is the version for IPv6 (see 17.2, “The IPv6 header format” on page 561).

• HLEN: The length of the IP header counted in 32-bit quantities. This does not include the data field.

• Service Type: The service type is an indication of the quality of service requested for this IP datagram. This field contains the following

information:

3376\3376F2O5

precedence TOS MBZ

0 1 2 3 4 5 6 7

Figure 28. IP - Service type

Where:

- Precedence: This field specifies the nature and priority of the datagram:

• 000: Routine • 001: Priority • 010: Immediate • 011: Flash

• 100: Flash override • 101: Critical

• 110: Internetwork control • 111: Network control

- TOS: Specifies the type of service value:

• 1000: Minimize delay • 0100: Maximize throughput • 0010: Maximize reliability • 0001: Minimize monetary cost • 0000: Normal service

A detailed description of the type of service can be found in the RFC 1349 (refer to 22.1, “Why QoS?” on page 781).

- MBZ: Reserved for future use.

• Total Length: The total length of the datagram, header and data.

• Identification: A unique number assigned by the sender to aid in

reassembling a fragmented datagram. Each fragment of a datagram has the same identification number.

• Flags: This field contains control flags:

0

0 1 2 D F

M F

Figure 29. IP - Flags

Where:

- 0: Reserved, must be zero.

- DF (Do not Fragment): 0 means allow fragmentation; 1 means do not allow fragmentation.

Chapter 3. Internetworking protocols 93 - MF (More Fragments): 0 means that this is the last fragment of the

datagram; 1 means that additional fragments will follow.

• Fragment Offset: This is used to aid the reassembly of the full datagram.

The value in this field contains the number of 64-bit segments (header bytes are not counted) contained in earlier fragments. If this is the first (or only) fragment, this field contains a value of zero.

• Time to Live: This field specifies the time (in seconds) the datagram is allowed to travel. Theoretically, each router processing this datagram is supposed to subtract its processing time from this field. In practise, a router processes the datagram in less than 1 second. Thus the router subtracts one from the value in this field. The TTL becomes a hop-count metric rather than a time metric. When the value reaches zero, it is assumed that this datagram has been traveling in a closed loop and is discarded. The initial value should be set by the higher level protocol that creates the datagram.

• Protocol Number: This field indicates the higher level protocol to which IP should deliver the data in this datagram. These include:

- 0: Reserved

- 1: Internet Control Message Protocol (ICMP) - 2: Internet Group Management Protocol (IGMP) - 3: Gateway-to-Gateway Protocol (GGP)

- 4: IP (IP encapsulation) - 5: Stream

- 6: Transmission Control Protocol (TCP) - 8: Exterior Gateway Protocol (EGP) - 9: Private Interior Routing Protocol - 17: User Datagram Protocol (UDP) - 41: IP Version 6 (IPv6)

- 50: Encap Security Payload for IPv6 (ESP) - 51: Authentication Header for IPv6 (AH) - 89: Open Shortest Path First

The complete list is detailed in STD 2 – Assigned Internet Numbers.

• Header Checksum: This field is a checksum for the information contained in the header. If the header checksum does not match the contents, the datagram is discarded.

• Source IP Address: The 32-bit IP address of the host sending this datagram.

• Destination IP Address: The 32-bit IP address of the destination host for this datagram.

• Options: An IP implementation is not required to be capable of generating options in a datagram. However, all IP implementations are required to be able to process datagrams containing options. The Options field is variable in length (there may be zero or more options). There are two option formats; the format for each is dependent on the value of the option number found in the first octet:

- A type octet alone:

type

1 byte

Figure 30. IP - A type byte

- A type octet, a length octet and one or more option data octets:

type length option data...

/ / / /

1 byte 1 byte length - 2 bytes

Figure 31. IP - A type byte, a length byte, and one or more option data bytes

The type byte has the same structure in both cases:

3376\3376F2O9

fc class option number

0 1 2 3 4 5 6 7

Figure 32. IP - The type byte structure

Where:

- fc (Flag copy): This field indicates whether (1) or not (0) the option field is copied when the datagram is fragmented.

- class: The option class is a 2-bit unsigned integer:

• 0: control • 1: reserved

Chapter 3. Internetworking protocols 95 • 2: debugging and measurement

• 3: reserved

- option number: The option number is a 5-bit unsigned integer.

• 0: End of option list. It has a class of 0, the fc bit is set to zero, and it has no length byte or data. That is, the option list is terminated by a X'00' byte. It is only required if the IP header length (which is a multiple of 4 bytes) does not match the actual length of the options.

• 1: No operation. It has a class of 0, the fc bit is not set and there is no length byte or data. That is, a X'01' byte is a NOP. It may be used to align fields in the datagram.

• 2: Security. It has a class of 0, the fc bit is set and there is a length byte with a value of 11 and 8 bytes of data). It is used for security information needed by U.S. Department of Defense requirements.

• 3: Loose source routing. It has a class of 0, the fc bit is set and there is a variable length data field. This option is discussed in more detail below.

• 4: Internet timestamp. It has a class of 2, the fc bit is not set and there is a variable length data field. The total length may be up to 40 bytes. This option is discussed in more detail below.

• 7: Record route. It has a class of 0, the fc bit is not set and there is a variable length data field. This option is discussed in more detail below.

• 8: Stream ID. It has a class of 0, the fc bit is set and there is a length byte with a value of 4 and one data byte. It is used with the SATNET system.

• 9: Strict source routing. It has a class of 0, the fc bit is set and there is a variable length data field. This option is discussed in more detail below.

- length: This field counts the length (in octets) of the option, including the type and length fields.

- option data: Contains data relevant to the specific option.

• Padding: If an option is used, the datagram is padded with all-zero octets up to the next 32-bit boundary.

• Data: The data contained in the datagram. It is passed to the higher level protocol specified in the protocol field.

Dalam dokumen TCP/IP Tutorial and Technical Overview (Halaman 114-120)