Internet Protocol
Last updated
Last updated
The Internet protocol was the result of research job made by american Department of Defence (DoD). Internet means Inter-networks communication and was designed for use of interconnected systems of packet-switched computer communication networks. The only things in common between the networks is the packet architecture. Today the Internet Protocol is the only one yet used in Layer 3. The Internet Protocol provides transmission of blocks of data called datagrams, from sources to destinations, where sources and destinations are hosts identified by fixed length addresses.
The two main functions, that Internet Protocol needs to provide, are:
Definition of unified addresses
Fragmentation
The creation of Internet Protocol comes from the needs of interconnection between networks. Each network has its own protocol and it's composed by serveral devices, connected each other. The terminal devices of a network are the hosts and they can talk to others in the net through routers. The new devices added with the invention of Internet Protocol were the Gateways, devices similar to routers that also translate protocols of different networks. The links inside the network (that connects routers and hosts) work on Layer 3 and the links between gateways work as Layer 2 networks, that doesn't required routing function.
Nowadays, networks are almost local so the gateways work mostly as routers. In fact, the routers don't exist as their definition tells. The routing mechanism is no more done at Layer-3 but at Layer-2.
Ping is the most known service of Internet Protocol.
Round Trip Time (RTT) time needed from network to send the packet and receive the response packet
Delay passed time before the true service
Bit rate (Bandwidth) amount of Bit/s or Bytes/s of the network
Throughput amount of data/s that I can really transmit
Relaibility capacity of being reliable and losing few packets. It's related to inverse of:
To send packets among different networks, we need to identify gloabally the destination host and IP address was designed to solve this problem. The IP addresses are 32 bits numbers. They are commonly represented as a set of 4 numbers separated by a point and each of them is the decimal representation of the corresponding byte in the IP address.
An IP address can be divided into two parts: Network part and Host part. In the past, the IP addresses were classified by three main classes, based on the size of their Network part: Class A, Class B, Class C.
This classification of addresses in this way isn't very efficient because this cannot manage well addressing of large number of small networks or small number of large networks.
To do it it was introduced the Net Mask, a bit mask composed by a sequence of 1's followed by 0's, that permits us to define the parts of an address of whatever dimension we want.
This is useful also to create subnetworks of a given set of hosts.
There are also two special addresses:
Network address (no hosts) Host part = 0...0000
Broadcast address (all hosts in the network) Host part = 1...1111
Hence to give an address to each endpoint of a Point To Point link, we need to use at least an Host part of 2 bits.
which it is. Then when the packet reach a gateway, its IP info is removed from the packet and encapsulated in a Layer 2 packet, to be sent to another network. Each IP packet is also called Datagram.
Each network is defined by a Maximum Transfer Unit (MTU), that defines the maximum size of each Layer 3 packet inside the network. Hence, if the IP information, that reach a gateway of the network, is larger than MTU, the gateway reduces its size.
If a packet pass through many networks and their MTUs are very different, using datagrams, we are sure that the packets won't arrive as in the same order in which they are sent. The reason why this happens is that they are sent without the use of a stream. To manage this problem, when the gateway creates a packet, this stores the first index of the sequence of the bytes of the original IP information.
The last packet, that composed initial IP message, has the flag More Fragments(MF) set to 0. This informa- tion with the knowledge of the length and the first byte index of the last packet, permits to define the length of the original message, whenever it arrives. Each packet can fit easly in the buffer of the gateway receiver.
The content of the internet header is:
Version format of the internet header
IHL length, measured in words of 32 bits, of the internet header (minimum value = 5)
Type of Service parameters of the Quality of Service (QoS) desired (Figure 6.12). Bits 6-7 are reserved for future use.
Bytes 3,4,5:
0
Normal
Normal
Normal
1
Low
High
High
Precedende of Types of service:
111
Network Control
110
Internetwork Control
101
CRITIC/ECP
100
Flash Override
011
Flash
010
Immediate
001
Priority
000
Routine
Total Length length, measured in octets, including internet header and data. This field allows the length of a datagram to be up to 65,535 octets. Such long datagrams are impractical for most hosts and networks. All hosts must be prepared to accept datagrams of up to 576 octets (whether they arrive whole or in fragments). It is recommended that hosts only send datagrams larger than 576 octets if they have assurance that the destination is prepared to accept the larger datagrams.
Identification an identifying value assigned by the sender to aid in assembling the fragments of a datagram. It's a random number generated by host while creating the packet, that is different from numbers of all other packets.
Flags varius control flags. The bit 0 is reserved and must be 0. If DF set and a packet that arrives to a network should be divided in smaller fragments, it's dropped.
0
May Fragment
Last Fragment
1
Don't Fragment
More Fragments
Fragment Offset This field indicates where in the datagram this fragment belongs (position of the fragment in the original long packet). The fragment offset is measured in units of 8 octets (64 bits). The first fragment has offset zero. It's computed starting from initial position in the packet.
Time to Live maximum time (number of forward for the packet) the datagram is allowed to remain in the internet system. This counter is set by host that generated the packet. Every node in the network (routers, switches), that process the packet, decrements the value of this field. When a node, decrementing this field, reaches zero value for Time To Live, it drops the packet immediately. Time To Live prevents that a packet stays in the network too much time compromising infrustructure efficiency.
Protocol the next level protocol (Layer 4) used in the data portion of the internet datagram. In general it's called ULP (Upper Layer Protocol). This is useful and was done also at upper layer, using port numbers, because it's a way to communicate future use to upper layer. This field is the upper layer protocol type (/etc/protocols on UNIX) and it's used by Operating System to understand to which module send a specific part of the packet. You can also find them in IANA site.
Header Checksum a checksum on the header only.
How to compute it The checksum field is the 16 bit one's complement of the one's complement sum of all 16 bit words in the header. For purposes of computing the checksum, the value of the checksum field is zero.
The two main operation used in its computation are:
One's complement sum two words of 16 bits are summed up, bit by bit, and the last carry is summed up to the previous result. The following example shows how to sum two number with this operator:
Ones's complement The value of each bit, inside the result of 16 bit sum of all the words, change their values.
This algorithm is very simple but experimental evidence indicates it works. Nowadays, it's quite always used CRC procedure.
Source Address the source IP address
Destination Address the destination IP address
Options it'svariable and it may appear or not in datagrams. They must be implemented by all IP modules (host and gateways). What is optional is their transmission in any particular datagram, not their implementation.