INTERNET PROTOCOL (IP)
AND SUBNETTING
1
OBJECTIVES
Understand IP Addressing and
Classes
Describe the operation and benefits of
using private and public IP addressing
Implement static and dynamic
addressing services for hosts in a LAN
environment.
Subnetting
2
IP ADDRESSING
An IP address is a numeric identifier
assigned to each machine on an IP
network.
It designates the specific location of a
device on the network.
IP addressing was designed to allow
hosts on one network to communicate
with a host on a different network
regardless of the type of LANs the hosts
are participating in.
3
4
IP TERMINOLOGY
BIT: A bit is one digit, either a 1 or a 0.
BYTE: A byte is 8 bits.
OCTET: An octet, made up of 8 bits, is
just an ordinary 8-bit binary number.
In this chapter, the terms byte and
octet are completely interchangeable.
5
192.168.1.2
The address is split in blocks. Each
block is separated from the other with
dots.
IP addresses are composed of four
blocks. Each of the four blocks is called
an octet (the name octet comes from the
fact that each block is composed of eight
bits).
Each octet’s allowed value ranges from 0
to 255. 6
BINARY AND DECIMAL
CONVERSION
7
UNDERSTANDING THE POWERS
OF 2
8
IP ADDRESSES
Every IP Address has a node portion and a
network portion.
IP Address: 192.168.5.201
Network Portion: 192.168.5.201
Node Portion: 192.168.5.201
9
NETWORK ADDRESSING
Subdividing an IP address into a network and
node address is determined by the class
designation of one’s network.
This figure summarizes the three classes of
networks
10
IP ADDRESS CLASSES
11
CLASS A
A Class A address range allows for up to
224 – 2 = 6,777,214 host IDs (i.e., 24 bits
are used for the host ID portion of the IP
address).
Network Address Range: Class A
The first bit of the first byte in a Class A
network address must always be off, or 0.
This means a Class A address must be
between 0 and 127. 12
CLASS B
A Class B address range allows for up to 216 –
2 = 65,534 host IDs (i.e., 16 bits are used for
the host ID portion of the IP address).
Network Address Range: Class B
In a Class B network the first bit of the first
byte must always be turned on but the second
bit must always be turned off. If you turn the
other 6 bits all off and then all on, you will find
the range for a Class B network between 128
and 191. 13
14
CLASS C
A Class C address range allows for up to 28 –
2 = 256 – 2 = 254 host IDs (i.e., 8 bits are
used for the host ID portion of the IP
address).
Network Address Range: Class C
For Class C networks the first 2 bits of the
first octet as always turned on, but the third
bit can never be on. the range for a Class C
network between 192 and 223.
15
16
CLASS A LIMITS
17
Examples:
1st Class A address range: 1.0.0.0 to
1.255.255.255;
2nd Class A address range: 2.0.0.0 to
2.255.255.255;
3rd Class A address range: 3.0.0.0 to
3.255.255.255; …
127th Class A address range: 127.0.0.0 to
127.255.255.255 (Notice that the 1st octet
stays the same value for any given Class A
address range.
18
CLASS B LIMITS
19
Examples:
1st Class B address range: 128.0.0.0 to
128.0.255.255;
2nd Class B address range: 128.1.0.0 to
128.1.255.255;
3rd Class B address range: 128.2.0.0 to
128.2.255.255; …
256th Class B address range: 128.255.0.0 to
128.255.255.255;
257th Class B address range: 129.0.0.0 to
129.0.255.255; 258th Class B address range:
129.1.0.0 to 129.1.255.255; …
16,384th Class B address range: 191.255.0.0 to
20
191.255.255.255
CLASS C LIMITS
21
Examples:
1st Class C address range: 192.0.0.0 to 192.0.0.255;
2nd Class C address range: 192.0.1.0 to 192.0.1.255;
3rd Class C address range: 192.0.2.0 to 192.0.2.255; …
256th Class C address range: 192.0.255.0 to
192.0.255.255;
257th Class C address range: 192.1.0.0 to 192.1.0.255;
258th Class C address range: 192.1.1.0 to 192.1.1.255;
…
512th Class C address range: 192.1.255.0 to
192.1.255.255
513th Class C address range: 192.2.0.0 to 192.2.0.255
…
Last Class C address range: 223.255.255.0 to
223.255.255.255 22
o Network Address Ranges: Classes D and E
The addresses between 224 to 255 are
reserved for Class D and E networks.
Class D (224–239) is used for multicast
addresses and Class E (240–255) for
scientific purposes.
23
Easily Finding the Class of an IP Address
It’s important to have memorized the
beginning and ending addresses for the first
octet of classes A to C.
At the very least, it’s necessary to remember
the binary formation of the address:
first bit is a 0, class A
first bits are 10, class B
first bits are 110, class C
24
SUBNET MASK
• The subnet mask tells us which part of an
IP address is the node portion vs. the
network portion
• An IP address without a subnet mask is
meaningless
IP Address: 192.168.5.201
Subnet Mask: 255.255.255.0
----------------------------------------------------
Network ID: 192.168.5.0
25
SUBNET MASK AND ANDING
IP: 192.168.5.201
Subnet: 255.255.255.0
IP: 11000000. 10101000.00000101.11001001
SUBNET: 11111111.11111111.11111111. 00000000
------------------------------------------------------
AND 11000000.10101000.00000101.00000000
26
Network address: This is the designation
used in routing to send packets to a remote
network—for example, 10.0.0.0, 172.16.0.0,
and 192.168.10.0.
Broadcast address: The address used by
applications and hosts to send information
to all nodes on a network is called the
broadcast address.
27
28
NETWORK ID
The all zeros host address is the same as
the network ID
Ex. IP: 192.168.1.0
Subnet: 255.255.255.0
----------------------------------------
Network ID: 192.168.1.0
Theall ones host address is reserved for
the broadcast address
30
HOST ID
The first part of the IP address (network ID)
is used to find the network where the packet
needs to be sent.
Once the packet arrives to its destination
network, it needs to be delivered to a given
host (computer, PDA, videogame,
mobile phone) in that network. The address
of that host is the host ID.
31
CLASSES A, B, AND C, AND THEIR
DEFAULT SUBNET MASKS
32
RESERVED ADDRESSING
Address Function
1. Network address of all 1. Interpreted to mean “this
0s network or segment.”
2. Network address of all 2. Interpreted to mean “all
1s networks.”
3. Network 127.0.0.1 3. Reserved for loopback
tests.
4. Node address of all 0s 4. Interpreted to mean
“network address” or any
host on specified network
33
Node address of all 1s Interpreted to mean “all
nodes” on the specified
network
Used by Cisco routers to
Entire IP address set
designate the default route.
to all 0s
Could also mean “ (same as
Broadcast to all nodes on the
Entire IP address set current network;
to all 1s 255.255.255.255) sometimes
called an “all 1s broadcast” or
limited broadcast any 34
network.”
LOOPBACK ADDRESSES
Normally, when a TCP/IP application wants
to send information, that information
travels down the protocol layers to IP where
it is encapsulated in an IP datagram.
That datagram then passes down to the
data link layer of the device's physical
network for transmission to the next hop,
on the way to the IP destination.
35
However, one special range of addresses is
set aside for loopback functionality.
This is the range 127.0.0.0 to
127.255.255.255. IP datagrams sent by a
host to a 127.x.x.x loopback address are not
passed down to the data link layer for
transmission.
Instead, they “loop back” to the source device
at the IP level. Data is sent by a device's layer
three IP implementation and then
immediately received by it.
36
The purpose of the loopback range is
testing of the TCP/IP protocol
implementation on a host. Since the lower
layers are short-circuited, sending to a
loopback address allows the higher layers
(IP and above) to be effectively tested
without the chance of problems at the lower
layers manifesting themselves.
127.0.0.1 is the address most commonly
used for testing purposes. 37
PRIVATE ADDRESSES
Private addresses, which are subsets of the
IP address space, that can be used where
there is no need for direct public (meaning
Internet) visibility of the hosts.
These addresses can then be repeated as
one wishes. For instance, a corporate
network in New York can have its address
in the range 192.168.0.0, and another
network in the same city, just across the38
street, can have the same address range.
PRIVATE ADDRESSING
Class Reserved Address Space
Class A 10.0.0.0 through 10.255.255.255
Class B 172.16.0.0 through 172.31.255.255
Class C 192.168.0.0 through 192.168.255.255
39
PUBLIC ADDRESSES
Most IP addresses are public addresses.
Public addresses are registered as belonging
to a specific organization.
InternetService Providers (ISP) and extremely
large organizations in the U.S. obtain blocks
of public addresses from the American
Registry for Internet Numbers (ARIN)
40
BROADCAST ADDRESSES
Layer 2 broadcasts These are sent to all
nodes on a LAN.
Broadcasts (layer 3) These are sent to all
nodes on the network.
Unicast These are sent to a single
destination host.
Multicast These are packets sent from a
single source and transmitted to many
devices on different networks.
41
IPV6
IPV6, which is the next generation of the
TCP/IP suite. The IP addressing part, in
special, has IP addresses composed of 128
bits.
This means there are 3.4 × 1038 (that’s 3.4
times 10 followed by 38 zeros). Just for an
idea, this gives 5 × 1028 (five times 10
followed by 28 zeros) addresses available for
each of the approximately 6.5 billion people
living on the earth. 42
SUBNETTING
Subnetting is the process of borrowing bits
from the HOST bits, in order to divide the
larger network into small subnets.
Subnetting does NOT give you more hosts,
but actually costs you hosts.
You lose two host IP Addresses for each
subnet, and perhaps one for the subnet IP
address and one for the subnet broadcast IP
address.
43
Youlose the last subnet and all of it’s hosts’
IP addresses as the broadcast for that
subnet is the same as the broadcast for the
network.
In older networks, you would have lost the
first subnet, as the subnet IP address is the
same as the network IP address. IP
SUBNET ZERO.
44
Subnetting allows for creating multiple
logical networks from a single address block
Subnets are created using one or more of
the host bits as network bits
done by extending the mask to borrow
some of the bits from the host portion to
create additional network bits
45
SUBNETTING BENEFITS
Benefitsof subnetting include:
Reduced network traffic
Optimized network performance
Simplified management
Facilitated spanning of large
geographical distances.
46
ANALOGY
Dividing the barrel of
apples into small
barrels or baskets
does not give us any
more apples…
100 Apples
47
10 barrels x 10 apples = 100 apples
10 10 10
100 Apples
(10 * 10)
10
10
10
10 10 10
Itis the same as taking a barrel of 10
100 apples and dividing it into 10
barrels of 10 apples each. 48
100 – 2 apples = 98 Usable Apples
Before subnetting:
In any network (or subnet) we
can not use all the IP addresses
for host addresses.
98 Apples
(100 – 2) We lose two addresses for every
network or subnet.
Network Address - One address
is reserved to that of the
network.
Broadcast Address – One
address is reserved to address
all hosts in that network or
subnet. 49
CALCULATING SUBNETS AND HOSTS
The number of subnets is calculated using
2n, where n is the number of bits borrowed
21 = 2 subnets
the more bits borrowed, the more subnets
can be defined
The number of usable hosts per subnet is
calculated using 2h - 2 where h is the
number of host bits left
27 – 2 = 126 useable hosts per subnet
with each bit borrowed, fewer host
50
addresses are available per subnet
Block size= 256 - (new subnet mask after
borrowing)
51
SUBNET 192.168.1.0/24 --- 2
SUBNETS
52
EXERCICE
192.168.1.0/24
1. We need 4 subnets.
2. We need 5 subnets
3. We need 8 subnets
53
HOW TO CREATE SUBNETS
Take bits from the host portion of the IP
address and reserve the to divine the
subnet address.
To create a subnet, follow these steps:
1. Determine the number of required
network IDs:
• One for each LAN subnet
• One for each wide area network
connection
54
2. Determine the number of required host
IDs per subnet:
• One for each TCP/IP host
• One for each router interface
3. Based on the above requirements, create
the following:
• One subnet mask for your entire
network
• A unique subnet ID for each physical
segment
55
• A range of host IDs for each subnet
SUBNET ADDRESSES
56
Givena network IP address, there are two
types of problems involving subnetting:
1. Subnetting when given a required number of
networks
2. Subnetting when given a required number of
clients
57
EXERCISE
A company would like to break its Class B
network IP address 172.16.0.0 into 60
different subnets. Find ranges of IP
addresses for each subnet and new mask.
58
EXERCISE 2
A company would like to break its Class
C private IP address 192.168.10.0 into
as many subnets as possible provided
that they can get at least 58 hosts per
subnet. Find ranges of IP addresses for
each subnet and new mask.
62
EXERCICE 3
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.
63
VARIABLE LENGTH SUBNET MASK (VLSM)
67
Compare and contrast classful and classless
IP addressing.
Review VLSM and explain the benefits of
classless IP addressing.
Describe the role of the Classless Inter-
Domain Routing (CIDR) standard in making
efficient use of scarce IPv4 addresses
68
CIDR uses Variable Length Subnet
Masking (VLSM) to help conserve
address space.
-VLSM is simply subnetting a
subnet
69
Classful routing
only allows for one subnet mask for
all networks
VLSM & classless routing
This is the process of subnetting a
subnet
-More than one subnet mask can be
used
-More efficient use of IP addresses
as compared to classful IP
addressing 70
71
EXERCICES
72
1. A network manager in Kigali Institute of
Tourism (KIT) has been given a network
address of 192.168.1.0/24. Using Variable
Length Subnet Mask (VLSM), what are the
subnets address needed, their valid hosts
and broadcast addresses based on the
following requirements:
- KIT_Kigali needs 100 host addresses.
- KIT_Huye needs 62 host addresses.
- KIT_Musanze needs 20 host addresses.
- 3 WAN links which need 2 host addresses
73
each.
2. A network manager in Kigali Independent
University (KIU) has been given a network
address of 192.168.5.0/24. Using Variable
Length Subnet Mask (VLSM), what are the
subnets address needed, their valid hosts
and broadcast addresses based on the
following requirements:
- KIU_Kigali needs 58 host addresses.
- KIU_Huye needs 62 host addresses.
- KIU_Musanze needs 6 host addresses.
- 3 WAN links which need 2 host addresses
each. 74
3. A network manager in PICTS has been
given a network address of 192.168.1.0/24.
Using Variable Length Subnet Mask (VLSM),
what are the subnets address needed, their
valid hosts and broadcast addresses based
on the following requirements:
- PICTS Kigali needs 50 host addresses.
- PICTS Huye needs 60 host addresses.
- PICTS Musanze needs 30 host addresses.
-PICTS Rusizi needs 30 host addresses.
- 5 WAN links which need 2 host addresses
each 75
CLASSLESS INTER-DOMAIN ROUTING
(CIDR)
Usedto allocate an amount of IP address
space to a given entity (company, home,
customer, etc).
Example: 192.168.10.32/28
Theslash notation (/) means how many bits
are turned on (1s) and tells you what your
subnet mask is.
76
CIDR VALUES
77
SUBNETTING CLASS C ADDRESSES
In a Class C address, only 8 bits are available for
defining the hosts. Remember that subnet bits start
at the left and go to the right, without skipping bits.
This means that the only Class C subnet masks can
be the following:
Binary Decimal CIDR
------------------------------------------------
10000000 = 128 /25
11000000 = 192 /26
11100000 = 224 /27
11110000 = 240 /28
11111000 = 248 /29 78
11111100 = 252 /30
CLASS C 192 MASK EXAMPLES
Subnet Host Meaning
00 000000 = 0 The network (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)
Subnet Host Meaning
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 79
CLASS C 192 MASK EXAMPLES
Host Meaning
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
Host Meaning
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 80
SUBNETTING CLASS C ADDRESSES –
FAST METHOD
81
82
HOW MANY SUBNETS?
22 = number of subnets.
X is the number of masked bits, or
the 1s.
For example, in 11000000, the
number of ones gives us 22 subnets.
In this example there are 4 subnets.
83
HOW MANY HOSTS PER SUBNET?
2y-2 = number of hosts per subnet.
• Y is the number of unmasked bits, or
the 0s.
• For example, in 11000000, the
number of zeros gives us 26-2 hosts.
In this example, there are 62 hosts
per subnet.
84
WHAT ARE THE VALID SUBNETS?
256-subnet mask = block size, or base
number.
For example 256-192=64. 64 is the
first subnet. The next subnet would be
the base number plus itself or
64+64=128, (the second subnet).
85
WHAT’S THE BROADCAST ADDRESS
FOR EACH SUBNET?
Thebroadcast address is all host bits
turned on, which is the number
immediately preceding the next subnet.
86
WHAT ARE THE VALID HOSTS?
Valid
hosts are the number between the
subnets, omitting all 0s and all 1s.
87
VLSM was designed to maximize
addressing efficiency
each WAN link requires 2 host
addresses
Breaks up a subnet into a smaller subnet
88
USING VLSM – STEP 1
Calculate a subnet from the original 192.168.15.0/24
block to accommodate the largest LAN, i.e. 58 hosts
Keep 6 host bits to cater for the 58 hosts
Ch 6 - 90
26 – 2 = 62 useable host addresses
mask for last octet 11000000
2 bits are borrowed to create 4 possible subnets
192.168.15.0/26 (subnet 0)
192.168.15.64/26 (subnet 1)
192.168.15.128/26 (subnet 2)
192.168.15.192/26 (subnet 3)
Assign subnet 0 (192.168.15.0/26) to this LAN
3 subnets left unused
USING VLSM – STEP 2
Consider the LAN with the next fewer hosts, i.e.
26 hosts
Require 5 host bits to accommodate 26 hosts
Ch 6 - 91
25 – 2 = 30 useable host addresses
mask for the last octet is 11100000
Use the next available address of
192.168.15.64/26 to create an address block
for this subnet
One more bit is borrowed from the above subnet
192.168.15.64/27
This subnet, 192.168.15.64/27, creates
two more subnets
192.168.15.01000000/27 (subnet 0)
192.168.15.64/27
192.168.15.01100000/27 (subnet 1)
192.168.15.96/27
Assign the 192.168.15.64/27 to this
LAN
1 subnet left unused
92
USING VLSM – STEP 3
Consider the LAN with the next fewer hosts,
i.e. 10 hosts
Require 4 host bits to accommodate 10 hosts
24 – 2 = 14 useable host addresses
mask for the last octet is 11110000
Use the next available address of
192.168.15.96/27 to create an address block
for this subnet
One more bit is borrowed from the above
subnet
192.168.15.96/28
This subnet, 192.168.15.96/28, creates
two more subnets
192.168.15.01100000/28 (subnet 0)
192.168.15.96/28
192.168.15.01110000/28 (subnet 1)
192.168.15.112/28
Assign both these subnets to the LANs
with the same number of hosts
no subnet left
94
USING VLSM – STEP 4
Point-to-point WAN links require two host addresses
Require two host bits to provide two host addresses
22 – 2 = 2 useable host addresses
Ch 6 - 95
mask for the last octet is 11111100
Use the next available address of 192.168.15.128/26
to create an address block for this subnet
Four more bits are borrowed from the above subnet
192.168.15.128/30
This subnet, 192.168.15.128/30, creates 16 more
subnets
Ch 6 - 96
192.168.15.10000000/30 (subnet 0)
192.168.15.128/30
192.168.15.10000100/30 (subnet 1)
192.168.15.132/30
192.168.15.10001000/30 (subnet 2)
192.168.15.136/30
192.168.15.10001100/30 (subnet 3)
192.168.15.140/30
USING VLSM – STEP 5
Calculate the address range and broadcast
address for each subnet
Ch 6 - 97
Document the host requirements, subnet
addresses, address range, broadcast
addresses and network prefix
USING VLSM – NETWORK DIAGRAM
Ch 6 - 98
SUMMARY
99
99
SUBNETTING EXERCISE:
You’ve been hired to troubleshoot a problem network.
The customer says that they are having problems
with computers being able to connect to each other.
The network has computers with the following IPs:
201.54.13.1
201.54.13.6
201.54.13.21
201.54.13.31
201.54.13.32
201.54.13.63
201.54.13.65
All the computers are using the 255.255.255.224
100
mask
Which computers are able to communicate?
EXERCISE
Select the correct base network ID for
203.121.45.31 /30
IP 203.121. 45 . 0001 1111
Mask 255.255.255. 1111 1100
-------------------------------------------------
AND 203.121. 45 . 0001 1100 = 28
203.121.45.28
101
SUBNETTING EXERCISE 2:
Write out the subnets for the 202.54.13.0
network, subnetted with the
255.255.255.240 mask.
What’s the network address of the 0 subnet?
What’s the first host address in the 0 subnet?
What’s the last host address in the 2 subnet?
What’s the broadcast address for the 3
subnet?
102
VARIABLE-LENGTH SUBNET MASKS
(VLSM)
VLSM removed the class boundary
restriction of traditional subnet masks.
With VLSM a network of any class can be
subnetted to almost any size.
103
SEVEN STEPS TO SUBNETTING
Step 1: Determining Number of Subnets Needed
Step 2: Determining Number of Bits You Can
Borrow
Step 3: Determining Number of Bits You Must
Borrow to Get Needed Number of Subnets
Step 4: Turning On Borrowed Bits and
Determining Decimal Value
Step 5: Determining New Subnet Mask
Step 6: Finding Host/Subnet Variable
Step 7: Determining Range of Addresses 104
SUBNET MASK
105
106
UNICAST
107
UNICAST TRANSMISSION 6.2.3.1
The process of sending a packet from one host
to another host
Ch 6 - 108
normal host-to-host communication
Unicast packets use the host address of the
destination device as the destination address
and can be routed through an internetwork
BROADCAST TRANSMISSION
The process of sending a packet from one host to all
hosts in the network
Ch 6 - 109
packet uses a special broadcast address as the
destination address
Used for locating special services/devices for which
the address is not known or when the host needs to
provide information to all hosts on the network
mapping upper-layer addresses to lower-layer
addresses
requesting an address
exchanging routing information by routing
protocols
Ch 6 - 110
BROADCAST TRANSMISSION (CONT’D)
Directed broadcast
is sent to all hosts on a specific network,
Ch 6 - 111
usually a non-local network
although routers do not forward directed
broadcasts, they may be configured to do
so.
For example, for a host outside of the network
to communicate with the hosts within the
172.16.4.0 /24 network, the destination
address of the packet would be
172.16.4.255.
Limited broadcast
is used for communication that is limited to
Ch 6 - 112
hosts on the local network
packets used a destination address of
255.255.255.255 (all ones)
packets addressed to the limited broadcast
address will only appear on the local
network
As an example, a host within the 172.16.4.0 /24
network would broadcast to all the hosts in its
network using a packet with a destination
address of 255.255.255.255.
MULTICAST TRANSMISSION
The process of sending a packet from one host to a
selected group of hosts
designed to conserve bandwidth
Ch 6 - 113
A special block of addresses from 224.0.0.0 to
239.255.255.255 is used for multicast groups
addressing
Hosts that wish to receive particular multicast data
are called multicast clients
video and audio distribution
routing information exchange by routing protocols
software distribution
news feeds
For the IP address 187.124.100.45, with the
subnet mask 255.255.240.0,
what is the network ID?
114