IP - Subnetting
IP - Subnetting
IP - Subnetting
Fundamentals
Internet Protocol: Subnetting
Presented by,
Jack Crowder, CCIE
Agenda
• Review
– IP Addressing
• Format
• Classfull
• Reserved
• Subnetting
– Terms
– Binary calculations
– IP subnet calculation
2
Review
• RFC 1466 (IPv4)
• Address format:
– 4 octets, dotted decimal notation
– Example: 192.168.005.100
– Applied to any interface that wants to communicate in
an IP network
• Purpose:
– Addresses logically grouped: Subnet
• Routers “deal in” subnets
3
Classfull Boundaries – 1st Octet
00000000 0 Class A /
01111111 127
4
RFC 1878 and 1918
• reserved: 0.0.0.0 – 0.255.255.255 /8
• Class A: 1.0.0.0 - 127.255.255.255
– reserved: 10.0.0.0 - 10.255.255.255 /8 (private)
– reserved: 127.0.0.0 - 127.255.255.255 /8 (loopback)
• Class B: 128.0.0.0 - 191.255.255.255
– reserved: 128.0.0.0 - 128.255.255.255 /8
– reserved: 172.16.0.0 - 172.31.255.255 /12 (private)
• Class C: 192.0.0.0 - 223.255.255.255
– reserved: 192.168.0.0 - 192.168.255.255 /16 (private)
• Class D: 224.0.0.0 – 239.255.255.255
– reserved: 224.0.0.0 - 225.255.255.255 (Multicast)
• reserved: 255.255.255.255 (Broadcast) /32
5
Subnetting Terms
• Address
• Subnet
• Subnet Mask
• Network field (as determined by the Subnet Mask)
• Host field (as determined by the Subnet Mask)
• Subnet ID: all 0’s (in the Host field)
• Broadcast ID: all 1’s (in the Host field)
• Unicast (useable address on a subnet)
• Host route
6
Binary Calculation
2 to the power of X
• 4 Octets (a.k.a. Bytes) in a IPv4 address
– 8 bits in an octet
– 32 bits in an address
• 8 Bits in each octet
– 28 = 256
• Decimal number range:
0 – 255 (256 numbers counting “0”)
• Binary range:
00000000 – 11111111 (256 combinations of 1’s and 0’s)
7
Decimal to Binary
255 = 11111111 255 = 11111111
128 = 10000000 252 = 11111100
64 = 01000000 248 = 11111000
32 = 00100000 240 = 11110000
16 = 00010000 224 = 11100000
8 = 00001000 192 = 11000000
4 = 00000100 128 = 10000000
2 = 00000010 0 = 00000000
1 = 00000001
0 = 00000000
8
Binary Template
always start counting from 0
x
2 = 128 64 32 16 8 4 2 1
X= 7 6 5 4 3 2 1 0
Position = 8 7 6 5 4 3 2 1
9
Subnet Mask
• Purpose:
– Apply the Mask to the IP Address to determine:
• Network bits
• Host bits
• Subnet ID, Broadcast ID & Unicast range
• Format:
– 4 octets, dotted decimal notation (same as IP address)
– Contiguous binary 1’s starting from the left
• Examples:
– 255.255.255.0 (typical for LAN segment)
– 255.255.255.252 (typical for WAN pvc)
– 255.255.255.1 (incorrect)
10
Subnet Mask in Binary
• 255.255.255.0
• 11111111.11111111.11111111.00000000
• 255.255.255.252
• 11111111.11111111.11111111.11111100
• 255.255.255.1 - incorrect
• 11111111.11111111.11111111.00000001
11
Subnet Calculation
• Step 1 – Convert:
– decimal address & mask format to binary address & mask
format
• Step 2 – Apply:
– binary subnet mask to the binary IP address using the
“and” function
• Step 3 – Calculate:
– Subnet ID
– Broadcast ID
– Unicast range (usable subnet addresses)
12
Step 1 XXX = 0 - 255
DECIMAL
XXX.XXX.XXX.XXX
address 185.213.22.219
subnet mask 255.255.255.0
13
Step 1
XXXXXXXX = 00000000 - 11111111
xxxxxxxx.xxxxxxxx.xxxxxxxx.xxxxxxxx
BINARY
10111001.11010101.00010110.11011011
11111111.11111111.11111111.00000000
14
Step 2: IP Subnet Calculation
Subnet MASK
<AND> IP Address
IP Subnet
<AND> Rules:
1 and 1 = 1
1 and 0 = 0 Another way:
0 and 1 = 0 1 and X = X
0 and 0 = 0 0 and X = 0
15
Step 3 – IP Subnet – Example 1
185.213.022.219 255.255.255.000 /24
11111111.11111111.11111111.00000000
________.11010101.00010110.11011011
Subnet ID
Broadcast ID
11111111.11111111.11111111.11111100
________.11010101.00010110.11011011
Subnet ID
Broadcast ID
255.255.255.240 = /28
32 - 28 = 4
24 = 16 Addresses on Subnet
16 - 2 = 14 Unicast addresses on Subnet
18
Host Route
• Purpose:
– Used on Loopback and Dial-up interfaces
• Example:
– 10.5.109.22 255.255.255.255 (/32)
19
IP Subnet example 3
• IP Address: ____.____.____.____
• Subnet Mask: ____.____.____.____ ____
• Network bits ____ Host bits ____
• Subnet: ____.____.____.____
• Broadcast: ____.____.____.____
• Usable Range: ____.____.____.____
• through ____.____.____.____
20