Internet Protocol - IP
IP Features
IP is a connectionless or datagram internetwork service, providing no end-toend delivery guarantees. IP datagrams may arrive at the destination host damaged, duplicated, out of order, or not at all.
All Internet transport protocols use the Internet Protocol (IP) to carry data from source host to destination host.
1
IP Features
The layers above IP are responsible for reliable delivery service when it is required. The IP protocol includes provision for addressing, type-of-service specification, fragmentation and re-assembly, and security. The datagram or connectionless nature of IP is a fundamental and characteristic feature of the Internet architecture.
3
Connectionless Operation of Internet Protocol
Corresponds to datagram mechanism in packet switched network Each N-PDU treated separately Network layer protocol common to all DTEs and routers Internet Protocol
Known generically as the internet protocol Internet Protocol developed for ARPANET RFC 791 (Get it and study it)
Lower layer protocol needed to access particular network
Connectionless IP Internetworking
Advantages
Flexibility Robust No unnecessary overhead
Router-based Networking
Unreliable
Not guaranteed delivery Not guaranteed order of delivery
Packets can take different routes
Reliability is responsibility of next layer up (e.g. TCP)
5 6
IP and Other Protocols
IP provides several services:
IP headers contain 32-bit addresses which identify the sending and receiving hosts. These addresses are used by intermediate routers to select a path through the network for the packet. IP packets may be split, or fragmented, into smaller packets. This permits a large packet to travel across a network which can only handle smaller packets. IP fragments and reassembles packets transparently. Each IP packet contains a Time To Live (TTL) field, which is decremented every time a router handles the packet. If TTL reaches zero, the packet is discarded, preventing packets from running in circles forever and flooding a network.
Addressing.
Fragmentation.
Packet timeouts. Type of Service.
IP supports traffic prioritization by allowing packets
to be labeled with an abstract type of service.
7
Options
IP provides several optional features allowing a packet's sender to
IP Datagram Format
Internet Protocol Packet Header
10
VERS - Version
The version of the IP protocol. The current version is 4. 5 is experimental and 6 is IPng (see IP: The Next Generation (IPng)).
The version of the IP protocol
LEN - Length
The length of the IP header counted in 32bit quantities. This does not include the data field.
The length of the IP header
11 12
Type of Service
The type of service is an indication of the quality of service requested for this IP datagram.
Type of Service - Precedence
Is a measure of the nature and priority of this datagram:
000 001 010 011 100 101 110 111
13
quality of service??
Routine Priority Immediate Flash Flash override Critical Internetwork control Network control
14
TOS - Type Of Service
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
15
MBZ - Must Be Zero
Reserved for future use ("must be zero" unless participating in an Internet protocol experiment which makes use of this bit)
16
Total Length
Total length of the IP datagram in bytes Maximum size is 64k because there are 16 bits for it That means a single IP datagram cannot be bigger than 65536 bytes including the header
Fragmentation Related Information
The next 32 bits contain information related to fragmentation This information can be used to reassemble a fragmented IP datagram Fragmentation means that on its way a single IP datagram was broken into smaller IP datagrams because the intervening network was unable to carry the original datagram because it was too big
17
18
Why Fragment?
When an IP datagram travels from one host to another, it can cross different physical networks. Physical networks have a maximum frame size, called the Maximum Transmission Unit (MTU), which limits the length of a datagram that can be placed in one physical frame. Therefore, a scheme has been put in place to fragment long IP datagrams into smaller ones, and to reassemble them at the destination host. IP requires that each link has an MTU of at least 68 bytes, so if any network provides a lower value than this, fragmentation and re-assembly must be implemented in the network interface layer in a way that is transparent to IP. 68 is the sum of the maximum IP header length of 60 bytes and the minimum possible length of data in a non-final fragment (8 bytes). IP implementations are not required to handle unfragmented datagrams larger than 576 bytes, but most implementations will handle larger values, typically slightly more than 8192 bytes or higher, and rarely less than 1500.
19
Why Fragment?
Host - A in LAN -1 is commnicating with Host - B in LAN -2 using IP Host - A Host - B
LAN -1 Ethernet MTU = 1500 bytes
Router A
WAN -1 X.25 MTU = 128 bytes
Router B
LAN - 2 Ethernet -2 MTU = 1500 bytes
Router A has to perform fragmentation of IP datagrams when forwarding them from LAN-1 to WAN-1
20
Fragmentation Procedure
An unfragmented datagram has all-zero fragmentation information. That is, the more fragments flag bit is zero and the fragment offset is zero. When fragmentation is to be done, the following steps are performed:
Fragmentation Procedure
The DF flag bit is checked to see if fragmentation is allowed. If the bit is set, the datagram will be discarded and an error will be returned to the originator using ICMP. Based on the MTU value, the data field is split into two or more parts. All newly created data portions must have a length which is a multiple of 8 bytes, with the exception of the last data portion.
21 22
Fragmentation Example
Fragmentation Procedure - 2
All data portions are placed in IP datagrams. The header of these datagrams are copies of the original one, with some modifications: The more fragments flag bit is set in all fragments except the last. The fragment offset field in each is set to the location this data portion occupied in the original datagram, relative to the beginning of the original unfragmented datagram. The offset is measured in 8-byte units. If options were included in the original datagram, the high order bit of the option type byte determines whether or not they will be copied to all fragment datagrams or just to the first one. For instance, source route options have to be copied in all fragments and therefore they have this bit set. The header length field is of the new datagram is set. The total length field of the new datagram is set. The header checksum field is re-calculated.
23 24
Fragmentation Procedure - 3
Each of these fragmented datagrams is now forwarded as a normal IP datagram. IP handles each fragment independently, that is, the fragments may traverse different routers to the intended destination, and they may be subject to further fragmentation if they pass through networks that have smaller MTUs.
Reassembley Procedure
At the destination host, the data has to be reassembled into one datagram. The identification field of the datagram was set by the sending host to a unique number (for the source host, within the limits imposed by the use of a 16-bit number). As fragmentation doesn't alter this field, incoming fragments at the receiving side can be identified, if this ID field is used together with the Source and Destination IP addresses in the datagram. The Protocol field is also to be checked for this identification.
25 26
Reassembley Procedure - 2
In order to reassemble the fragments, the receiving host allocates a buffer in storage as soon as the first fragment arrives. A timer routine is then started. When the timer timeouts and not all of the fragments have been received, the datagram is discarded. The initial value of this timer is called the IP datagram time-to-live (TTL) value. It is implementation dependent, and some implementations allow it to be configured; for example AIX Version 3.2 provides an ipfragttl option with a default value of 60 seconds.
27
Re-assembly Procedure - 3
When subsequent fragments of the datagram arrive, before the timer expires, the data is simply copied into the buffer storage, at the location indicated by the fragment offset field. As soon as all fragments have arrived, the complete original unfragmented datagram is restored, and processing continues, just as for unfragmented datagrams.
28
Fragmentation Fields
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. 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.
29
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.
30
Dealing with Failure in Reassembly
Re-assembly may fail if some fragments get lost Need to detect failure Re-assembly time out
Assigned to first fragment to arrive If timeout expires before all fragments arrive, discard partial data
TTL - 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 which creates the datagram.
32
Use packet lifetime (time to live in IP)
If time to live runs out, kill partial data
31
Protocol- 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 (TCP) 8 Exterior Gateway Protocol (EGP) 9 Private Interior Routing Protocol 17 User Datagram (UDP) 89 Open Shortest Path First The full list can be found in STD 2 - Assigned Internet Numbers.
33
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.
34
Options
Various options regarding this datagram, including how to route it, how to identify it (security labeling), how to trace the places through which it passes, how to timestamp it for delay measurement, etc.
Options
Options Up to 40 bytes of option data added by source host or intermediate routers 1 byte Option id, followed by an optional 1 byte Option length, followed by Option data Padded to a multiple of 4 bytes 5 options currently defined Security Security identifier Strict source routing Complete route specified Loose source routing List of required routers to pass through Record route Each router appends its address to the list Timestamp Each router appends address & timestamp stream id (used for voice) for reserved resources,
36
Security Source routing Route recording Timestamping
35