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) 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.
Classful Addressing
• IPv4 addressing, at its inception, used the concept
of classes. This architecture is called classful
addressing.
• Although this scheme is becoming obsolete, we
briefly discuss it here to show the rationale behind
classless 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.
• A loopback address is a distinct reserved IP address
range that starts from 127.0.0.0 ends at
127.255.255.255 though 127.255.255.255 is the
broadcast address for 127.0.0.0/8.
• The loopback addresses are built into the IP domain
system, enabling devices to transmit and receive
the data packets.
• The loopback address 127.0.0.1 is generally known
as localhost.
• Class A
• IP addresses belonging to class A are assigned to the networks that
contain a large number of hosts.
• The network ID is 8 bits long.
• The host ID is 24 bits long.
• The higher-order bit of the first octet in class A is always set to 0.
• The remaining 7 bits in the first octet are used to determine network ID.
• The 24 bits of host ID are used to determine the host in any network. The
default subnet mask for Class A is 255.x.x.x. Therefore, class A has a total
of:
• 2^24 – 2 = 16,777,214 host ID
• IP addresses belonging to class A ranges from 0.0.0.0 to
127.255.255.255.
Class B
• IP address belonging to class B is assigned to networks that range from
medium-sized to large-sized networks.
• The network ID is 14 bits long.
• The host ID is 16 bits long.
• The higher-order bits of the first octet of IP addresses of class B are
always set to 10.
• The remaining 14 bits are used to determine the network ID.
• The 16 bits of host ID are used to determine the host in any network. The
default subnet mask for class B is 255.255.x.x. Class B has a total of:
• 2^14 = 16384 network address
• 2^16 – 2 = 65534 host address
• IP addresses belonging to class B ranges from 128.0.0.0 –
191.255.255.255.
Class C
• IP addresses belonging to class C are assigned to small-sized
networks.
• The network ID is 24 bits long.
• The host ID is 8 bits long.
• The higher-order bits of the first octet of IP addresses of class C is
always set to 110. The remaining 21 bits are used to determine the
network ID. The 8 bits of host ID are used to determine the host in
any network.
• The default subnet mask for class C is 255.255.255.x. Class C has a
total of:
• 2^21 = 2097152 network address
• 2^8 – 2 = 254 host address
• IP addresses belonging to class C range from 192.0.0.0 –
223.255.255.255.
• Class D
• IP address belonging to class D is reserved
for multi-casting. The higher-order bits of the first
octet of IP addresses belonging to class D is always
set to 1110. The remaining bits are for the address
that interested hosts recognize.
• Class D does not possess any subnet mask. IP
addresses belonging to class D range from
224.0.0.0 – 239.255.255.255.
Classless Inter Domain Routing
(CIDR)
• Classless Inter-Domain Routing (CIDR) is a method of IP
address allocation and IP routing that allows for more
efficient use of IP addresses.
• CIDR is based on the idea that IP addresses can be allocated
and routed based on their network prefix rather than their
class, which was the traditional way of IP address allocation.
• CIDR addresses are represented using a slash notation,
which specifies the number of bits in the network prefix.
• For example, an IP address of 192.168.1.0 with a prefix
length of 24 would be represented as 192.168.1.0/24.
• This notation indicates that the first 24 bits of the IP address
are the network prefix and the remaining 8 bits are the host
identifier.
• Representation:
• It is as also a 32-bit address, which includes a
special number that represents the number of bits
that are present in the Block Id.
Example:
• If the Block size is 25 then, Host Id will contain 5
bits and Network will contain 32 – 5 = 27 bits.
• First IP address of the Block must be evenly
divisible by the size of the block. in simple words,
the least significant part should always start with
zeroes in Host Id. Since all the least significant bits
of Host Id is zero, then we can use it as Block Id
part.
Private Network
• Private IP network is an IP network that is not directly
connected to the Internet
• IP addresses in a private network can be assigned
arbitrarily.
• Not registered and not guaranteed to be globally unique
• Generally, private networks use addresses from the
following experimental address ranges (non-routable
addresses):
• 10.0.0.0 – 10.255.255.255
• 172.16.0.0 – 172.31.255.255
• 192.168.0.0 – 192.168.255.255
65
Private Addresses
66
What is Network Address Translation(NAT)?
• Network Address Translation (NAT) is a process in which
one or more local IP addresses are translated into one or
more Global IP addresses and vice versa to provide Internet
access to the local hosts.
• It also does the translation of port numbers, i.e., masks the
port number of the host with another port number in the
packet that will be routed to the destination.
• It then makes the corresponding entries of IP address and
port number in the NAT table. NAT generally operates on
a router or firewall.
NAT inside and outside
addresses
• Inside refers to the addresses which must be translated. Outside refers to
the addresses which are not in control of an organization. These are the
network Addresses in which the translation of the addresses will be done.
• Inside local address – An IP address that is assigned to a host on the
Inside (local) network. The address is probably not an IP address assigned
by the service provider i.e., these are private IP addresses. This is the
inside host seen from the inside network.
• Inside global address – IP address that represents one or more inside
local IP addresses to the outside world. This is the inside host as seen
from the outside network.
• Outside local address – This is the actual IP address of the destination
host in the local network after translation.
• Outside global address – This is the outside host as seen from the outside
network. It is the IP address of the outside destination host before
translation.
Basic operation of NAT
• NAT device has address translation table
70
Network Address Translation (NAT) Types
There are 3 ways to configure NAT:
• Static NAT
• In this, a single unregistered (Private) IP address is
mapped with a legally registered (Public) IP address i.e
one-to-one mapping between local and global
addresses. This is generally used for Web hosting.
These are not used in organizations as there are many
devices that will need Internet access and to provide
Internet access, a public IP address is needed.
• Suppose, if there are 3000 devices that need access to
the Internet, the organization has to buy 3000 public
addresses that will be very costly.
Dynamic NAT
• In this type of NAT, an unregistered IP address is translated
into a registered (Public) IP address from a pool of public IP
addresses. If the IP address of the pool is not free, then the
packet will be dropped as only a fixed number of private IP
addresses can be translated to public addresses.
• Suppose, if there is a pool of 2 public IP addresses then only
2 private IP addresses can be translated at a given time. If
3rd private IP address wants to access the Internet then the
packet will be dropped therefore many private IP addresses
are mapped to a pool of public IP addresses. NAT is used
when the number of users who want to access the Internet
is fixed. This is also very costly as the organization has to buy
many global IP addresses to make a pool.
Port Address Translation (PAT)
• This is also known as NAT overload. In this, many
local (private) IP addresses can be translated to a
single registered IP address. Port numbers are used
to distinguish the traffic i.e., which traffic belongs
to which IP address. This is most frequently used as
it is cost-effective as thousands of users can be
connected to the Internet by using only one real
global (public) IP address.
Introduction To Subnetting
• When a bigger network is divided into smaller
networks, to maintain security, then that is known
as Subnetting.
• So, maintenance is easier for smaller networks.
• For example, if we consider a class A address, the
possible number of hosts is 224 for each network, it
is obvious that it is difficult to maintain such a huge
number of hosts, but it would be quite easier to
maintain if we divide the network into small parts.
Uses of Subnetting
• Subnetting helps in organizing the network in an
efficient way which helps in expanding the
technology for large firms and companies.
• Subnetting is used for specific staffing structures to
reduce traffic and maintain order and efficiency.
• Subnetting divides domains of the broadcast so
that traffic is routed efficiently, which helps in
improving network performance.
• Subnetting is used in increasing network security.
Note: It is a class C IP so, there are 24 bits in
the network id part and 8 bits in the host id part.
How Does Subnetting Work?
• The working of subnets starts in such a way that
firstly it divides the subnets into smaller subnets.
• For communicating between subnets, routers are
used. Each subnet allows its linked devices to
communicate with each other.
• Subnetting for a network should be done in such a
way that it does not affect the network bits.
• In class C the first 3 octets are network bits so it
remains as it is.
• For Subnet-1: The first bit which is chosen from the
host id part is zero and the range will be from
(193.1.2.00000000 till you get all 1’s in the host ID
part i.e, 193.1.2.01111111) except for the first bit
which is chosen zero for subnet id part
• For Subnet-2: The first bit chosen from the host id
part is one and the range will be from
(193.1.2.100000000 till you get all 1’s in the host ID
part i.e, 193.1.2.11111111).
Network Layer Protocols
1. IP (Internet Protocol)
• IP stands for Internet Protocol. Internet Protocol helps
to uniquely identify each device on the network.
Internet protocol is responsible for transferring the
data from one node to another node in the network.
• Internet protocol is a connectionless protocol therefore
it does not guarantee the delivery of data.
• For the successful delivery higher level protocols such
as TCP are used to guarantee the data transmission.
The Internet Protocol is divided in two types. They are:
• IPV4
• IPV6
2. ARP (Address Resolution Protocol)
• ARP stands for Address Resolution Protocol. ARP is used to convert
the logical address ie. IP address into physical address ie. MAC
address
• If any of the node in a network wants to know the physical address
of another node in the same network, the host then sends an ARP
query packet.
• This ARP query packet consists of IP address and MAC address of
source host and only the IP address of destination host.
• This ARP packet is then received to every node present in the
network.
• The node with its own IP address recognises it and sends it MAC
address to the requesting node. But sending and receiving such
packets to know the MAC address of destination node it increases
the traffic load.
How ARP works
• If the host wants to know the physical address of
another host on its network, then it sends an ARP
query packet that includes the IP address and
broadcast it over the network.
• Every host on the network receives and processes
the ARP packet, but only the intended recipient
recognizes the IP address and sends back the
physical address.
• The host holding the datagram adds the physical
address to the cache memory and to the datagram
header, then sends back to the sender.
Steps taken by ARP protocol
• If a device wants to communicate with another device, the following
steps are taken by the device:
• The device will first look at its internet list, called the ARP cache to check
whether an IP address contains a matching MAC address or not. It will
check the ARP cache in command prompt by using a command arp-a.
• If ARP cache is empty, then device broadcast the message to the entire
network asking each device for a matching MAC address.
• The device that has the matching IP address will then respond back to the
sender with its MAC address
• Once the MAC address is received by the device, then the communication
can take place between two devices.
• If the device receives the MAC address, then the MAC address gets stored
in the ARP cache.
• We can check the ARP cache in command prompt by using a command
arp -a.
RARP
• RARP stands for Reverse Address Resolution
Protocol.
• RARP works opposite of ARP. Reverse Address
Resolution Protocol is used to convert MAC address
ie. physical address into IP address ie. logical
address.
• RARP provides with a feature for the systems and
applications to get their own IP address from a
DNS( Domain Name System) or router. .
4. ICMP
• ICMP stands for Internet Control Message Protocol.
• ICMP is a part of IP protocol suite. ICMP is an error reporting and
network diagnostic protocol.
• Feedback in the network is reported to the designated host. Meanwhile,
if any kind of error occur it is then reported to ICMP. ICMP protocol
consists of many error reporting and diagnostic messages.
• ICMP protocol handles various kinds of errors such as time exceeded,
redirection, source quench, destination unreachable, parameter
problems etc. The messages in ICMP are divided into two types.
• They are given below:
• Error Message: Error message states about the issues or problems that
are faced by the host or routers during processing of IP packet.
• Query Message: Query messages are used by the host in order to get
information from a router or another host.
5. IGMP
• IGMP stands for Internet Group Message Protocol. IGMP is a multicasting
communication protocol. It utilizes the resources efficiently while broadcasting the
messages and data packets.
• IGMP is also a protocol used by TCP/IP. Other hosts connected in the network and
routers makes use of IGMP for multicasting communication that have IP networks.
• In many networks multicast routers are used in order to transmit the messages to
all the nodes.
• Multicast routers therefore receives large number of packets that needs to be
sent.
• But to broadcast this packets is difficult as it would increase the overall network
load.
• Therefore IGMP helps the multicast routers by addressing them while
broadcasting. As multicast communication consists of more than one senders and
receivers the Internet Group Message Protocol is majorly used in various
applications such as streaming media, web conference tools, games, etc.
Routing in Computer Networks
• The term "routing" comes from the word "route",
which means the path used to transport data
packets in computer networks.
• Routing is a procedure of moving data packets from
one network to another by discovering the finest
path from the source to the destination.
• The device that helps in finding the best path to
forward data packets from the source of one
network to the destination of another network is
called a router.
OSPF Protocol
• The OSPF stands for Open Shortest Path First. It is a widely used and supported
routing protocol.
• It is an intradomain protocol, which means that it is used within an area or a
network.
• It is an interior gateway protocol that has been designed within a single
autonomous system.
• It is based on a link-state routing algorithm in which each router contains the
information of every domain, and based on this information, it determines the
shortest path.
• The goal of routing is to learn routes. The OSPF achieves by learning about every
router and subnet within the entire network.
• Every router contains the same information about the network. The way the
router learns this information by sending LSA (Link State Advertisements).
• These LSAs contain information about every router, subnet, and other networking
information. Once the LSAs have been flooded, the OSPF stores the information in
a link-state database known as LSDB. The main goal is to have the same
information about every router in an LSDBs.
• OSPF divides the autonomous systems into areas where
the area is a collection of networks, hosts, and routers.
Like internet service providers divide the internet into a
different autonomous system for easy management
and OSPF further divides the autonomous systems into
Areas.
• Routers that exist inside the area flood the area with
routing information
• In Area, the special router also exists. The special
routers are those that are present at the border of an
area, and these special routers are known as Area
Border Routers. This router summarizes the
information about an area and shares the information
with other areas
• All the areas inside an autonomous system are
connected to the backbone routers, and these
backbone routers are part of a primary area. The
role of a primary area is to provide communication
between different areas.
• How does OSPF work?
• There are three steps that can explain the working of
OSPF:
• Step 1: The first step is to become OSPF neighbors. The
two connecting routers running OSPF on the same link
creates a neighbor relationship.
• Step 2: The second step is to exchange database
information. After becoming the neighbors, the two
routers exchange the LSDB information with each
other.
• Step 3: The third step is to choose the best route. Once
the LSDB information has been exchanged with each
other, the router chooses the best route to be added to
a routing table based on the calculation of SPF.
Types of links in OSPF
• There are four types of links in OSPF:
• Point-to-point link: The point-to-point link directly connects the two routers
without any host or router in between.
• Transient link: When several routers are attached in a network, they are known as
a transient link.
The transient link has two different implementations:
Unrealistic topology: When all the routers are connected to each other, it is known
as an unrealistic topology.
Realistic topology: When some designated router exists in a network then it is
known as a realistic topology. Here designated router is a router to which all the
routers are connected. All the packets sent by the routers will be passed through
the designated router.
• Stub link: It is a network that is connected to the single router. Data enters to the
network through the single router and leaves the network through the same
router.
• Virtual link: If the link between the two routers is broken, the administration
creates the virtual path between the routers, and that path could be a long one
also.
Border Gateway Protocol
• It is an interdomain routing protocol, and it uses
the path-vector routing. It is a gateway protocol
that is used to exchange routing information
among the autonomous system on the internet.
• An autonomous system is a collection of networks that
comes under the single common administrative
domain.
• Or we can say that it is a collection of routers under the
single administrative domain.
• For example, an organization can contain multiple
routers having different locations, but the single
autonomous number system will recognize them.
Within the same autonomous system or same
organization, we generally use IGP (Interior Gateway
Protocol) protocols like RIP, IGRP, EIGRP, OSPF..
• Suppose we want to communicate between two
autonomous systems. In that case, we use EGP (Exterior
Gateway Protocols).
• The protocol that is running on the internet or used to
communicate between two different autonomous
number systems is known as BGP (Border Gateway
Protocol).
• The BGP is the only protocol that is running on the
internet backbone or used to exchange the routes
between two different autonomous number systems.
Internet service providers use the BGP protocol to
control all the routing information
Types of Autonomous systems
• It is a system that contains only one connection from
one autonomous system to another autonomous
system. The data traffic cannot be passed through the
stub autonomous system.
• The Stub AS can be either a source or a sink. If we have
one autonomous system, i.e., AS1, then it will have a
single connection to another autonomous system, AS2.
The AS1 can act either as a source or a sink.
• If it acts as a source, then the data moves from AS1 to
AS2. If AS1 acts as a sink, means that the data gets
consumed in AS1 which is coming from AS2, but the
data will not move forward from AS1.
Path attributes
• As we know that path-vector routing is used in the
border gateway routing protocol, which contains the
routing table that shows the path information. The path
attributes provide the path information. The attributes
that show or store the path information are known as
path attributes.
• 1. Well-known attribute: It is an attribute that should
be recognized by every BGP router.
• 2. Optional attribute: It is an attribute that is not
necessarily to be recognized by every BGP router. In
short, we can say that it is not a mandatory attribute.
•
Types of packets
• There are four different types of packets exist in BGP:
• Open: When the router wants to create a neighborhood relation with
another router, it sends the Open packet.
• Update: The update packet can be used in either of the two cases:
• It can be used to withdraw the destination, which has been advertised
previously.
• It can also be used to announce the route to the new destination.
• Keep Alive: The keep alive packet is exchanged regularly to tell other
routers whether they are alive or not. For example, there are two routers,
i.e., R1 and R2. The R1 sends the keep alive packet to R2 while R2 sends
the keep alive packet to R1 so that R1 can get to know that R2 is alive,
and R2 can get to know that R1 is alive.
• Notification: The notification packet is sent when the router detects the
error condition or close the connection.
Motivation
• Idea: Combine the forwarding algorithm used in
ATM with IP.
MPLS Basics
• Multi Protocol arranged between Label switching
layer2 and layer3
Mobile IP
• Mobile Internet Protocol (Mobile IP) makes it
possible for devices to stay connected to the
internet while moving between different networks.
This technology ensures that your device can
switch from Wi-Fi to cellular data without losing its
connection or needing a new IP address.
• Mobile IP is essential for the seamless and reliable
use of mobile devices, allowing you to stay
connected wherever you go.
Routing in MANET