×

Network Layer: Logical Address

Network Layer - Logical Address

The IP address is a 32 bit long, and it provides us a maximum of 232 addresses. These addresses are known as IPv4 addresses.

The IP address is a 128 bit long, and it provides us a maximum of 2128 addresses. These addresses are known as IPv6 addresses.

IPv4 Addresses (Internet Protocol version 4)

IPv4 address is a 32 bit long. IPv4 is a connectionless protocol that is used in packet-switch layer networks, such as the internet. These addresses are specific and universal. In other words, every address defines one and only one device on the internet. In IPv4, two devices cannot have the same address at the same time.

Important table of IPv4

ClassRangeNetwork bitsHost bitsDefault maskPrivate rangeNo. of private N/WNo of blocks
Class A0-127824255.0.0.010.0.0.0 to 10.255.255.255.2551128
Class B128-1911616255.255.0.0172.16.0.0 to 172.31.255.2551616384
Class C192-223248255.255.255.0192.168.0.0 to 192.168.255.2552562097152
Class D224-239----------------1
Class E239-255-----------------1

IPv4 Datagram Format

Network Layer Logical Address

Address Space

The address space is the overall number of addresses used by the protocol. If N bits are used in the protocol, that means the number of addresses is 2N.

For example, 32 bits are used in the IPv4 address. Which means the address space of IPv4 is 232 or 4,294,967,296.

Notation of IPv4

There are two types of common notation: binary notation and dotted-decimal notation, as shown in the figure below.  

Network Layer Logical Address

Note: Each byte is 8 bits, and each byte range is 0 to 255 in the dotted decimal notation.

Let take an example to better understand binary notation and dotted decimal notation.

Example 1. Change from the binary notation to dotted-decimal notation the following IPv4 addresses.

  • 10000011 00010011 00001011 10000000
  • 10001110 10000001 11000011 10000001

Solution

  • 131.19.11.128
  • 142.129.195.129

Example 2. Change from the dotted-decimal notation to binary notation the following IPv4 addresses.

  1. 128.12.12.248
  2. 192.128.1.250

Solution

  • 10000000 00001100 00001100 00000111
  • 11000000 10000000 00000001 11111010

Example 3. Find the mistakes in the following IPv4 addresses.

  • 124.201.3.1.52
  • 01.200.128.123
  • 300.142.210.64
  • 10110011.32.16.8
  • -31.12.210.128

Solution

  • No more than four numbers can be given.
  • No leading zero is needed in the address (01).
  • Each number must be equivalent to or below 255.
  • The combination of binary notation and dotted-decimal notation is not permitted.
  • Each number must be greater than 0.

Classful Addressing

The address space is split into five classes in the classful addressing: A, B, C, D, and E. If the address is given in the binary notation, the first few bits describe the class. If the address is given in the dotted-decimal notation, the first byte describes the class. Both notation figures are shown below.

Network Layer Logical Address

Let take an example to better understand

Example 1. Find the class of the following IPv4 addresses.

  • 00001010 00110011 11001100 10101000
  • 11101010 11000100 01010001 10101110
  • 135.21.201.12
  • 193.12.12.200

Solution

  • This is the class A address because the first bit is 0.
  • This is the class D address because of the first four bits are 1110.
  • This is the class B address because the first byte is 135.
  • This is the class C address because the first byte is 193.

 

Classless Addresses

Classless addresses were designed to prevent wastage of IP addresses. The block of IPv4 addresses can be defined as a.b.c.d/n. where a.b.c.d represents the address, and n represents the mask, such as 128.12.12.39/27.

Some important points

  • In the block, addresses must be continuous.
  • In the block, the number of addresses must be a power of 2 (1,2,4,8,16...n).
  • The first address must be divisible by the number of addresses.

There are some important rules to find the first, last, and number of addresses in a block. Those rules are given below.

  • You can find the first address of the block by setting 0's to the rightmost 32-n bits.
  • You can find the last address of the block by setting 1's to the rightmost 32-n bits.
  • You can find the number of addresses in the block by using the formula 232-n.

Example 1. Find the first address

  • 195.16.17.30/28
  • 128.12.11.68/26

Solution 1.

The binary representation of the given address is 11000011 00010000 00010001 00011110.

The rightmost 32 - 28 bits to 0's, get 11000011 00010000 00010001 00010000 or 195.16.17.16.

Solution 2.

The binary representation of the given address is 10000000 00001100 00001011 01000100.

The rightmost 32 - 26 bits to 0's, get 10000000 00001100 00001011 01000000 or 128.12.11.64.

Example 2. Find the last address

  • 192.20.20.28/24
  • 128.145.15.10/30

Solution 1.

The binary representation of the given address is 11000000 00010100 00010100 00011100.

The rightmost 32 - 24 bits to 1's, get 11000000 00010100 00010100 11111111 or 192.20.20.255.

Solution 2.

The binary representation of the given address is 10000000 10010001 00001111 00001010.

The rightmost 32 - 30 bits to 1's, get 10000000 10010001 00001111 00001011 or 128.145.15.11.

Example 3. Find the number of addresses

  • 192.20.20.28/24
  • 128.145.15.10/30

Solution 1.

The value of n is 24

The number of addresses of this block is 232-24 or 28 or 256.

Solution 2.

The value of n is 30

The number of addresses of this block is 232-30 or 22 or 4.

Example 4. Find the first address, last address, and the number of addresses. The block address is 11000011 00010000 00010001 00011110, and the mask is 11111111 11111111 11111111 11110000.

Solution. 

The first address can be found by the AND operation apply in the given address with the mask.   

Address                11000011   00010000   00010001   00011110

Mask                    11111111   11111111   11111111   11110000

First address         11000011   00010000   00010001   00010000

The last address can be found by the or operation apply in the given address with the mask.   

Address               11000011   00010000   00010001   00011110

Mask                   00000000   00000000   00000000   00001111

Last address        11000011   00010000   00010001   00011111

You can find the number of addresses by complement the mask and adding 1’s this complement. 

Mask complement is 00000000   00000000   00000000   00001111.

                                    = 15 + 1 = 16.

Datagram

In the IPv4, packets are called datagrams. Datagram format is shown below. 

IPv6 (Internet Protocol version 6)

It is the latest version of IPv4 and has better and enhanced functionality. IPv6 was developed by the IETF (Internet-Engineering-Task-Force) in 1999. It is 128 bits long, which has 2^128 address space, which is much more than IPv4. IPv6 is unique and universally similar to the IPv4. In other words, every address defines only one device on the internet.

Notation of IPv6

IPv6 defines the hexadecimal colon notation, which 128 bits long. These bits are divided into eight sections, which are shown below in the figure.

Network Layer Logical Address
Network Layer Logical Address

IPv6 Datagram Format

Network Layer Logical Address

Difference between the IPv4 and IPv6?

   IPv4                    IPv6
  Address length  IPv4 is 32 bits long.  IPv6 is 128 bits long.
  Developed  It was developed in 1981.  It was developed in 1991.
          Header field  The number of the header field is 12.  The number of the header field is 8.
  Fragmentation  It is done by sender and routers.  It is done by sender only.
  RepresentsIPv4 addresses are a binary number that is displayed in decimal.IPv6 addresses are a binary number that is displayed in hexadecimal.

Related Topics

Supernetting in Network Layer

Introduction Supernetting is one of the main topics in data communication networks or computer networks. The network aggregation goes by many names, such as supernetting, route aggregation, summarization, and so on....

6 minutes read.

Advantages and Disadvantages of MAN

Before we move to advantages and disadvantages of MAN, first we discuss about what is MAN and what are its examples. A network that encircles a city or a sizable university...

3 minutes read.

Mesh Topology Diagram in Computer Network

Topology in simple terms can be defined asthe arrangement of a computer network, which is further divided into logical and physical arrangements. Logical arrangement refers to how the data flow...

4 minutes read.

Application Layer in OSI Model

This article will help you in getting a better understanding of the Application layer in the OSI model. It is the uppermost layer in the OSI Model. The application layer establishes...

4 minutes read.

Hamming Code Example

What is Hamming Code? Hamming code is an error-detecting and error-correcting code used in computer data storage and transmission to detect and correct errors caused by noise, interference, or data corruption....

4 minutes read.

Session Layer and Presentation Layer

Session Layer and Presentation Layer Session Layer The fifth layer is the Session layer in the OSI model, which controls connections between many computers. It manages, establishes, and terminates the session connection...

2 minutes read.

Differences between IPv4 and IPv6

Introduction In this tutorial, we will discuss the basic differences between IPv4 and IPv6 protocols. Definition of Internet Protocols Vint Cerf and Bob Kahn's initial Transmission Control Program had a connectionless datagram service...

4 minutes read.

Fiber Optics and its Types

Fiber Optics is a type of technology that is used to transfer data through the cable with the speed of light. The metal wire is preferred for the transmission of...

3 minutes read.

Computer Network Tutorial

What is Data Communication and Computer Network? Data Communication is the process of exchanging digital data between two or more computers that act as source and receiver through wireless media or...

7 minutes read.

Two Port Network in Computer Networks

A Two Port Network is a four-terminal electric network or circuit with 2 terminals on both sides, each connecting with more circuits or devices. Two terminals together make a port, one...

5 minutes read.

E-mail in Computer Network

E-mail E-mail stands for electronic mail. E-mail is an application layer service in which a user can transfer the messages and information with another user. E-mail is the most popular service...

2 minutes read.

What is Framing in a Computer Network?

In the stream of bits, the data is stored by transmitting the bit by the connection of two devices through cable. This type of connection for data transmission is called...

6 minutes read.

Computer Network Switching

Switching Many numbers of connected devices are called the network. Whenever a company has multiple devices, there has a problem of how to connected them to make the one to one...

5 minutes read.

Network Layer: Logical Address

Network Layer - Logical Address The IP address is a 32 bit long, and it provides us a maximum of 232 addresses. These addresses are known as IPv4 addresses. The IP address...

5 minutes read.

Transmission Mode (Data Flow)

Introduction The exchange of information between two people via a wired or wireless medium is referred to as communication. The OSI (Open System Interconnection) model of computer networks consists of seven...

6 minutes read.

Domain Name System in Computer Network

Domain Name System Domain Name System is also called DNS. DNS was introduced by Paul Mockapetris and Jon Postel in 1983. DNS is an internet service that converts Domain names to...

2 minutes read.

TCP

TCP is a transport layer protocol that helps to establish connections. TCP means Transmission Control Protocol. It guarantees secure data transmission between two network-connected devices. The data can only be...

5 minutes read.

Basic Networking Devices

Introduction Physical components, or network devices, allow hardware on a computer network to link and convey with one another. Network equipment such as switches, routers, gateways, hubs, repeaters, bridges, and routers...

6 minutes read.

Error Correction and Error Detection

Error Correction and Error Detection Error correction and error detection techniques are work on the data-link layer. The data link layer ensures the frames are sent from the sender to the...

16 minutes read.

Advantages and Disadvantages of Fibre Optics Cable

What is Fibre Optics Cable? A fibre optics cable is made of plastic or fibre, which is used to transmit the data. In fibre optics cable, the data is sent along...

3 minutes read.