Lecture 2 - IPv4 Network Addresses Subnetting
Lecture 2 - IPv4 Network Addresses Subnetting
CSE3&5INE
Dr. Rabee Elhdad
At the Network layer, the packets of the
communication need to be identified with the
source and destination addresses
In IPv4, each packet has a 32-bit source
address and a 32-bit destination address in the
Layer 3 header
For convenience, IPv4 addresses are
represented by using dotted decimal format
The IPv4 Classful Addressing Structure (RFC 790)
An IP address has 2 parts:
The network portion
Found on the left side of an IP address
The host portion
Found on the right side of an IP address
Classes of IP addresses are identified by the decimal
number of the 1st octet
Class A address begin with a 0 bit
Range of class A addresses = 0.0.0.0 to 127.255.255.255
Class B address begin with a 1 bit and a 0 bit
Range of class B addresses = 128.0.0.0 to 191.255.255.255
Class C addresses begin with two 1 bits & a 0 bit
Range of class C addresses = 192.0.0.0 to 223.255.255.255.
To define the network and host portions of an address, a devices
use a separate 32-bit pattern called a subnet mask
The subnet mask does not actually contain the network or host
portion of an IPv4 address, it just says where to look for these
portions in a given IPv4 address
Within the address range of each IPv4 network, we have
three types of addresses:
Network address - The address by which we refer to the network
Broadcast address - A special address used to send data to all
hosts in the network
Host addresses - The addresses assigned to the end devices in the
network.
1 AND 1 = 1 1 AND 0 = 0 0 AND 1 = 0 0 AND 0 = 0
Not all organizations' requirements fit well into
one of these three classes
Classful allocation of address space often wasted
many addresses, which exhausted the availability
of IPv4 addresses
Therefore,nowadays, classless addressing is used
With the classless system, address blocks
appropriate to the number of hosts are assigned to
companies or organizations without regard to the
unicast class
Subnetting is the process of segmenting a network into multiple
smaller network spaces called subnetworks or subnets.
Large networks must be segmented into smaller subnetworks,
creating smaller groups of devices and services to:
• Control traffic by containing broadcast traffic within each
subnetwork.
• Reduce overall network traffic and improve network performance.
Communication Between Subnets
A router is necessary for devices on different networks and subnets
to communicate.
Each router interface must have an IPv4 host address that belongs
to the network or subnet that the router interface is connected.
Devices on a network and subnet use the router interface attached
to their LAN as their default gateway.
Borrowing Bits to Create Subnets
Borrowing 1 bit 21 = 2 subnets
Borrowing 1 Bit from the host portion creates 2 subnets with the same subnet mask
Subnet 0 Subnet 1
Network 192.168.1.0-127/25 Network 192.168.1.128-255/25
Mask: 255.255.255.128 Mask: 255.255.255.128
Subnets in Use
Subnet 0
Network 192.168.1.0-127/25
Subnet 1
Network 192.168.1.128-255/25
Calculate number of
subnets
Calculate number of
hosts
Borrowing 2 bits to create 4 subnets. 22 = 4 subnets
Creating 4 Subnets
Borrowing 3 bits to Create 8 Subnets. 23 = 8 subnets
192.168.5.0/24
6 Hosts 10 Hosts
5 Hosts
How many subnets needed ?
How many bits we should borrow ?
192.168.5.0/24
6 Hosts Subnet 2 Subnet 4 10 Hosts
5 Hosts
192.168.5.0
255.255.255.00000000
Subnet mask /27
192.168.5.0/24
30 Hosts 30 Hosts
Subnet 2 Subnet 4
Subnet 1 Subnet 5
Subnet 3
30 Hosts
Subnet 2 Subnet 4
Subnet 1 Subnet 5
Subnet 3
30 Hosts
192.168.5.0
255.255.255.00000000
Subnet mask /27
Total number of host will be 2^5 = 32 total hosts
192.168.5.0/24
14 Hosts Subnet 2 60 Hosts
Subnet 4
Subnet 3 Subnet 5
Subnet 1
30 Hosts
Answer ?????
14 Hosts 192.168.5.0/24 60 Hosts
Subnet 2 Subnet 4
256
For subnet 256 256 256
1
172.16.9.0 \24
255.255.11111111.00000000
195 host required 8 bits
255.255.11111111.00000000
256 host
256 host
For subnet
For subnet 256 256
2
1
172.16.10.0 \24
255.255.11111111.00000000
95 host required 7 bits
255.255.11111111.00000000
Subnet 95 host will have 128 host
Range from
172.16.10.0 - 172.16.10.127 \25
255.255.255.128
64
128
64
128
Classful No No No