Unit 3
Unit 3
Network Addressing
o Network Addressing is one of the major responsibilities of the network layer.
o Network addresses are always logical, i.e., software-based addresses.
o A host is also known as end system that has one link to the network. The
boundary between the host and link is known as an interface. Therefore, the
host can have only one interface.
o A router is different from the host in that it has two or more links that
connect to it.
In the above diagram, we observe that each class have a specific range of IP
addresses. The class of IP address is used to determine the number of bits used in a
class and number of networks and hosts available in the class.
Class A
In Class A, an IP address is assigned to those networks that contain a large number of
hosts.
o The network ID is 8 bits long.
o The host ID is 24 bits long.
In Class A, the first bit in higher order bits of the first octet is always set to 0 and the
remaining 7 bits determine the network ID. The 24 bits determine the host ID in any
network.
o In the above figure, a router has three interfaces labeled as 1, 2 & 3 and each The total number of networks in Class A = 27 = 128 network address
router interface contains its own IP address. The total number of hosts in Class A = 224 - 2 = 16,777,214 host address
o Each host contains its own interface and IP address.
o All the interfaces attached to the LAN 1 is having an IP address in the form
of 223.1.1.xxx, and the interfaces attached to the LAN 2 and LAN 3 have an
IP address in the form of 223.1.2.xxx and 223.1.3.xxx respectively.
o Each IP address consists of two parts. The first part (first three bytes in IP
address) specifies the network and second part (last byte of an IP address) Class B
specifies the host in the network. In Class B, an IP address is assigned to those networks that range from small-sized to
large-sized networks.
Classful Addressing o The Network ID is 16 bits long.
An IP address is 32-bit long. An IP address is divided into sub-classes: o The Host ID is 16 bits long.
o Class A In Class B, the higher order bits of the first octet is always set to 10, and the
o Class B remaining14 bits determine the network ID. The other 16 bits determine the Host ID.
o Class C The total number of networks in Class B = 214 = 16384 network address
o Class D The total number of hosts in Class B = 216 - 2 = 65534 host address
o Class E
An ip address is divided into two parts:
o Network ID: It represents the number of networks.
o Host ID: It represents the number of hosts.
D 1110 Not Defined Not Defined Not Not Defined 224.0.0.0 to 239.255.255.255
Defined
E 1111 Not Defined Not Defined Not Not Defined 240.0.0.0 to 255.255.255.255
Defined
Subnetting in Networking-
1. Fixed Length Subnetting
In networking,
2. Variable Length Subnetting
The process of dividing a single network into multiple sub
1. Fixed Length Subnetting-
networks is called as subnetting.
The sub networks so created are called as subnets. Fixed length subnetting also called as classful subnetting divides the
Example- network into subnets where-
Following diagram shows the subnetting of a big single • All the subnets are of same size.
network into 4 smaller subnets- • All the subnets have equal number of hosts.
• All the subnets have same subnet mask.
2. Variable Length Subnetting-
Variable length subnetting also called as classless subnetting divides the
network into subnets where-
• All the subnets are not of same size.
• All the subnets do not have equal number of hosts.
• All the subnets do not have same subnet mask.
Advantages- Subnetting Examples-
The two main advantages of subnetting a network are- Now, we shall discuss some examples of subnetting a network-
It improves the security. Example-01:
The maintenance and administration of subnets is easy. Consider-
Subnet ID- • We have a big single network having IP Address 200.1.2.0.
Each subnet has its unique network address known as • We want to do subnetting and divide this network into 2 subnets.
its Subnet ID. Clearly, the given network belongs to class C.
The subnet ID is created by borrowing some bits from the Host
ID part of the IP Address.
The number of bits borrowed depends on the number of
subnets created.
Types of Subnetting-
Subnetting of a network may be carried out in the following two ways-
For creating four subnets and to represent their subnet IDs, we require 2
bits. So,
We borrow two bits from the Host ID part.
After borrowing two bits, Host ID part remains with only 6 bits.
Point-01:
Finally, the given single network is divided into 3 subnets having IP Subnetting leads to loss of IP Addresses.
Address- During subnetting,
200.1.2.0 We have to face a loss of IP Addresses.
200.1.2.128 This is because two IP Addresses are wasted for each subnet.
200.1.2.192 One IP address is wasted for its network address.
Other IP Address is wasted for its direct broadcasting address.
For 1st Subnet-
Point-02: Subnetting leads to complicated communication process.
[Unit 3 Notes] By Prof. Narendra Kumar Page 9
After subnetting, the communication process becomes complex involving 2. 4094
the following 4 steps- 3. 4092
1. Identifying the network 4. 4090
2. Identifying the sub network Solution-
3. Identifying the host
Number of bits reserved for network ID in the given subnet mask =
4. Identifying the process
20.
PRACTICE PROBLEMS BASED ON SUBNETTING IN
So, Number of bits reserved for Host ID = 32 – 20 = 12 bits.
NETWORKING-
Thus, Number of hosts per subnet = 212 – 2 = 4094.
Problem-01: In class B, 16 bits are reserved for the network.
So, Number of bits reserved for subnet ID = 20 – 16 = 4 bits.
Suppose a network with IP Address 192.16.0.0. is divided into 2 subnets,
find number of hosts per subnet. Number of subnets possible = 24 = 16.
Thus, Option (B) is correct.
Also for the first subnet, find-
1. Subnet Address
To gain better understanding about IPv4 Subnetting,
2. First Host ID
3. Last Host ID
4. Broadcast Address IP Subnetting
As we talked about before, there are two parts in an IP Address. One for
Solution- them is Network part and the another is Host part. With IP Subnetting,
Given IP Address belongs to class C. we are adding one more part. This is “Subnet Part”. From the Host part,
So, 24 bits are reserved for the Net ID. we borrow some bits and we will use this part for Subnet. In this lesson,
The given network is divided into 2 subnets. we will learn Subnetting with Subnetting Examples.
So, 1 bit is borrowed from the host ID part for the subnet IDs.
Then, Number of bits remaining for the Host ID = 7.
Thus, Number of hosts per subnet = 27 = 128.
CIDR (Classless Inter Domain Routing) is a method of assigning IP CIDR is used on the addresses that will advertise to the internet. So, it is
addresses that improves the efficiency of address distribution and replaces used in the Internet Service Provider part. VLSM is used in a company or
the previous system based on Class A, Class B and Class C networks. in smaller networks to use IP address spaces ideally.
The CIDR number is typically preceded by a slash “/” and follows the IP VLSM (Variable Length Subnet Mask) is the term that is used for using
address. For example, an IP address of 131.10. 55.70 with a subnet mask different Subnet Mask for different sun networks. In other words, it is the
of 255.0. 0.0 (which has 8 network bits) would be represented as 131.10. mechanism that allows different Subnet Masks and provide division of a
network into sub networks. It is like Subnet of subnets.
What is a CIDR of 24?
Special Subnets
0.15 and the /24 CIDR, for example. 192.168. 0.15 defines the address
prefix, and /24 defines the number of bits reserved for the netmask. This In Subnetting some Subnet Masks are used specifically sometimes. These
means that the first 24 bits of the IP address are reserved for network are /24, /30, /31/ and /32.
routing.
What is 255.255 255.0 CIDR? • /24 is the Subnet Mask that is usually used in the local networks by
default.
The subnet mask 255.255. 255.0 translates to /24 in CIDR-speak, as 24 • /32 is the Subnet Mask used generally on Loopback and System
bits are used for the network. That leaves 8 bits / 256 IPs for nodes. interfaces.
In CIDR notation, IP addresses are written as a prefix, and a suffix is • /31 is the Subnet Mask used on point-to-point links.
attached to indicate how many bits are in the entire address. The suffix is • /30 is also widely used in Service Provider Networks for point-to-
set apart from the prefix with a slash mark. For instance, in the CIDR point connections.
notation 192.0. 1.0/24, the prefix or IP address is 192.0.
Loopback Interface is the “virtual” interfaces. There can be many
Loopback interfaces in a Router. Loopback Interfaces are used for its
Think about 172.16.100.0/24 prefix and 172.16.100.0/28 prefix. As you This is for the first network. We divide the network by using higher
can see, the only difference is Subnet Mask. In the first prefix, first 24 bits Subnet Mask. So, let’s look at the other networks:
is network bits and the last 8 bits (32-24) are the host bits. In the second
prefix, first 28 bits are network bits and the last 4 bits (32-28) are host 10101100.00010000.01100100.00010000
bits. 10101100.00010000.01100100.00100000
10101100.00010000.01100100.00110000
Let’s firstly talk about the first Prefix. We will write the IP Address and 10101100.00010000.01100100.01000000
the Subnet Mask of this Prefix in binary format: ….
10101100.00010000.01100100.11110000
172.16.100.0 = 10101100.00010000.01100100.00000000
255.255.255.0 =11111111.11111111.11111111.00000000 As you can see, we have 16 networks. We have divided a Prefix, into
smaller 16 different Prefixes. Each of these Prefix has 14 host
address, 1 broadcast address and 1 network address.
ICMP
o ICMP stands for Internet Control Message Protocol.
o The ICMP is a network layer protocol used by hosts and routers to send the
notifications of IP datagram problems back to the sender.
o ICMP uses echo test/reply to check whether the destination is reachable and
responding.
o ICMP handles both control and error messages, but its main function is to o Destination unreachable: The message of "Destination Unreachable" is
report the error but not to correct them. sent from receiver to the sender when destination cannot be reached, or
o An IP datagram contains the addresses of both source and destination, but it packet is discarded when the destination is not reachable.
does not know the address of the previous router through which it has been o Source Quench: The purpose of the source quench message is congestion
passed. Due to this reason, ICMP can only send the messages to the source, control. The message sent from the congested router to the source host to
but not to the immediate routers. reduce the transmission rate. ICMP will take the IP of the discarded packet
o ICMP protocol communicates the error messages to the sender. ICMP and then add the source quench message to the IP datagram to inform the
messages cause the errors to be returned back to the user processes. source host to reduce its transmission rate. The source host will reduce the
o ICMP messages are transmitted within IP datagram. transmission rate so that the router will be free from congestion.
o Time Exceeded: Time Exceeded is also known as "Time-To-Live". It is a
parameter that defines how long a packet should live before it would be
discarded.
There are two ways when Time Exceeded message can be generated:
Routing
o A Router is a process of selecting path along which the data can be
transferred from source to the destination. Routing is performed by a special
device known as a router.
o A Router works at the network layer in the OSI model and internet layer in
TCP/IP model
Routing algorithm
the administrator.
o In this technique, routing decisions are not made based on the condition or
topology of the networks o In order to transfer the packets from source to the destination, the network
Advantages Of Static Routing layer must determine the best route through which packets can be
Following are the advantages of Static Routing: transmitted.
o No Overhead: It has ho overhead on the CPU usage of the router. o Whether the network layer provides datagram service or virtual circuit
Therefore, the cheaper router can be used to obtain static routing. service, the main job of the network layer is to provide the best route. The
o Bandwidth: It has not bandwidth usage between the routers. routing protocol provides this job.
o Security: It provides security as the system administrator is allowed only to o The routing protocol is a routing algorithm that provides the best path from
have control over the routing to a particular network. the source to the destination. The best path is the path that has the "least-
cost path" from source to the destination.
o Routing is the process of forwarding the packets from source to the
Default Routing destination but the best route to send the packets is determined by the
o Default Routing is a technique in which a router is configured to send all the routing algorithm.
packets to the same hop device, and it doesn't matter whether it belongs to a
particular network or not. A Packet is transmitted to the device for which it
is configured in default routing. Classification of a Routing algorithm
o Default Routing is used when networks deal with the single exit point. The Routing algorithm is divided into two categories:
o It is also useful when the bulk of transmission networks have to transmit the o Adaptive Routing algorithm
data to the same hp device. o Non-adaptive Routing algorithm
o When a specific route is mentioned in the routing table, the router will
choose the specific route rather than the default route. The default route is
chosen only when a specific route is not mentioned in the routing table.
Dynamic Routing
o It is also known as Adaptive Routing.
o It is a technique in which a router adds a new route in the routing table for
each packet in response to the changes in the condition or topology of the
network.
o Dynamic protocols are used to discover the new routes to reach the
destination.
o In Dynamic Routing, RIP and OSPF are the protocols used to discover the
new routes.
o If any route goes down, then the automatic adjustment will be made to reach
the destination. Adaptive Routing algorithm
The Dynamic protocol should have the following features: o An adaptive routing algorithm is also known as dynamic routing algorithm.
o All the routers must have the same dynamic routing protocol in order to o This algorithm makes the routing decisions based on the topology and
exchange the routes. network traffic.
o If the router discovers any change in the condition or topology, then router o The main parameters related to this algorithm are hop count, distance and
broadcast this information to all other routers. estimated transit time.
o After adjustment, A then combines this table with its own table to create a
combined table.
o NET ID: The Network ID defines the final destination of the packet.
o Cost: The cost is the number of hops that packet must take to get there.
o Next hop: It is the router to which the packet must be delivered.
o The combined table may contain some duplicate data. In the above figure,
the combined table of router A contains the duplicate data, so it keeps only
those data which has the lowest cost. For example, A can send the data to
network 1 in two ways. The first, which uses no next router, so it costs one
hop. The second requires two hops (A to B, then B to Network 1). The first
option has the lowest cost, therefore it is kept and the second one is
dropped.
o In the above figure, the original routing tables are shown of all the routers.
In a routing table, the first column represents the network ID, the second
column represents the cost of the link, and the third column is empty.
o These routing tables are sent to all the neighbors.
For Example:
1. A sends its routing table to B, F & E.
2. B sends its routing table to A & C.
3. C sends its routing table to B & D.
4. D sends its routing table to E & C. o The process of creating the routing table continues for all routers. Every
5. E sends its routing table to A & D. router receives the information from the neighbors, and update the routing
6. F sends its routing table to A. table.
Final routing tables of all the routers are given below:
Updating the Table
[Unit 3 Notes] By Prof. Narendra Kumar Page 22
o The Dijkstra's algorithm is an iterative, and it has the property that after
kth iteration of the algorithm, the least cost paths are well known for k
destination nodes.
Let's describe some notations:
o c( i , j): Link cost from node i to node j. If i and j nodes are not directly
linked, then c(i , j) = ∞.
o D(v): It defines the cost of the path from source code to destination v that
has the least cost currently.
o P(v): It defines the previous node (neighbor of v) along with current least
cost path from source to v.
o N: It is the total number of nodes available in the network.
Algorithm
Initialization
N = {A} // A is a root node.
4 ADE 3,E 4,E The encapsulated data is referred to as IP Payload. IP header contains all
B
the necessary information to deliver the packet at the other end.
5 ADE 4,E
BC
Security In IPv4, security In IPv6, IPSEC is Congestion control refers to techniques and mechanisms that can either
features depends on the developed for security prevent congestion, before it happens, or remove congestion, after it has
application. This IP purposes. happened.
address is not
developed in keeping
the security feature in
mind.
Transmission IPv4 is broadcasting. On the other hand, IPv6 In open-loop congestion control, policies are applied to prevent
scheme is multicasting, which congestion before it happens. In these mechanisms, congestion control is
provides efficient handled by either the source or the destination.
network operations.
a. Retransmission Policy
Encryption and It does not provide It provides encryption Retransmission is sometimes unavoidable. If the sender feels that a sent
Authentication encryption and and authentication.
packet is lost or corrupted, the packet needs to be retransmitted.
authentication.
c. Acknowledgment Policy
The acknowledgment policy imposed by the receiver may also affect
congestion. If the receiver does not acknowledge every packet it receives,
it may slow down the sender and help prevent congestion.
c. Implicit Signaling
d. Discarding Policy In implicit signaling, there is no communication between the congested
A good discarding policy by the routers may prevent congestion and at node or nodes and the source. The source guesses that there is congestion
the same time may not harm the integrity of the transmission. somewhere in the network from other symptoms.
Closed-loop congestion control mechanisms try to alleviate congestion A bit can be set in a packet moving in the direction opposite to the
after it happens. Several mechanisms have been used by different congestion. This bit can warn the source that there is congestion and that
protocols. it needs to slow down to avoid the discarding of packets.
If a leaky bucket algorithm is used, the data flow will be 8 Mbps for 9
seconds. Thus constant flow is maintained.