Data Communications & Computer Networks
UNIT - V
Network Layer
Network Layer:
* Communication at the network layer is host-to-host (computer-to-computer); a computer Somewhere in the world needs to communicate with another computer somewhere else in the world.
* Usually, computers communicate through the Internet. The packet transmitted by the sending computer may pass through several LANs or WANs before reaching the destination computer.
* The Internet addresses are 32 bits in length; this gives us a maximum of 232 addresses. These addresses are referred to as IPv4 (IP version 4) addresses or simply IP addresses if there is no confusion.
* The need for more addresses, in addition to other concerns about the IP layer, motivated a new design of the IP layer called the new generation of IP or IPv6 (lP version 6). In this version, the Internet uses 128-bit addresses that give much greater flexibility in address allocation. These addresses are referred to as IPv6 (IP version 6) addresses.
IPv4 ADDRESSES:
* An IPv4 address is a 32-bit address that uniquely and universally defines the connection of a device (for example, a computer or a router) to the Internet.
* IPv4 addresses are unique. They are unique in the sense that each address defines one, and only one, connection to the Internet. Two devices on the Internet can never have the same address at the same time.
Address Space:
* A protocol such as IPv4 that defines addresses has an address space.
* An address space is the total number of addresses used by the protocol. If a protocol uses N bits to define an address, the address space is 2N because each bit can have two different values (0 or 1) and N bits can have 2N values.
* IPv4 uses 32-bit addresses, which means that the address space is 232 or 4,294,967,296 (more than 4 billion). This means that, theoretically, if there were no restrictions, more than 4 billion devices could be connected to the Internet.
Notations
Each TCP/IP host is identified by a logical IP address. This address is unique for each host that communicates by using TCP/IP. Each 32-bit IP address identifies a location of a host system on the network in the same way that a street address identifies a house on a city street. Just as a street address has a standard two-part format (a street name and a house number), each IP address is separated internally into two parts--a network ID and a host ID:
* The network ID, also known as a network address, identifies a single network segment within a larger TCP/IP internetwork (a network of networks). All the systems that attach and share access to the same network have a common network ID within their full IP address. This ID is also used to uniquely identify each network within the larger internetwork.
* The host ID, also known as a host address, identifies a TCP/IP node (a workstation,
server, router, or other TCP/IP device) within each network. The host ID for each device identifies a single system uniquely within its own network.
* There are two prevalent notations to show an IPv4 address: binary notation and dotted decimal notation.
* Binary Notation
In binary notation, the IPv4 address is displayed as 32 bits. Each octet is often referred to as a byte.
So it is common to hear an IPv4 address referred to as a 32-bit address or a 4-byte address. The following is an example of an IPv4 address in binary notation:
01110101 10010101 00011101 00000010
* Dotted-Decimal Notation
To make the IPv4 address more compact and easier to read, Internet addresses are usually written in decimal form with a decimal point (dot) separating the bytes. The following is the dotted decimal notation of the above address:
117.149.29.2
Classful Addressing:
* IPv4 addressing, at its inception, used the concept of classes. This architecture is called classful addressing.
* In classful addressing, the address space is divided into five classes: A, B, C, D, and E. Each class occupies some part of the address space.
[ w.x.y.z ]
Class Value of w Network ID Host ID Number of networks Number of hosts per
Network
A 0-127 w x.y.z 126 16,777,214
B 128-191 w.x y.z 16,384 65,534
C 192-223 w.x.y z 2,097,152 254
D 224-239 Reserved for multicast
addressing
N/A N/A N/A
E 240-255 Reserved for experimental
use
N/A N/A N/A
IPv4:
The Internet Protocol version 4 (IPv4) is the delivery mechanism used by the TCP/IP protocols.
Version (VER):
This 4-bit field defines the version of the IPv4 protocol. Currently the version is 4. However, version 6 (or IPng) may totally replace version 4 in the future.
Header length (HLEN):
This 4-bit field defines the total length of the datagram header in 4-byte words. This field is needed because the length of the header is variable (between 20 and 60 bytes). When there are no options, the header length is 20 bytes, and the value of this field is 5 (5 x 4 = 20). When the option field is at its maximum size, the value of this field is 15 (15 x 4 = 60).
Services:
This field, previously called service type, is now called differentiated services.
Service Type:
In this interpretation, the first 3 bits are called precedence bits. The next 4 bits are called type of service (TOS) bits, and the last bit is not used.
* Precedence is a 3-bit subfield ranging from 0 (000 in binary) to 7 (111 in binary). The precedence defines the priority of the datagram in issues such as congestion. If a router is congested and needs to discard some datagram’s, those datagram’s with lowest precedence are discarded first.
* TOS bits is a 4-bit subfield with each bit having a special meaning. Although a bit can be either 0 or 1, one and only one of the bits can have the value of 1 in each datagram.
The bit patterns
Total length:
This is a 16-bit field that defines the total length (header plus data) of the IPv4 datagram in bytes.
Length of data =total length - header length
Identification:
This 16-bit field identifies a datagram originating from the source host. The combination of the identification and source IPv4 address must uniquely define a datagram as it leaves the source host.
Flags:
This is a 3-bit field. The first bit is reserved. The second bit is called the do not fragment bit. If its value is 1, the machine must not fragment the datagram. The third bit is called the more fragment bit. If its value is 1, it means the datagram is not the last fragment; there are more fragments after this one. If its value is 0, it means this is the last or only fragment.
Fragmentation offset:
This 13-bit field shows the relative position of this fragment with respect to the whole datagram.
Time to live:
A datagram has a limited lifetime in its travel through an internet. This field was originally designed to hold a timestamp, which was decremented by each visited router.
The datagram was discarded when the value became zero.
Protocol:
This 8-bit field defines the higher-level protocol that uses the services of the IPv4 layer.
An IPv4 datagram can encapsulate data from several higher-level protocols such as TCP, UDP, ICMP, and IGMP.
This field specifies the final destination protocol to which the IPv4 datagram is delivered.
Checksum
The checksum concept and its calculation are discussed later in this chapter.
Source address
This 32-bit field defines the IPv4 address of the source. This field must remain
unchanged during the
time the IPv4 datagram travels from the source host to the destination host.
Destination address
This 32-bit field defines the IPv4 address of the destination. This field must remain
unchanged during the
time the IPv4 datagram travels from the source host to the destination host.
IPv6:
IPv6 (Internetworking Protocol, version 6), also known as IPng (Internetworking Protocol, next generation), was proposed and is now a standard. In IPv6, the Internet
protocol was extensively modified to accommodate the unforeseen growth of the Internet. The format and the length of the IP address were changed along with the packet format.
Advantages:
The next-generation IP, or IPv6, has some advantages over IPv4 that can be summarized as follows:
* Larger address space: An IPv6 address is 128 bits long. Compared with the 32-bit address of IPv4, this is a huge (296) increase in the address space.
* Better header format: IPv6 uses a new header format in which options are separated from the base header and inserted, when needed, between the base header and the upperlayer data.
This simplifies and speeds up the routing process because most of the options do not need to be checked by routers.
* New options: IPv6 has new options to allow for additional functionalities.
* Allowance for extension: IPv6 is designed to allow the extension of the protocol if required by new technologies or applications.
* Support for resource allocation: In IPv6, the type-of-service field has been removed, but a mechanism has been added to enable the source to request special handling of the packet. This mechanism can be used to support traffic such as real-time audio and video.
* Support for more security: The encryption and authentication options in IPv6 provide confidentiality and integrity of the packet.
Packet Format:
The IPv6 packet is shown in below Figure. Each packet is composed of a mandatory base header followed by the payload. The payload consists of two parts: optional extension headers and data from an upper layer. The base header occupies 40 bytes, whereas the extension headers and data from the upper layer contain up to 65,535 bytes of information.