Network Layer
• What is a Network?
➢ Α network is simply defined as something that connects things together
for a specific purpose.
➢ The term network is used in a variety of contexts, including telephone,
television, computer, or even people networks.
➢ A computer network connects two or more devices together to share a
nearly limitless range of information and services, including:
Documents, Email and messaging, Websites, Databases, Music, Printers
and faxes, telephony and videoconferencing, etc
1
Network Structure
• Network Structure can be presented as either:
1. Nonhierarchical network
2. Hierarchical network
2
Nonhierarchical network Devices
▪ Large collision domain (info
from one device could
collide with info from
another device)
▪ Large broadcast domain
(info from one device is
kept separate from info
sent to another device)
▪ High latency
▪ Difficult to troubleshoot
3
Hierarchical network Devices
4
IP addressing
5
Anatomy of an IP address
• The IP address is a 32-bit address that consists
of two components
1. The Network Portion consisting of network
bits: The left portion of the address
2. The Host portion consisting of the host bits:
The right portion of the address
6
32-bit IP Address
32-bit IP Address
Network Bits Host Bits
7
The Mask
• The network portion of the address is separated from the host
portion by the Mask
• The mask simply indicates how many bits are used for the
network portion, leaving the remaining portion for the host
portion
• Examples include;
• 24 bit mask indicates that the first 24 bits of the address are
network bits, while the remaining 8 bits are host bits
• 16 bit mask indicates that the first 16 bits of the address are
network bits, while the remaining 16 bits are host bits
• etc
8
Revision(Binary and Decimal Math)
9
Dotted Decimal Notation
10
Primary Address Classes
• To provide the flexibility required to support
networks of varying sizes, the Internet designers
decided that the IP address space should be
divided into three address classes:
➢ Class A
➢ Class B
➢ Class C
• This is often referred to as classful addressing.
11
Principle Classful IP Address Formats
12
Class A Networks (/8 Prefixes)
• Each Class A network address has an 8-bit network
prefix, with the highest order bit set to 0 (zero) and a
7-bit network number, followed by a 24-bit host
number.
• The highest number that can be represented is
01111111, decimal 127. The numbers 0 and 127 are
reserved and cannot be used as network addresses.
• Any address that starts with a value between 1 and 126
in the first octet is a Class A address.
13
Class B Networks (/16 Prefixes)
• Each Class B network address has a 16-bit network
prefix, with the two highest order bits set to 1-0 and a
14-bit network number, followed by a 16-bit host
number.
• The lowest number that can be represented with a
Class B address is 10000000, decimal 128. The highest
number that can be represented is 10111111, decimal
191.
• Any address that starts with a value in the range of 128
to 191 in the first octet is a Class B address.
14
Class C Networks (/24 Prefixes)
• Each Class C network address has a 24-bit network
prefix, with the three highest order bits set to 1-1-0
and a 21-bit network number, followed by an 8-bit
host number.
• A Class C address begins with binary 110. Therefore,
the lowest number that can be represented is
11000000, decimal 192. The highest number that can
be represented is 11011111, decimal 223.
• If an address contains a number in the range of 192 to
223 in the first octet, it is a Class C address.
15
Other Classes
• In addition to the three most popular classes,
there are two additional classes:
➢Class D
➢Class E
16
Class D
• Class D addresses have their leading four bits set to 1-
1-1-0 and are used to support IP Multicasting
(transmission addressed to a group of destination
simultaneously , can be one to many or many to many
distribution).
• The first four bits of a Class D address must be 1110.
Therefore, the first octet range for Class D addresses is
11100000 to 11101111, or 224 to 239.
• An IP address that starts with a value in the range of
224 to 239 in the first octet is a Class D address.
17
Class E
• Class E addresses have their leading four bits set to 1-1-1-1
and are reserved for experimental use.
• A Class E address has been defined. However, the Internet
Engineering Task Force (IETF) reserves these addresses for
its own research.
• Therefore, no Class E addresses have been released for use
in the Internet.
• The first four bits of a Class E address are always set to 1s.
Therefore, the first octet range for Class E addresses is
11110000 to 11111111, or 240 to 255.
18
Subnetting
Benefit of Subnetting
• Reduced network traffic
➢ One network will not access the data of other network without the use
of router. Thus we can reduce the amount of data remain in one network.
Less data less overhead, collision, or broadcast storm.
• Optimized network performance
➢ This is a result of reduced network traffic.
• Simplified management
➢ It's easier to identify and isolate network problems in a group of Smaller
connected networks than within one gigantic network
19
Subnetting Components
20
Subnetting Components
21
Subnetting Components
22
Subnetting Components
4. Block Size
• The spacing between these subnets, or how
many IP addresses apart they are, is called
the Block Size.
23
Subnetting Components
24
Subnetting Components
25
Subnetting Components
26
Method of Subnetting
• There are several method of subnetting. Different
author different approach to calculate the subnets.
• You should choose the method you can understand
and perform subnetting easily.
• Whatever approach you choose need conversion of
decimal to binary.
27
Example
• The IP address [Link] is
represented in binary as
10001010.01100101.01110010.11111010
• The subnet mask of [Link] is
represented in binary as
11111111.11111111.11111111.11100000
28
Practical approach of subnetting
• When faced with a subnetting question, the first
thing to do is decide what class the address belongs
to.
• For example given an IP address :[Link]
• The first octet is between 192 and 223 so it is a Class
C address
• Default mask for Class C: is [Link]
29
Cont’d
• Write down the default side of IP (Network
bits) as it is
• Reset of part where actual subnetting will
perform in binary (Host Bits)
• 192.168. 1 .00000001
• 255.255.255.00000000 (default mask)
30
Step 1:- calculate the CIDR value
• CIDR are the on bit(1s) in subnet mask.
• As you can see in our example we have on bit
only in default side.
255.255.255.00000000
So our CIDR value is 24 + 0 = 24
31
Step 2:- calculate the Subnet mask
• To calculate the subnet mask use the binary to
decimal chart.
• Add the decimal place value of on network bit.
<==H bit
• 255.255.255.00000000
N bit==>
• In our example we are using on default mask so our
subnet mask will be [Link] 32
Step 3:- calculate the Total Host
• To calculate the total host count the H bit and
use this formula;
Total host = 2H
<==H bit
• 255.255.255.00000000
• Total host = 28 = 256
33
Step 4:- calculate the Valid Host
34
Step 5:- calculate the Network
35
Step 6:- Find out the block Size
• Finding block size is very easy just subtract the
subnet mask from 256
• 256 – Subnet mask (only the last octal, don't
include the default subnet mask)
• 256 - 0 = 256
36
Step 7:- Write down the subnet chart
CIDR Value /24 IP Subnetmask
Net ID [Link] [Link]
First Valid Host [Link] [Link]
Last Valid Host [Link] [Link]
Broadcast ID [Link] [Link]
37
EXAMPLE 2
• Given IP address:
[Link]/25
38
Step 1:- calculate the CIDR value CIDR
39
Step 2:- calculate the Subnet mask
40
Step 3:- calculate the Total Host
• Total host = 2H
<==H bit
• 255.255.255.10000000
• Total host = 27 = 128
41
Step 4:- calculate the Valid Host
• Subtract 2 from Total host
• Total host - 2
• 128 -2 = 126
42
Step 5:- calculate the Network
• To calculate the Network count the N bit and
use this formula
N bit==>
• 255.255.255.10000000
• Network = 21
• Network = 21 = 2
43
Step 6:- Find out the block Size
• 256 – Subnet mask (only the last octal, don't
include the default subnet mask)
• 256 - 128 = 128
44
Exercises on Subnetting
• What is the Network ID of the network
[Link]/27 belongs to?
• What is the broadcast address of the network
[Link] [Link]?
• What is the Subnet Mask corresponding to a
shorthand of /11?
45
Exercises on Subnetting
Given IP address: [Link]/26
✓Compute the subnet mask for this IP.
✓What are the total hosts?
✓How many are valid?
✓What is the Broadcast ID?
✓What are the First and Last Usable IPs?
46