Computer Network Tutorial

Introduction of Computer Network Types of Computer Network Network Topology Computer Networking Architecture Transmission Modes (Data Flow) Basic Networking Devices Integrate Services Digital Network (ISDN)

Model

OSI Model TCP/IP Model

Physical Layer

Digital Transmission Analog Transmission Transmission Media Switching

Data Link Layer

Error detection and Error correction Data Link Control Multiple Access Aloha

Network Layer

Network Layer - Logical Address Address Mapping Unicast Routing Protocol

Transport Layer

Process to Process Delivery User Datagram Protocol Transmission Control Protocol Stream Control Transmission Protocol Session Layer and Presentation Layer

Application Layer

Domain Name System Application Protocol E-mail Cryptography

Misc

Classes of Routing Protocols Classification of Routing Algorithms Controlled Access Protocols in Computer Networks Differences between IPv4 and IPv6 Fixed and Flooding Routing Algorithms Advantages and Disadvantages of Fibre Optics Cable APIPA Difference between Active and Passive FTP Fiber Optics and its Types Method of Joining and Fusion of Fiber Optic Cable Define Framing in Computer Network Disadvantages of Computer Network Mesh Topology Diagram in Computer Network Ring Topology in Computer Network Star Topology in Computer Networks 4G Mobile Communication Technology Advantages and Disadvantages of LAN Advantages and Disadvantages of MAN Advantages and Disadvantages of WAN Application Layer in OSI Model Cyclic Redundancy Check Example Data link layer in OSI model Difference between Transport and Network Layer Hamming Code Example Network Layer in OSI Model Session Layer in OSI Model Transport Layer in OSI Model Two Port Network in Computer Networks Uses of Computer Networks What is Computer Network What is Framing in a Computer Network Advantages and Disadvantages of Bus Topology Difference between Star Topology and Bus Topology Subnetting in Computer Network Subnetting Questions and Answers What is Bus Topology What is Network Topology and Types in Computer Networks Access Control in Networking Basic Characteristics of Computer Network Benefits of SOCKS5 Proxy in Computer Networks Computer Network viva Questions Difference between BOOTP and RARP Difference Between Network Topologies and Network Protocols Difference between NFC and RFID Difference Between Point-to-Point Link and star Topology Network Differences Between MSS and MTU Differences Between Trunk Port and Access Port Different Modes of Communication in Computer Networks MIME Protocol in Computer Networks Modes of Communication in Computer Networks Network Attack in Computer Network Port Address in Networking Simplest Protocol in Computer Network Sliding Window Protocol in Computer Network Stop And Wait Protocol in Computer Networks TCP 3-Way Handshake Process in Computer Networks What is a Proxy Server What is APPN What is ICMP Protocol What is Point-to-Point Protocol What is Port Address in Networking What is the HDLC Protocol What is VRRP Protocol Difference Between Analog and Digital Signals Difference Between Hub and Repeater Difference between Repeater and Switch Difference Between Transparent Bridge and Source Routing Bridge Source Routing Bridge in Computer Networks Transparent Bridge in Computer Networks Transport Protocol in Computer Networks Types of CSMA in Computer Networks What is Wired and Wireless Networking Network Security in Computer Network Disadvantages of Extranet Difference Between TELNET and FTP Define Protocol in Computer Networks Guided Transmission Media in Computer Network What is a Gateway in a Computer Network IGMP in Computer Networks LAN Protocols in Computer Networks MAN Meaning in Computer Modulation Techniques in Computer Networks Switching in DCN TCP/IP Applications What is IGMP? What is Modem in Networking What is Non-Persistent CSMA Difference between Cell Splitting and Cell Sectoring Forouzen Computer Network

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.