CSE

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.

    Base Header:
    Below figure shows the base header with its eight fields.
    These fields are as follows:
    * Version: This 4-bit field defines the version number of the IP. For IPv6, the value is 6.
    * Priority: The 4-bit priority field defines the priority of the packet with respect to traffic congestion.
    * Flow label: The flow label is a 3-byte (24-bit) field that is designed to provide special handling for a particular flow of data.
    * Payload length: The 2-byte payload length field defines the length of the IP datagram excluding the base header.
    * Next header: The next header is an 8-bit field defining the header that follows the base header in the datagram. The next header is either one of the optional extension headers used by IP or the header of an encapsulated packet such as UDP or TCP. Each extension header also contains this field. Table 20.6 shows the values of next headers. Note that this field in version 4 is called the protocol.
    * Hop limit: This 8-bit hop limit field serves the same purpose as the TTL field in IPv4.
    * Source address: The source address field is a 16-byte (128-bit) Internet address that identifies the original source of the datagram.
    * Destination address: The destination address field is a 16-byte (128-bit) Internet address that usually identifies the final destination of the datagram. However, if source routing is used, this field contains the address of the next router.
    Error Reporting:
         As we saw in our discussion of version 4, one of the main responsibilities of ICMP is to report errors. Five types of errors are handled: destination unreachable, packet too big, time exceeded parameter problems, and redirection.
    * Destination Unreachable: The concept of the destination-unreachable message is exactly the same as described for ICMP version 4.
    * Packet Too Big: This is a new type of message added to version 6. If a router receives a datagram that is larger than the maximum transmission unit (MTU) size of the network through which the datagram should pass, two things happen. First, the router discards the datagram and then an ICMP error packet-a packet-too-big message-is sent to the source.
    * Time Exceeded: This message is similar to the one in version 4.
    * Parameter Problem: This message is similar to its version 4 counterpart.
    * Redirection: The purpose of the redirection message is the same as described for version 4.
    Addressing:
    * Delivery of a packet to a host or a router requires two levels of addressing: logical and physical.
    * We need to be able to map a logical address to its corresponding physical address and vice versa. These can be done by using either static or dynamic mapping.
    * Static mapping involves a table that is stored in each machine on the network. Each machine that knows, for example, the IP address of another machine but not its physical address can look it up in the table.
    * In dynamic mapping each time a machine knows one of the two addresses (logical or physical), it can use a protocol to find the other one.
    Mapping Logical to Physical Address:
         Anytime a host or a router has an IP datagram to send to another host or router, it has the logical (IP) address of the receiver. The logical (IP) address is obtained from the DNS if the sender is the host or it is found in a routing table if the sender is a router. But the IP datagram must be encapsulated in a frame to be able to pass through the physical network. This means that the sender needs the physical address of the receiver. The host or the router sends an ARP query packet. The packet includes the physical and IP Addresses of the sender and the IP address of the receiver. Because the sender does not know the physical address of the receiver, the query is broadcast over the network.

         Every host or router on the network receives and processes the ARP query packet, but only the intended recipient recognizes its IP address and sends back an ARP response packet. The response packet contains the recipient's IP and physical addresses. The packet is unicast directly to the inquirer by using the physical address received in the query packet.

    The fields are as follows:
    * Hardware type: This is a 16-bit field defining the type of the network on which ARP is Running. Each LAN has been assigned an integer based on its type. For example, Ethernet is given type 1. ARP can be used on any physical network.
    * Protocol type: This is a 16-bit field defining the protocol. For example, the value of this Field for the IPv4 protocol is 080016, ARP can be used with any higher-level protocol.
    * Hardware length: This is an 8-bit field defining the length of the physical address in bytes. For example, for Ethernet the value is 6.
    * Protocol length: This is an 8-bit field defining the length of the logical address in bytes. For example, for the IPv4 protocol the value is 4.
    * Operation: This is a 16-bit field defining the type of packet. Two packet types are defined: ARP request (1) and ARP reply (2). Sender hardware address. This is a variable-length field defining the physical address of the sender. For example, for Ethernet this field is 6 bytes long.
    * Sender protocol address: This is a variable-length field defining the logical (for example, IP) address of the sender. For the IP protocol, this field is 4 bytes long.
    * Target hardware address: This is a variable-length field defining the physical address of the target. For example, for Ethernet this field is 6 bytes long. For an ARP request message, this field is all 0s because the sender does not know the physical address of the target.
    * Target protocol address: This is a variable-length field defining the logical (for example, IP) address of the target. For the IPv4 protocol, this field is 4 bytes long.
    RARP:
         Reverse Address Resolution Protocol (RARP) finds the logical address for a machine that knows only its physical address. Each host or router is assigned one or more logical (IP) addresses, which are unique and independent of the physical (hardware) address of the machine. To create an IP datagram, a host or a router needs to know its own IP address or addresses. The IP address of a machine is usually read from its configuration file stored on a disk file.

    ICMP:
         The IP protocol is a best-effort delivery service that delivers a datagram from its original source to its final destination. However, it has two deficiencies: lack of error control and lack of assistance mechanisms.
         The Internet Control Message Protocol (ICMP) has been designed to compensate for the above two deficiencies. It is a companion to the IP protocol.
    Types of Messages:
    * ICMP messages are divided into two broad categories: error-reporting messages and query messages.
    * The error-reporting messages report problems that a router or a host (destination) may encounter when it processes an IP packet.
    * The query messages, which occur in pairs, help a host or a network manager get specific information from a router or another host.
         An ICMP message has an 8-byte header and a variable-size data section. Although the general format of the header is different for each message type, the first 4 bytes are common to all.
         One of the main responsibilities of ICMP is to report errors. Although technology has
    produced increasingly reliable transmission media, errors still exist and must be handled. Five types of errors are handled: destination unreachable, source quench, time exceeded, parameter problems, and redirection.
    IGMP:
         The IP protocol can be involved in two types of communication: unicasting and multicasting. The Internet Group Management Protocol (IGMP) is one of the necessary, but not sufficient, protocols that is involved in multicasting. IGMP is a companion to the IP protocol.
    IGMP message format:

    ICMPV6:

         The ARP and IGMP protocols in version 4 are combined in ICMPv6. Just as in ICMPv4, we divide the ICMP messages into two categories. However, each category has more types of messages than before.
    Comparison of error-reporting messages in ICMPv4 and ICMPv6:

    DELIVERY:

         The network layer supervises the handling of the packets by the underlying physical networks. We define this handling as the delivery of a packet.

    FORWARDING:
         Forwarding means to place the packet in its route to its destination. Forwarding requires a host or a router to have a routing table. When a host has a packet to send or when a router has received a packet to be forwarded, it looks at this table to find the route to the final destination.
    Route method versus next-hop method:

    UNICAST ROUTING PROTOCOLS:

         A routing table can be either static or dynamic. A static table is one with manual entries. A dynamic table is one that is updated automatically when there is a change somewhere in the Internet. A routing protocol is a combination of rules and procedures that lets routers in the Internet inform each other of changes.
    Initialization of tables in distance vector routing:
         In distance vector routing, each node shares its routing table with itsimmediate neighbors periodically and when there is a change.

    Dijkstra algorithm:

    MULTICAST ROUTING PROTOCOLS:

    Unicasting: In unicasting, the router forwards the received packet through only one of its interfaces.

    Multicasting: In multicasting, the router may forward the received packet through several of its interfaces. Emulation of multicasting through multiple unicasting is not efficientand may create long delays, particularly with a large group.


Industry      Interaction

Higher Education

Job Skills

Soft Skills

Comm. English

Mock Test

E-learning