• Tidak ada hasil yang ditemukan

IP Datagram Format

Dalam dokumen TCP/IP Tutorial and Technical Overview (Halaman 66-71)

Comments Welcome

Chapter 2. Internetworking and Transport Layer Protocols

2.1 Internet Protocol (IP)

2.1.8 IP Datagram

2.1.8.1 IP Datagram Format

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

...

...

Figure 20. IP - Format of an IP Datagram Header Where:

VERS

The version of the IP protocol. The current version is 4. 5 is experimental and 6 is IPv6 (see 6.2, “The IPv6 Header Format” on page 358).

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.

3376\3376F205

precedence TOS MBZ

0 1 2 3 4 5 6 7

Figure 21. IP - Service Type Where:

Precedence

Is a measure of the nature and priority of this 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 MBZ

Reserved for future use (must be zero unless participating in an Internet protocol experiment, which makes use of this bit).

A detailed description of the type of service can be found in the RFC 1349 (please also refer to 10.1, “Why QoS?” on page 505 for more details).

Total Length

The total length of the datagram, header and data, specified in bytes.

Identification

A unique number assigned by the sender to aid in reassembling a fragmented datagram. Fragments of a datagram will have the same identification number.

Flags

Various control flags:

0

0 1 2 D F

M F Figure 22. IP - Flags

Where:

0 Reserved, must be zero.

DF Don't Fragment: 0 means allow fragmentation, 1 means do not allow fragmentation.

MF More Fragments: 0 means that this is the last fragment of this datagram, 1 means that this is not the last fragment.

Fragment Offset

Used with fragmented datagrams, to aid in reassembly of the full datagram.

The value is the number of 64-bit pieces (header bytes are not counted) that are contained in earlier fragments. In the first (or only) fragment, this value is always zero.

Time to Live

Specifies the time (in seconds) this datagram is allowed to travel. Each router where this datagram passes is supposed to subtract from this field its

processing time for this datagram. Actually a router is able to process a datagram in less than 1 second; thus it will subtract one from this field, and 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 it is discarded. The initial value should be set by the higher level protocol that creates the datagram.

Protocol Number

Indicates the higher level protocol to which IP should deliver the data in this datagram. Some important values are:

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 full list can be found in STD 2 — Assigned Internet Numbers.

Header Checksum

Is a checksum on the header only. It does not include the data. The checksum is calculated as the 16-bit one's complement of the one's complement sum of all 16-bit words in the header. For the purpose of this calculation, the checksum field is assumed to be zero. If the header

checksum does not match the contents, the datagram is discarded because at least one bit in the header is corrupt, and the datagram may even have arrived at the wrong destination.

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

Variable length. An IP implementation is not required to be capable of generating options in the datagrams it creates, but 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 byte.

Ÿ A type byte alone.

type 1 byte Figure 23. IP - A Type Byte

Ÿ A type byte, a length byte and one or more option data bytes.

type length option data...

/ / / /

1 byte 1 byte length - 2 bytes

Figure 24. 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\3376F209

fc class option number

0 1 2 3 4 5 6 7

Figure 25. IP - The Type Byte Structure Where:

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

class

The option class is a 2-bit unsigned integer:

0 control 1 reserved

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 time stamp. 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

Counts the length (in bytes) of the option, including the type and length fields.

option data

Contains data relevant to the option.

padding

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

data

The data contained in the datagram is passed to a higher level protocol, as specified in the protocol field.

Dalam dokumen TCP/IP Tutorial and Technical Overview (Halaman 66-71)