Lecture 6 - IP Addressing and Subnetting
Lecture 6 - IP Addressing and Subnetting
Subnetting
Data Communications (Lecture)
ELE 17 / PECEC3
Prepared by:
Jepp Quijano, ECE, CCNA | TUP - ECE
1
Sample Simulation
using Wireshark
2
3
Internet Protocol Address
• IP address is a unique logical addressing
scheme used to locate devices within a
network.
• 32 bits logical addressing scheme for IPv4
and 128 bits or 12 hex digits for IPv6.
• IP address can be statically (manual) or
dynamically (DHCP) assigned.
4
Internet Protocol Address
• IP address is always paired with the
Subnet Mask, which defines the range or
scope of the network.
5
IPv4 Format
192 .168 .1 .1
11000000.10101000.00000001.00000001
6
IPv4 Format
7
IANA
• Internet Assigned Numbers Association
• Global organization responsible for regulation
of domain names, port numbers, AS numbers
and IP addresses.
• Clustered in two (2) main organizations:
1. ICANN – Internet Corporation for Assigned
Names and Numbers.
2. RIR – Regional Internet Registry
8
IANA
ICANN RIR
APNIC
AFRINIC
Organizational
ARIN
Structure
LACNIC
RIPE NCC
9
ICANN
• Internet Corporation for Assigned Names
and Numbers
• Domain Name registration
• Association of Public IP Addresses to its
Domain Name
10
RIR
• Regional Internet Registry
• In charge with IP address regulation.
• Subdivided into five (5) regional HQ:
1. APNIC – Asia Pacific Network Information
Centre
2. ARIN – American Registry for Internet
Numbers
11
IANA
3. LACNIC – Latin America and Caribbean
Network Information Centre
4. AFRINIC – African Network Information
Centre
5. RIPE NCC - Réseaux IP Européens
(European IP Networks) Network
Coordination Centre
12
IP Address Classes
13
IP Address Classes
N = Network
CLASS RANGE Subnet Mask CIDR
H = Host
A 1.0.0.0 – 126.255.255.255 N.H.H.H 255.0.0.0 /8
128.0.0.0 –
B N.N.H.H 255.255.0.0 /16
191.255.255.255
192.0.0.0 –
C N.N.N.H 255.255.255.0 /24
223.255.255.255
224.0.0.0 –
D Multicast
239.255.255.255
240.0.0.0 –
E Research
254.255.255.255
Reserved IP’s:
0.0.0.0, 127.0.0.0 and 255.255.255.255 networks
14
IP Address Classes
Number of Total IPs: = 2# 𝑜𝑓 𝑧𝑒𝑟𝑜 𝑏𝑖𝑡𝑠 𝑟𝑒𝑚𝑎𝑖𝑛𝑖𝑛𝑔 𝑖𝑛 𝑆𝑢𝑏𝑛𝑒𝑡 𝑀𝑎𝑠𝑘
Number of Usable IPs: = 2# 𝑜𝑓 𝑧𝑒𝑟𝑜 𝑏𝑖𝑡𝑠 𝑟𝑒𝑚𝑎𝑖𝑛𝑖𝑛𝑔 𝑖𝑛 𝑆𝑢𝑏𝑛𝑒𝑡 𝑀𝑎𝑠𝑘 - 2
N = Network
CLASS RANGE Subnet Mask Total IP’s
H = Host
1.0.0.0 –
A N.H.H.H 255.0.0.0 224 ≈ 16Million +
126.255.255.255
128.0.0.0 –
B N.N.H.H 255.255.0.0 216 = 65,536
191.255.255.255
192.0.0.0 –
C N.N.N.H 255.255.255.0 28 = 256
223.255.255.255
15
Classful Addressing
16
First Octet Rule
Example: Example:
125.16.234.45 172.16.25.34
Class: A Class: B
N/A: 125.0.0.0 N/A: 172.16.0.0
B/A: 125.255.255.255 B/A: 172.16.255.255
UIP: 125.0.0.1 – UIP: 172.16.0.1 –
125.255.255.254 172.16.255.254
17
First Octet Rule
Example: Example:
222.16.42.17 169.4.12.20
Class: C Class: B
N/A: 222.16.42.0 N/A: 169.4.0.0
B/A: 222.16.42.255 B/A: 169.4.255.255
UIP: 222.16.42.1 – UIP: 169.4.0.1 –
222.16.42.254 169.4.255.254
18
Solution for IPv4
Exhaustion
19
Solution for IPv4 Exhaustion
1. Private vs Public IP Address (RFC 1918)
20
Solution for IPv4 Exhaustion
21
Solution for IPv4 Exhaustion
2. Classless Subnetting
- By Host Requirement
- By Network Requirement
3. Network Address Translation (NAT)
- carry multiple number of private IP
addresses using 1 public IP address.
22
Solution for IPv4 Exhaustion
4. IPv6 (Internet Protocol version 6)
- 2128 ≈ 3.4 x1038 total number of IP
addresses.
- Dual-stack is the technology used for
migration from IPv4 to IPv6. IPv4 and IPv6
can run in parallel.
23
Classless Addressing
24
IP Address Subnetting
1. By Network Requirement
2. By Host Requirement
3. Variable Length Subnet Mask (VLSM)
4. Reverse Subnetting
5. Supernetting
6. Wildcard Mask
25
IP Address Subnetting
26
By Network Requirement
1. Get the number of required networks.
2. Get the number of bits.
3. Get the new subnet mask.
• NSM = OSM + No. of bits
4. Get the increment.
• This will tell the range of the network.
27
By Network Requirement
5. Get the network range.
a) Copy classful network address
b) Add the increment to the octet where subnet
mask stops.
6. Get the actual number of networks and
the number of usable IPs.
28
Example:
As the Network Engineer in your
company, you are tasked to subdivided the
IP block 192.168.10.0/24 and create 5
subnetworks to be provided for each
department in your organization.
29
Example:
1. No. of Required Networks = 5
2. No. of bits = 3
5 = 0000 0101
3. NSM = OSM + No. of bits
NSM = /24 + 3
NSM = /27 or 255.255.255.224
30
Example:
4. Get the increment
/27 = 255.255.255.224
255 = 11111111
255 = 11111111
255 = 11111111
224 = 11100000
31
Example:
4. Increment = 32
32
Example:
5. Range of IP
192.168.10.0 - 192.168.10.31
192.168.10.32 - 192.168.10.63
192.168.10.64 - 192.168.10.95
192.168.10.96 - 192.168.10.127
192.168.10.128 - 192.168.10.159
192.168.10.160 - 192.168.10.191
33
Example:
192.168.10.192 - 192.168.10.223
192.168.10.224 - 192.168.10.255
6. Number of Actual Networks and Usable
IPs
NAN = 2𝑁𝑆𝑀−𝑂𝑆𝑀 = 2/27−/24 = 8
UIP = 232−𝑁𝑆𝑀 − 2 = 232−/27 − 2
UIP = 25 − 2 = 30 34
Example:
Subdivide the IP block 173.28.0.0/16
network into 16 different sub-networks.
1. No. of Required Networks = 16
2. No. of bits = 5
16 = 0001 0000
3. NSM = OSM + No. of bits
NSM = /16 + 5 = /21 or 255.255.248.0
35
Example:
4. Get the increment
/21 = 255.255.248.0
255 = 11111111
255 = 11111111
248 = 11111000
0 = 00000000
36
Example:
4. Increment = 8
37
Example:
5. Range of IP
173.28.0.0 - 173.28.7.255
173.28.8.0 - 173.28.15.255
173.28.16.0 - 173.28.23.255
173.28.24.0 - 173.28.31.255
173.28.32.0 - 173.28.39.255
173.28.40.0 - 173.28.47.255
38
Example:
5. Range of IP
173.28.48.0 - 173.28.55.255
173.28.56.0 - 173.28.63.255
173.28.64.0 - 173.28.71.255
173.28.72.0 - 173.28.79.255
173.28.80.0 - 173.28.87.255
173.28.88.0 - 173.28.95.255
39
Example:
5. Range of IP
173.28.96.0 - 173.28.103.255
173.28.104.0 - 173.28.111.255
173.28.112.0 - 173.28.119.255
173.28.120.0 - 173.28.127.255
173.28.128.0 - 173.28.135.255
173.28.136.0 - 173.28.143.255
40
Example:
5. Range of IP
173.28.144.0 - 173.28.151.255
173.28.152.0 - 173.28.159.255
173.28.160.0 - 173.28.167.255
173.28.168.0 - 173.28.175.255
173.28.176.0 - 173.28.183.255
173.28.184.0 - 173.28.191.255
41
Example:
5. Range of IP
173.28.192.0 - 173.28.199.255
173.28.200.0 - 173.28.207.255
173.28.208.0 - 173.28.215.255
173.28.216.0 - 173.28.223.255
173.28.224.0 - 173.28.231.255
173.28.232.0 - 173.28.239.255
42
Example:
5. Range of IP
173.28.240.0 - 173.28.247.255
173.28.248.0 - 173.28.255.255
6. Number of Actual Networks and Usable IPs
NAN = 2𝑁𝑆𝑀−𝑂𝑆𝑀 = 2/21−/16 = 32
UIP = 232−𝑁𝑆𝑀 − 2 = 232−/21 − 2
UIP = 211 − 2 = 2046
43
By Host Requirement
1. Get the number of required hosts.
2. Get the number of bits.
3. Get the new subnet mask.
• NSM = /32 - bits
4. Get the increment.
• This will tell the range of the network.
44
By Host Requirement
5. Get the network range.
a) Copy classful network address
b) Add the increment to the octet where subnet
mask stops.
6. Get the actual number of networks and
the number of usable IPs.
45
Example:
Subdivide the IP block 192.168.1.0/24 to
fit in 50 hosts per network.
1. No. of Required Hosts = 50
2. No. of bits = 6
50 = 0011 0010
3. NSM = /32 - bits
NSM = /32 - 6 = /26 or 255.255.255.192
46
Example:
4. Get the increment
/26 = 255.255.255.192
255 = 11111111
255 = 11111111
255 = 11111111
192 = 11000000
47
Example:
4. Increment = 64
48
Example:
5. Range of IP
192.168.1.0 - 192.168.1.63
192.168.1.64 - 192.168.1.127
192.168.1.128 - 192.168.1.191
192.168.1.192 - 192.168.1.255
49
Example:
6. Number of Actual Networks and Usable IPs
NAN = 2𝑁𝑆𝑀−𝑂𝑆𝑀 = 2/26−/24 = 4
UIP = 232−𝑁𝑆𝑀 − 2 = 232−/26 − 2
UIP = 26 − 2 = 62
50
Example:
Subdivide the IP block 124.156.0.0/16
to fit in 5000 hosts per network.
1. No. of Required Hosts = 5000
2. No. of bits = 13
5000 = 0001 0011 1000 1000
3. NSM = /32 - bits
NSM = /32 - 13 = /19 or 255.255.224.0
51
Example:
4. Get the increment
/19 = 255.255.224.0
255 = 11111111
255 = 11111111
224 = 11100000
0 = 00000000
52
Example:
4. Increment = 32
53
Example:
5. Range of IP
124.156.0.0 - 124.156.31.255
124.156.32.0 - 124.156.63.255
124.156.64.0 - 124.156.95.255
124.156.96.0 - 124.156.127.255
124.156.128.0 - 124.156.159.255
124.156.160.0 - 124.156.191.255
54
Example:
5. Range of IP
124.156.192.0 - 124.156.223.255
124.156.224.0 - 124.156.255.255
55
Example:
6. Number of Actual Networks and Usable IPs
NAN = 2𝑁𝑆𝑀−𝑂𝑆𝑀 = 2/19−/16 = 8
UIP = 232−𝑁𝑆𝑀 − 2 = 232−/19 − 2
UIP = 213 − 2 = 8190
56
VLSM
- A more efficient way of dividing the IP block
based on the number of required hosts per
network.
- The concept is the same with the by host
requirement only that one (1) IP range is
allotted for every hosts-required network.
- Best practice is to start from largest host
number down to the smallest.
57
VLSM
1. Get the number of required hosts.
2. Get the number of bits.
3. Get the new subnet mask.
• NSM = /32 - bits
4. Get the increment.
• This will tell the range of the network.
58
VLSM
5. Get the network range.
a) Copy classful network address
b) Add the increment to the octet where subnet
mask stops.
6. After getting the first IP range, get the
succeeding Network IP and proceed back to
step 1 until all host requirement per network
have been satisfied.
59
Example:
RIR
(172.16.12.0/24)
APNIC (30 AFRINIC (10 ARIN (120 LACNIC (10 RIPE NCC (50
Hosts) Hosts) Hosts) Hosts Hosts)
60
For 120 Hosts
1. No. of Required Hosts = 120
2. No. of bits = 7
120 = 0111 1000
3. NSM = /32 - bits
NSM = /32 - 7 = /25 or
255.255.255.128
61
Example:
4. Get the increment
/25 = 255.255.255.128
255 = 11111111
255 = 11111111
255 = 11111111
128 = 10000000
62
Example:
4. Increment = 8
63
Example:
5. Range of IP
172.16.12.0 - 172.16.12.127
• 172.16.12.128/25
64
Example:
6. Number of Actual Usable IPs
UIP = 232−𝑁𝑆𝑀 − 2 = 232−/25 − 2
UIP = 27 − 2 = 126 Hosts available for
the first IP range. Use the next IP range to
subnet 50 Hosts.
65
For 50 Hosts
1. No. of Required Hosts = 50
2. No. of bits = 6
50 = 0011 0010
3. NSM = /32 - bits
NSM = /32 - 6 = /26 or
255.255.255.192
66
Example:
4. Get the increment
/26 = 255.255.255.192
255 = 11111111
255 = 11111111
255 = 11111111
192 = 11000000
67
Example:
4. Increment = 64
68
Example:
5. Range of IP
172.16.12.128 - 172.16.12.191
• 172.16.12.192/26
69
Example:
6. Number of Actual Usable IPs
UIP = 232−𝑁𝑆𝑀 − 2 = 232−/26 − 2
UIP = 26 − 2 = 62 Hosts available for
the second IP range. Use the next IP
range to subnet 30 Hosts.
70
For 30 Hosts
1. No. of Required Hosts = 30
2. No. of bits = 5
50 = 0001 1110
3. NSM = /32 - bits
NSM = /32 - 5 = /27 or
255.255.255.224
71
Example:
4. Get the increment
/27 = 255.255.255.224
255 = 11111111
255 = 11111111
255 = 11111111
224 = 11100000
72
Example:
4. Increment = 32
73
Example:
5. Range of IP
172.16.12.192 - 172.16.12.223
• 172.16.12.224/27
74
Example:
6. Number of Actual Usable IPs
UIP = 232−𝑁𝑆𝑀 − 2 = 232−/27 − 2
UIP = 25 − 2 = 30 Hosts available for
the third IP range. Use the next IP range
to subnet 10 Hosts.
75
For 10 Hosts
1. No. of Required Hosts = 10
2. No. of bits = 4
50 = 0000 1010
3. NSM = /32 - bits
NSM = /32 - 4 = /28 or
255.255.255.240
76
Example:
4. Get the increment
/28 = 255.255.255.240
255 = 11111111
255 = 11111111
255 = 11111111
240 = 11110000
77
Example:
4. Increment = 16
78
Example:
5. Range of IP
172.16.12.224 - 172.16.12.239
172.16.12.240 - 172.16.12.255
79
Example:
6. Number of Actual Usable IPs
UIP = 232−𝑁𝑆𝑀 − 2 = 232−/28 − 2
UIP = 24 − 2 = 14 Hosts available for
the fourth and fifth IP range.
80
Summary
ARIN: 172.16.12.0-172.16.12.127 /25
RIPE NCC: 172.16.12.128 – 172.16.12.191 /26
APNIC: 172.16.12.192 – 172.16.12.223 /27
AFRINIC: 172.16.12.224 – 172.16.12.239 /28
LACNIC: 172.16.12.240 – 172.16.12.255 /28
83
Reverse Subnetting
Problem: Considering the network topology with all the
proper and correct configurations, PC-B can connect to the
Internet and the server but PC-A cannot. Find the reason
why.
84
Reverse Subnetting
1. Determine the New Subnet Mask (NSM).
NSM = /26 or 255.255.255.192
2. Get the increment.
/26 = 255.255.255.192
255 = 11111111
255 = 11111111
255 = 11111111
192 = 11000000
=> the increment is 64. 85
Reverse Subnetting
86
Reverse Subnetting
3. Copy the classful network address and add the
increment from the octet where the NSM has the last
value.
192.168.10.0 - 192.168.10.63
192.168.10.64 - 192.168.10.127
192.168.10.128 - 192.168.10.191
192.168.10.192 - 192.168.10.255
87
Reverse Subnetting
Answer: PC- A is not in the same network as PC-B and the
configured default gateway on the router. To be able to
connect, PC-A must use an IP in the same range used by
PC-B and DGW.
88
Reverse Subnetting
Problem: What valid host range is the IP address
172.31.110.146/28 a part of? Determine also the total
number of networks and usable hosts per network.
89
Reverse Subnetting
1. Determine the New Subnet Mask (NSM).
NSM = /28 or 255.255.255.248
2. Get the increment.
/28 = 255.255.255.240
255 = 11111111
255 = 11111111
255 = 11111111
240 = 11110000
=> the increment is 16. 90
Reverse Subnetting
91
Reverse Subnetting
3. Copy the classful network address and add the
increment from the octet where the NSM has the last
value.
172.31.0.0 -
__.__._.16 -
__.__._.96 -
__.__._.112 -
__.__._.128 -
__.__._.144 -
__.__._.160 - __.__._.175
92
Reverse Subnetting
Answer: The IP address 172.31.110.146/28 belongs to
the IP range 172.31.110.144 – 172.31.110.159/28.
94
Wildcard Mask
- Opposite of the Subnet Mask or
sometimes called inverse mask.
- Subnet mask denotes the network bits,
wildcard mask denotes the host bits.
- Commonly used in implementing routing
protocols and access lists (accept or
deny).
95
Wildcard Mask
- To get the wildcard mask of any given
subnet mask:
▪ Just subtract the value of the given long
format subnet mask from a classful of 255
subnet mask (255.255.255.255).
96
Example:
1. Get the wildcard mask of 255.255.248.0.
255 . 255 . 255 . 255
-
255. 255 . 248 . 0
-----------------------------------------
0 . 0 . 7 . 255
97
Example:
2. Get the wildcard mask of /27.
- If in case that CIDR format is given on
the problem, convert the CIDR form into the
long format form to proceed with the simple
subtraction.
➢ /21 = 255.255.255.224
98
Example:
1. Get the wildcard mask of /21.
255 . 255 . 255 . 255
-
255. 255 . 255 . 224
-----------------------------------------
0 . 0 . 0 . 31
99
Thank you!
Stay safe and God bless,
Future Engineers! ☺
- Sir Jepp
101