An IP address is an address used to uniquely
identify a device on an IP network.
The address is made up of 32 binary bits
which can be divisible into a network
portion and host portion with the help of a
subnet mask.
32 binary bits are broken into four octets (1
octet = 8 bits)
Dotted decimal format (for example,
[Link])
32 bits
Dotted
Decimal Network Host
Maximum 255 255 255 255
32 bits
Dotted
Decimal Network Host
Maximum 255 255 255 255
1 8 9 16 17 24 25 32
Binary 11111111 11111111 11111111 11111111
128
64
32
16
8
4
2
1
128
64
32
16
8
4
2
1
128
64
32
16
8
4
2
1
128
64
32
16
8
4
2
1
32 bits
Dotted
Decimal Network Host
Maximum 255 255 255 255
1 8 9 16 17 24 25 32
Binary 11111111 11111111 11111111 11111111
128
64
32
16
8
4
2
1
128
64
32
16
8
4
2
1
128
64
32
16
8
4
2
1
128
64
32
16
8
4
2
1
Example
Decimal
172 16 122 204
Example 10101100 00010000 01111010 11001100
Binary
8 bits 8 bits 8 bits 8 bits
Class A: Network Host Host Host
Class B: Network Network Host Host
Class C: Network Network Network Host
Class D: Multicast
Class E: Research
Bits: 1 8 9 16 17 24 25 32
0NNNNNNN Host Host Host
Class A:
Range (1-126)
Bits: 1 8 9 16 17 24 25 32
10NNNNNN Network Host Host
Class B:
Range (128-191)
1 8 9 16 17 24 25 32
Bits:
110NNNNN Network Network Host
Class C:
Range (192-223)
1 8 9 16 17 24 25 32
Bits:
1110MMMM Multicast Group Multicast Group Multicast Group
Class D:
Range (224-239)
[Link] [Link]
[Link]
E1
[Link] E0 [Link]
[Link]
[Link] [Link]
Routing Table
172.16 . 12 . 12 Network Interface
Network Host [Link] E0
[Link] E1
Address Class Network Host
[Link]
[Link]
[Link]
[Link]
[Link]
[Link]
Address Class Network Host
[Link] A [Link] [Link]
[Link] B [Link] [Link]
[Link] C [Link] [Link]
[Link] C [Link] [Link]
[Link] B [Link] [Link]
[Link] Nonexistent
[Link] [Link] [Link] [Link] [Link]
…...
[Link]
Network [Link]
[Link]
[Link]
[Link] [Link]
Network [Link]
[Link] [Link]
[Link]
E1
[Link] E0 [Link]
[Link]
[Link] [Link]
New Routing Table
172.16 . 2 . 160 Network Interface
Network Host [Link] E0
[Link] E1
[Link] [Link]
[Link]
E1
[Link] E0 [Link]
[Link]
[Link] [Link]
New Routing Table
172.16 . 2 . 160 Network Interface
Network Subnet Host [Link] E0
[Link] E1
Network Host
IP
Address
172 16 0 0
Network Host
Default
Subnet
Mask
255 255 0 0
11111111 11111111 00000000 00000000
Also written as “/16” where 16 represents the number of 1s in the
mask.
Network Subnet Host
8-bit
Subnet 255 255 255 0
Mask
Also written as “/24” where 24 represents the number of 1s in the
mask.
128 64 32 16 8 4 2 1
1 0 0 0 0 0 0 0 = 128
1 1 0 0 0 0 0 0 = 192
1 1 1 0 0 0 0 0 = 224
1 1 1 1 0 0 0 0 = 240
1 1 1 1 1 0 0 0 = 248
1 1 1 1 1 1 0 0 = 252
1 1 1 1 1 1 1 0 = 254
1 1 1 1 1 1 1 1 = 255
Network Host
[Link] 10101100 00010000 00000010 10100000
[Link] 11111111 11111111 00000000 00000000
10101100 00010000 00000000 00000000
Network
172 16 0 0
Number
Subnets not in use—the default
Network Subnet Host
[Link] 10101100 00010000 00000010 10100000
[Link] 11111111 11111111 11111111 00000000
10101100 00010000 00000010 00000000
128
192
224
240
248
252
254
255
Network
Number 172 16 2 0
Network number extended by eight bits
Network Subnet Host
[Link] 10101100 00010000 00000010 10100000
[Link] 11111111 11111111 11111111 11000000
10101100 00010000 00000010 10000000
128
192
224
240
248
252
254
255
128
192
224
240
248
252
254
255
Network
Number 172 16 2 128
Network number extended by ten bits
Address Subnet Mask Class Subnet
[Link] [Link]
[Link] [Link]
[Link] [Link]
Address Subnet Mask Class Subnet
[Link] [Link] B [Link]
[Link] [Link] A [Link]
[Link] [Link] A [Link]
[Link]
[Link]
[Link]
[Link] [Link]
(Directed broadcast)
[Link]
(Local network broadcast)
[Link]
(All subnets broadcast)
Class A: The first octet is the network
portion. Octets 2, 3, and 4 are for
subnets/hosts
Class B: The first two octets are the
network portion. Octets 3 and 4 are for
subnets/hosts
Class C: The first three octets are the
network portion. Octet 4 is for
subnets/hosts
Address Class Reserved Address Space
Class A [Link] - [Link]
Class B [Link] - [Link]
Class C [Link] - [Link]
Reserved or (by convention) special addresses:
Loopback interfaces
all addresses [Link]-[Link] are reserved for loopback interfaces
Most systems use [Link] as loopback address
loopback interface is associated with name “localhost”
IP address of a network
Host number is set to all zeros, e.g., [Link]
Broadcast address
Host number is all ones, e.g., [Link]
Broadcast goes to all hosts on the network
Often ignored due to security concerns
Test / Experimental addresses
Certain address ranges are reserved for “experimental use”. Packets should get
dropped if they contain this destination address (see RFC 1918):
[Link] - [Link]
[Link] - [Link]
[Link]- [Link]
Convention (but not a reserved address)
Default gateway has host number set to ‘1’, e.g., e.g., [Link]
Distinguishes which portion of the
address identifies the network and which
portion of the address identifies the node.
Default masks:
ØClass A: [Link]
ØClass B: [Link]
ØClass C: [Link]
Classful Addressing: Classes and Blocks
Mask (default mask)
• Help us to find the NetId and HostId
• Mask: 32-bit made of 1s followed by 0s.
• Dose not apply to classes D and E.
• CIDR(Classless Interdomain Routing): used to show the
mask in the form /n (n=8,16,24)
CIDR Dotted-decimal Binary Class
/8 [Link] 11111111 00000000 00000000 00000000 A
/16 [Link] 11111111 11111111 00000000 00000000 B
/24 [Link] 11111111 11111111 11111111 00000000 C
Routers and hosts use an extended network
prefix (subnetmask) to identify the start of the
host numbers
128.143 137.144
network prefix host number
128.143 137 144
network prefix subnet host number
number
extended network prefix
1111111111111111 1111111100000000
subnetmask
Creates multiple logical networks that
exist within a single Class A, B, or C
network.
If you do not subnet, you will only be able
to use one network from your Class A, B,
or C network, which is unrealistic
Each data link on a network must have a
unique network ID, with every node on
that link being a member of the same
network
1) Reduced network traffic
2) Optimized network performance
3) Simplified management
4) Facilitated spanning of large geographical
distances
This command allows you to use the first
and last subnet in your network design.
For example, the Class C mask of 192
provides subnets 64 and 128, but with the
IP subnet-zero command, you now get to
use subnets 0, 64, 128, and 192
Figure out how many subnets you need
◦ You need one subnet for each network segment
◦ You also need one subnet for each WAN (wide area
network) connection
Figure out how many devices (hosts) each
subnet needs
◦ Count every device using TCP/IP (computers, phones,
servers, etc.)
◦ Count each router interface (each connection point
on a router)
Create your subnet plan
◦ Choose one subnet mask for the whole network
◦ Assign a unique subnet ID to each subnet
◦ Define a range of IP addresses (host IDs) for each
subnet
How many subnets does the chosen
subnet mask produce?
How many valid hosts per subnet are
available?
What are the valid subnets?
What’s the broadcast address of each
subnet?
What are the valid hosts in each subnet?
1. Number of Subnets
Number of Subnets = 2^n
n = number of bits borrowed from the
host portion
2. Number of Valid Hosts per Subnet
Hosts per Subnet = 2^h - 2
h = number of remaining host bits
Subtract 2 for:
◦ Network address
◦ Broadcast address
3. Subnet Increment (Block Size)
Block Size = 256 - Subnet Mask Value (in
interesting octet)
This helps you find valid subnet ranges
4. Broadcast Address
Broadcast = Next Subnet - 1
It is the last IP address in the subnet
5. Valid Host Range
First Host = Subnet Address + 1
Last Host = Broadcast Address - 1
6. TotalNumber of
Addresses per Subnet
Total Addresses= 2^h (Includes network
+ broadcast)
7. Number of Possible Subnets
Needed
2^n ≥required subnets
8. Number of Hosts Needed
2^h −2≥required hosts
How many subnets? Since 128 is 1 bit on (10000000), the
answer would be 21= 2.
How many hosts per subnet? We have 7 host bits off
(10000000), so the equation would be 27– 2 = 126 hosts.
What are the valid subnets? 256 – 128 = 128. Remember,
we’ll start at zero and count in our block size, so our
subnets are 0, 128.
What’s the broadcast address for each subnet? The
number right before the value of the next subnet is all
host bits turned on and equals the broadcast address. For
the zero subnet, the next subnet is 128, so the broadcast
of the 0 subnet is 127.
What are the valid hosts? These are the numbers between
the subnet and broadcast address
How many subnets? 224 is 11100000, so our
equation would be 23 = 8.
How many hosts? 25– 2 = 30.
What are the valid subnets? 256 – 224 = 32. We
just start at zero and count to the subnet mask
value in blocks (increments) of 32: 0, 32, 64, 96,
128, 160, 192, and 224.
What’s the broadcast address for each subnet
(always the number right before the next
subnet)?
What are the valid hosts (the numbers between
the subnet number and the broadcast address)?
Subnet 0 32 …………. 192 224
Address
First Host 1 33 193 225
Last Host 30 62 222 254
Broadcast 31 63 223 255
Address
Subnets? 21 = 2
Hosts? 215– 2 = 32,766 (7 bits in the third
octet, and 8 in the fourth)
Valid subnets? 256 – 128 = 128. 0, 128.
Remember that subnetting is performed
in the third octet, so the subnet numbers
are really 0.0 and 128.0, as shown in the
next table
Broadcast address for each subnet?
Valid hosts?
Subnet 0.0 128.0
First Host 0.1 128.1
Last Host 127.254 255.254
Broadcast 127.255 255.255
Subnets? 24= 16.
Hosts? 212 – 2 = 4094.
Valid subnets? 256 – 240 = 0, 16, 32, 48, etc.,
up to 240.
Broadcast address for each subnet?
Valid hosts?
Subnet 0.0 16.0 ……….. 240.0
First Host 0.1 16.1 240.1
Last Host 15.254 31.254 255.254
Broadcast 15.255 31.255 255.255
5 subnets needed
Can be assigned as follows:
ØnetA: [Link]/27 host address range 1 to 30
ØnetB: [Link]/27 host address range 33 to 62
ØnetC: [Link]/27 host address range 65 to 94
ØnetD: [Link]/27 host address range 97 to
126
ØnetE: [Link]/27 host address range 129 to
158
Given the same network and requirements as in Sample
Exercise 1 develop a subnetting scheme using VLSM, given:
◦ netA: must support 14 hosts
◦ netB: must support 28 hosts
◦ netC: must support 2 hosts
◦ netD: must support 7 hosts
◦ netE: must support 28 host
Determine what mask allows the required number of hosts.
◦ netA: requires a /28 ([Link]) mask to support 14 hosts
◦ netB: requires a /27 ([Link]) mask to support 28 hosts
◦ netC: requires a /30 ([Link]) mask to support 2 hosts
◦ netD: requires a /28 ([Link]) mask to support 7 hosts
◦ netE: requires a /27 ([Link]) mask to support 28 hosts
The easiest way to assign the subnets is to
assign the largest first. For example, you can
assign in this manner:
◦ netB: [Link]/27 host address range 1 to 30
◦ netE: [Link]/27 host address range 33 to 62
◦ netA: [Link]/28 host address range 65 to 78
◦ netD: [Link]/28 host address range 81 to 94
◦ netC: [Link]/30 host address range 97 to 98
Classless Interdomain Routing
Improve address space utilization
Routing scalability in the Internet
For example, if an ISP owns network
[Link]/16, then the ISP can offer
[Link]/24, [Link]/24,and so on to
[Link], when advertising to other
providers, the ISP only needs to advertise
[Link]/16
Subnet the class C Network address of
[Link]/27 and apply the diagragram
by configuring the IP Addresses of Router
interfaces and PCs, including the Default
Gateways of the PCs.