Chapter 5. IP Addressing and Subnetting
Chapter 5. IP Addressing and Subnetting
6
IP Configuration of an Interface
7
IP Addressing
8
IP Addressing Schemes.
9
IP Addressing Schemes.
Binary Notation: Base 2
In binary notation, an IPv4 address is
displayed as 32 bits.
An IPv4 address referred to as a 32-bit
address, a 4-octet address (8 bits in
each).
Example of an IPv4 address in binary
notation
01110101 10010101 00011101 11101010
10
IP Addressing Schemes
Dotted-Decimal Notation: Base 10
For us in the human network, a string of 32
bits is difficult to interpret and even more
difficult to remember.
Therefore, IPv4 addresses are represented
using dotted decimal format.
11
IP Addressing Schemes
Solution
129.11.11.239
13
IP Addressing Schemes
Change the following IP address from
dotted-decimal notation to binary notation:
111.56.45.78
Solution
14
IP Addressing Schemes
Find the error in the following IP Address
111.56.045.78
Solution
15
IP Addressing Schemes
Find the error in the following IP Address
75.45.301.14
Solution
16
Address Space Rule
18
Network Address and Host Address
• The NETWORK PORTION, which
describes the physical wire the device is
attached to.The address by which we
refer to the network
19
Portion of an IP Address
IP Address as a 32-Bit Binary Number
20
CLASSFUL ADDRESSING
At the Network layer, the packets of the
communication need to be identified with the
source and destination IP addresses of the two
end systems
26
Class B Addresses
The first bit of the first byte must always be turned on, but the
second bit must always be turned off. (starts with 10)
If you turn the other 6 bits all OFF and then all ON, you will find
the range for a Class B network:
First Octet 10
Range: 10000000 - 10111111
Range: 128-191
A Class B network ranges from 128 to 191.
Network Network HOST HOST
Default Subnet mask 255.255.0.0
214 = 16,384 network address
216 – 2 = 65,534 host address
Example of Class B address: 145.24. 53.107
27
Class C IP address
For the smaller network this IP address class is used.
In this class three octets are used to identify the
network.
This IP ranges between 192 to 223 (range 192.0.0.0-
to-223.255.255.255).
A local area network use Class C IP address to
connect with network.
Address begins with bits 110.
It has 24 bit network number and 8 bit host number.
28
Class C Addresses
The first 2 bits of the first octet as always turned on, but
the third bit can never be on.
Following the same process as the previous classes, convert
from binary to decimal to find the range.
First Octet
Range: 11000000 -11011111
Range: 192- 223
NETWORK NETWORK NETWORK HOST
Default Subnet 255.255.255.0
221 = 2,097,152 network address
28 – 2 = 254 host address
Example of Class C address 195.24.53.107
29
Default mask
Class A 255.0.0.0 or (/8)
Class B 255.255.0.0 or (/16)
Class C 255.255.255.0 or (24)
30
Class D IP address
Class D addresses are used for multicasting;
There is only one block in this class.
Begins with 1110 in the first octet
Multicast addresses (Class D):
(224.0.0.0 to 239.255.255.255)
Class D ranges from (224–239) and is used
for multicast addresses
31
Class E IP address
This type of IP address class is mostly used
for the experimental or future use.
There is only one block in this class.
Class E ranges from (240 to 255) for scientific
purposes
(240.0.0.0 to 255.255.255.255)
Begins with 1111, unused
32
Show that Class A has
33
Classful Addressing
34
Classes in binary notation
35
Example
36
Classes in Decimal notation
37
Example
Find the class of the following addresses
158.223.1.108
227.13.14.88
Solution
158.223.1.108
1st byte = 158 (128<158<191) class B
227.13.14.88
1st byte = 227 (224<227<239) class D
38
Netid and hostid
39
Hosts for Classes of IP Addresses
40
IP Addresses as Decimal Numbers
41
Reserved IP addresses
Expressed in dotted decimal format, the IPv4 address
range is from:
0.0.0.0 to 255.255.255.255
42
Class D- Multicast Addresses
A block addresses (Class D) is reserved for special
purposes (multicast address). It ranges from
224.0.0.0 to 239.255.255.255
This address is reserved for link local addresses.
These addresses are to be used for multicast groups
on a local network.
A router connected to the local network should
never forward them.
43
Class E- Experimental Addresses
Class E addresses are special address reserved for
experimental purposes
It ranges from:
240.0.0.0 to 255.255.255.254
Currently, these addresses are listed as reserved for
future use.They cannot be used in IPv4 networks.
These addresses could be used for research or
experimentation.
44
Special Addresses
After accounting for the ranges reserved for
experimental addresses and multicast
addresses, this leaves an address range of
0.0.0.0 to 223.255.255.255 that could be
used for IPv4 hosts.
However, within this range are many addresses
that are already reserved for special purposes.
45
Private Addresses
Although most IPv4 host addresses are public
addresses designated for use in the Internet, there
are blocks of addresses that are used in networks that
require limited or no Internet access.
These addresses are called private addresses.
10.0.0.0 to 10.255.255.255 – Class A
172.16.0.0 to 172.31.255.255 Class B
192.168.0.0 to 192.168.255.255 Class C
46
47
Private Addresses
Private addresses are set aside for use in private
networks.
The use of these addresses need not be unique among
outside networks.
Hosts that do not require access to the Internet at
large may make unrestricted use of private addresses.
Private IP address of a system is the IP address that is
used to communicate within the same network.
Using private IP data or information can be sent or
received within the same network.
48
Public Addresses
The vast majority of the addresses in the IPv4
unicast host range are public addresses.
Public IP address of a system is the IP address
which is used to communicate outside the
network.
Public IP address is basically assigned by the ISP
(Internet Service Provider)
These addresses are designed to be used in hosts
that are publicly accessible from the Internet.
49
Loopback / localhost
54
Network Addresses
Given the network address, we can find the class of the
address, the block, and the range of the addresses in
the block
Example: the network address is 132.21.0.0
find:
the class,
the block, and
the range of the addresses
The 1st byte is between 128 and 191. Hence, Class B
The block has a network address (Net-id) of 132.21.
The addresses range from (132.21.0.0 -132.21.255.255)
55
Network Addresses
10.50.120.7 –this is a Class A address,
the first number (10) represents the network part, while
the remainder of the address represents the host part
(50.120.7).
This means that, in order for devices to be on the same
network, the first number of their IP addresses has to be
the same for both devices.
In this case, a device with the IP address of 10.47.8.4 is on
the same network.
The device with the IP address 11.5.4.3 is not on the
same network, because the first number of its IP address
is different.
56
Network Addresses
Consider the following IP addresses:
172.16.55.13 – this is a Class B address,
The first two numbers (172.16) represent
the network part, while the remainder of the
address represents the host part (55.13).
A device with the IP address of
172.16.254.3 is on the same network,
while a device with the IP address of
172.55.54.74 isn’t.
57
Broadcast Address
Broadcast address is a special address for each network that
allows communication to all the hosts in that network.
To send data to all hosts in a network, a host can send a
single packet that is addressed to the broadcast address of
the network.
The broadcast address uses the highest address in the
network range. This is the address in which the bits in the
host portion are all 1s.
For the network 10.0.0.0 with network bits, the broadcast
address would be 10.255.255.255. This address is also
referred to as the directed broadcast.
58
Host Addresses
Every end device requires a unique address to
deliver a packet to a host.
In IPv4 addresses, we assign the host address
values between the network address and the
broadcast address to the devices in that network.
All 32 bits define the IPv4 address, there are a
variable number of bits that are called the host
portion of the address.
59
Network Prefixes
When we express an IPv4 network address, we
add a prefix length to the network address.
The prefix length is the number of bits in the
address that gives us the network portion.
For example, in 172.16.4.0 /24, the /24 is the
prefix length - it tells us that the first 24 bits are
the network address. This leaves the remaining 8
bits, the last octet, as the host portion
60
Network Prefixes
The Subnet masks in 172.16.4.0 /24 can also be
represented as 255.255.255.0 or
11111111 11111111 11111111 00000000
which is equivalent to /24
Network prefix specifies the network portion of an
IPv4 address to the network devices.
172.16.4.0 /16 is the same as 255.255.0.0
11111111 11111111 00000000 00000000
61
Calculating
Network, Host, and Broadcast addresses
Given the address 172.16.20.25. calculate the
NA, HA, and BA addresses
Network address: 172.16.0.0
62
Cont’d
How many hosts can be represented in a
network /24?
11111111 11111111 11111111 00000000
64
Classless IP Addressing
Classless addressing is an improved IP Addressing
system.
It makes the allocation of IP addresses more efficient.
It replaces the older classful addressing system based on
classes.
It is also known as Classless Inter-Domain Routing
(CIDR)
The number of bits used for the network
portion of an IP address became variable
instead of fixed.
65
Subnet Mask
Subnet mask determines which part of an IP address is
the Network Field and which part is the Host Field
Follow these steps to determine the subnet mask:
1. Express the subnetwork IP address in binary
form.
2. Replace the network and subnet portion of
the address with all 1s and the host portion of
the address with all 0s.
3. Convert the binary expression back to dotted-
decimal notation.
66
Subnet Mask
67
Subnet Mask
• A subnet mask is a 32-bit binary number.
• The subnet mask is ANDed with an IP address to get
the block address (Network address)
Mask And IP address = Block Address
68
AND operation
69
Default Mask and Subnet Mask
70
Finding the Subnet Address
What is the subnetwork address if the destination
address is 200.45.34.56 and the subnet mask is
255.255.240.0?
72
Calculating Network, Host and
Broadcast addresses
Given the address 172.16.20.0 /25
Network address:
10101100 00010000 00010100 00000000 thus 172.16.20.0
First host:
10101100 00010000 00010100 00000001 thus 172.16.20.1
Last host address
10101100 00010000 00010100 01111110 thus 172.16.20.126
Broadcast address:
10101100 00010000 00010100 01111111 thus 172.16.20.127
73
74
Calculating Network, Host and
Broadcast addresses
1. Given the address 191.30.168.213/29
calculate the BA, NA, HA, and number of hosts
represented.
2. 192.168.1.25/27
Calculate NA, HA and BA
75
Subnetting
The process of splitting a network into smaller
networks is called subnetting.
The smaller networks formed are known as
subnets
If you break a major network (Class A, B, or C)
into smaller subnetworks, it allows you to
create a network of interconnecting
subnetworks.
76
Subnetting
In order to subnet a network, extend the subnet mask
using some of the bits from the host ID portion of
the address to create a subnetwork ID (address).
Subnetting allows you to create multiple logical
networks (subnets) that exist within a single Class A,
B, or C network.
If you do not subnet, you are only able to use one
network from your Class A, B, or C network, which is
unrealistic.
What happens if you wanted to take one
network address and create six networks from
it?
77
Subnetting
Subnets are connected to the rest of the network
through address-resolving devices called routers.
NAT (network address translation) is a way to map
multiple local private addresses to a public one before
transferring the information.
Subnets can be freely assigned within the
organization
Internally, subnets are treated as separate networks
Subnet structure is not visible outside the
organization
78
Advantages of Subnetting
Improves efficiency of IP addresses by not consuming
an entire address space for each physical network.
Reduces router complexity. Since external routers do
not know about subnetting, the complexity of routing
tables at external routers is reduced.
Reduced network traffic
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
79
How to create subnets
To create a subnet address, a network administrator
should borrow bits from the original host portion
and designates them as the subnet field.
A network with no subnets will have one of these
default subnet mask values depending upon its class
address.
However, when subnetting is implemented, the actual
subnet mask value is calculated to determine valid IP
addresses for hosts on a subnet.
80
Basic Idea of Subnetting
Split the host number portion of an IP address into a
subnet number and host number.
Result is a 3-layer hierarchy
81
Subnetting Example
193.16.4.0 /24 divide it into four networks
First Subnet
00 000000 = 0 The network address (do this first)
00 000001 = 1 The first valid host
00 111110 = 62 The last valid host
00 111111 = 63 The broadcast address (do this second)
82
Second Subnet
01 000000 = 64 The network
01 000001 = 65 The first valid host
01 111110 = 126 The last valid host
01 111111 = 127 The broadcast address
83
Third Subnet
10 000000 = 128 The subnet address
10 000001 = 129 The first valid host
10 111110 = 190 The last valid host
10 111111 = 191 The broadcast address
84
Fourth Subnet
11 000000 = 192 The subnet address
11 000001 = 193 The first valid host
11 111110 = 254 The last valid host
11 111111 = 255 The broadcast address
85
Subnets Network Address Range Broadcast Address
(First Address) (Valid Host) (Last Address)
Subnet 1
Subnet 2
Subnet 3
Subnet 4
Subnet 5
Subnet 6
.
.
86
Exercises
87
1. You have a network that needs 29 subnets while
maximizing the number of host addresses available on
each subnet. How many bits must you borrow from
the host field to provide the correct subnet mask?
2. You have the following address: 192.16.5.133/29,
How many total bits are being used to identify the
network, and how many total bits identify the host?
3. What is the full subnet mask for address
172.16.5.10/28?
4. Write the IP address 222.1.1.20 mask
255.255.255.192 in CIDR notation.
88
5. A company is granted the site address 201.70.64.0
(class C). The subnet mask is 255.255.255.224.
90
7. If an Ethernet port on a router were assigned an IP
address of 172.16.112.1/25, what would be the valid
subnet address of this host?
A.172.16.112.0
B.172.16.0.0
C.172.16.96.0
D.172.16.255.0
91
8. A company would like to break its Class B private IP
address 172.16.0.0 into as many subnets as possible
provided that they can get at least 300 clients per
subnet. Find ranges of IP addresses for each subnet
and new mask.
92