IP Addressing

Download Report

Transcript IP Addressing

Number Systems
Network Math
www.thinkgeek.com
Binary presentation of data

The American Standard Code for Information Interchange
(ASCII) is the most commonly used code for representing
alpha-numeric data in a computer.
Bits and bytes
Base 10 number system – The Math




The decimal number system: based on powers of 10.
Each column position of a value, from right to left, is multiplied by the
number 10, which is the base number, raised to a power, which is the
exponent.
The power that 10 is raised to depends on its position to the left of the
decimal point.
2134 = (2x103) + (1x102) + (3x101) + (4x100)
Base 10 (Decimal) Number System
Digits (10): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
Number of:
104
103
10,000’s 1,000’s
102
100’s
101
10’s
100
1’s
Rick’s Number System Rules


All digits start with 0
A Base-n number system has n number of digits:





Decimal: Base-10 has 10 digits
Binary: Base-2 has 2 digits
Hexadecimal: Base-16 has 16 digits
The first column is always the number of 1’s
Each of the following columns is n times the previous
column (n = Base-n)



Base 10:
Base 2:
Base 16:
10,000
16
65,536
1,000
8
4,096
100
4
256
10
2
16
1
1
1
Base 2 number system – The Math

101102 = (1 x 24 = 16) + (0 x 23 = 0) + (1 x 22 = 4) + (1
x 21 = 2) + (0 x 20 = 0) = 22 (16 + 0 + 4 + 2 + 0)
Base 2 (Binary) Number System
Digits (10): 0, 1
Number of:
27
26
25
128’s 64’s 32’s
Dec.
2
10
17
70
130
255
24
16’s
23
22
8’s 4’s
1
0
21
20
2’s 1’s
1
1
0
0
Converting between Decimal and Binary
Digits (10): 0, 1
Number of:
27
26
25
128’s 64’s 32’s
Dec.
1
0
1
0
0
0
1
0
0
172
192
24
16’s
0
0
0
0
23
22
8’s 4’s
0
1
0
0
1
0
0
0
21
20
2’s 1’s
1
0
0
0
0
0
0
0
Computers do Binary
0


Bits have two values: OFF and ON
The Binary number system (Base-2) can represent OFF and
ON very well since it has two values, 0 and 1




1
0 = OFF
1 = ON
Understanding Binary to Decimal conversion is critical in
networking.
Although we use decimal numbers in networking to display
information such as IP addresses (LATER), they are
transmitted as OFF’s and ON’s that we represent in binary.
Rick’s Program
Rick’s Program
Rick’s Program
IP Addressing Scheme
Where the network part ends ant the host part begins
depends on the subnet mask or classful address (coming).
Divide into four 8 bit sections (octets).
Convert from binary to decimal.
IP Addresses
Dotted-Decimal Notation
The 32 bits of an IP address are
grouped into 4 bytes:
10000011
01101100
01111010
11001100
IP Addresses
We use dotted notation (or dotted decimal
notation) to represent the value of each byte (octet) of
the IP address in decimal.
10101001 11000111 01000101 10001001
169
199
69
137
IP Addresses
An IP address has two parts:


network number
host number
A third part will be added shortly: Subnet Part
IP Addresses
Which bits refer to the network number?
Which bits refer to the host number?
Answer:

Classful IP Addressing



Value of first octet determines the network portion and the host portion.
Used with classful routing protocols like RIPv1.
Classless IP Addressing (Next week)




Value of first octet does NOT matter.
The subnet mask determines the network portion and the host portion.
Hosts and Classless Inter-Domain Routing (CIDR).
Classless IP Addressing is what is used within the Internet and in most
internal networks.
Classful IP Addressing


This chapter discusses Classful IP Addressing and Classful
Subnetting.
Next week we will discuss Classless IP Addressing and
Classless Subnetting which is very similar to Classful.
Classful IP Addressing

There are 5 classes of IP addresses:
 Class A
 Class B
 Class C
 Class D
 Class E
Address Classes
Class A
Used for Internet hosts
Class B
Class C
Class D
Class E
Used for Internet hosts
Used for Internet hosts
Used for Internet multicasts
Unused (used “experimentally”)
Computers on the Internet can only be addressed
using Class A, Class B, or Class C addresses.
Determining Address Class
Class A
Class B
First octet is between 0 - 127
First octet is between 128 - 191
Class C
Class D
Class E
First octet is between 192 - 223
First octet is between 224 - 239
First octet is between 240 - 255
Computers on the Internet can only be addressed
using Class A, Class B, or Class C addresses.
Address Classes
1st octet
2nd octet
3rd octet
4th octet
Class A
Network
Host
Host
Host
Class B
Network Network
Host
Host
Class C
Network Network Network
Host
N = Network number assigned by ARIN
(American Registry for Internet Numbers)
H = Host number assigned by administrator
Address Classes
Class A
85
45
31
158
Class B
168
65
114
201
Class C
210
144
235
56
Network
Host
Looking at Classful IP Addresses
Which part is network, what is the network address, and
what is the class?
1)
2)
3)
4)
5)
6)
7)
199.46.36.5
111.211.11.1
7.141.30.89
222.8.56.107
192.168.16.2
63.100.5.1
192.0.0.2
Looking at Classful IP Addresses
1)
2)
3)
4)
5)
6)
7)
IP Address
199.46.36.5
111.211.11.1
7.141.30.89
222.8.56.107
192.168.16.2
163.100.5.1
192.0.0.2
Network Address
192.46.36.0
111.0.0.0
7.0.0.0
222.8.56.0
192.168.16.0
163.100.0.0
192.0.0.0
Class
Class C
Class A
Class A
Class C
Class C
Class B
Class C
What are the range of hosts for each of these networks?


All zeroes in the host portion is the network address
All ones in the host portion is the broadcast address (coming).
Looking at Classful IP Addresses
1)
IP Address
199.46.36.5
Class C
199
46
36
HOST
11000111
00101110
00100100
00000000
11000111
11000111
11000111
11000111
11000111
00101110
00101110
00101110
00101110
00101110
00100100
00100100
00100100
00100100
00100100
00000001
00000010
00000011
Etc.
11111110
11000111
00101110
00100100
11111111
Network: 199.46.36.0
Hosts:
199.46.36.1 through 199.46.36.254
Broadcast: 199.46.36.255
1 Network
Address
254 Host
Addresses
28 - 2
1 Broadcast
Address
Looking at Classful IP Addresses
1)
IP Address
199.46.36.5
Class C
Network: 199.46.36.0
Hosts:
199.46.36.1 through 199.46.36.254
Broadcast: 199.46.36.255
2)
111.211.11.1 Class A
Network: 111.0.0.0
Hosts:
111.0.0.1 through 111.255.255.254
Broadcast: 111.255.255.255
3)
7.141.30.89
Class A
Network: 7.0.0.0
Hosts:
7.0.0.1 through 7.255.255.254
Broadcast: 7.255.255.255
Looking at Classful IP Addresses
Your Turn!
4)
IP Address
222.8.56.107 Class C
5)
192.168.16.2 Class C
6)
163.100.5.1
Class B
7)
192.0.0.2
Class B
Looking at Classful IP Addresses
4)
5)


IP Address
222.8.56.107 Class C
Network: 222.8.56.0
Hosts:
222.8.56.1 through 222.8.56.254
Broadcast: 222.8.56.255
192.168.16.2 Class C
Network: 192.168.16.0
Hosts:
192.168.16.1 through 192.168.16.254
Broadcast: 192.168.16.255
All zeroes in the host portion is the network address
All ones in the host portion is the broadcast address (coming).
Looking at Classful IP Addresses
6)
7)


IP Address
163.100.5.1
Class B
Network: 163.100.0.0
Hosts:
163.100.0.1 through 163.100.255.254
Broadcast: 163.100.255.255
192.0.0.2
Class B
Network: 192.0.0.0
Hosts:
192.0.0.1 through 192.0.0.254
Broadcast: 192.0.0.255
All zeroes in the host portion is the network address
All ones in the host portion is the broadcast address (coming).
IP Address Classes
N = Network number assigned by ARIN
(American Registry for Internet Numbers)
H = Host number assigned by administrator
IP Addressing

Network ID or Network Portion




Host on a network can only communicate directly with devices if
they have the same network ID
All zeros in the host portion of the address
Routers use the network ID when it forwards data on the Internet
 This is only partially true. The router uses the subnet mask to
determine the network ID, which is then used to forward data.
Network IDs cannot be used as an address for any device that is
attached to the network, such as hosts, router interfaces, etc.
Addressing: Network & Host
192.168.1.0
10.0.0.0
222.0.0.0
192.168.2.0
Routers are required when two hosts with
IP addresses on different networks need to communicate.
• What are some example Host IP addresses?
IP Addressing
192.168.1.0
10.0.0.0

222.0.0.0
192.168.2.0
Broadcast Address





Used to send data to all devices on the network
All ones in the host portion of the address
All devices pay attention to a broadcast
Broadcast addresses cannot be used as an address for any device that is
attached to the network.
What are the broadcast addresses for these networks?
Network IDs and ZIP Codes
Your Name
123 Main Street
Anytown, ST 12345
Valencia Community College
1800 S Kirkman Rd
Orlando, FL, 32811
ZIP codes direct your mail to your local post
office and your neighborhood. The street
address then directs the carrier to your home.
Subnets and Subnet Masks
Formalized in 1985, the subnet mask breaks
a single class A, B or C network in to
smaller pieces.


A “1” bit in the subnet mask means that the corresponding
bit in the IP address should be read as a network number
A “0” bit in the subnet mask means that the corresponding
bit in the IP address should be read as a host bit.
IPv4 Address Classes
1st octet
2nd octet
3rd octet
4th octet
Class A
Network
Host
Host
Host
Class B
Network Network
Host
Host
Class C
Network Network Network
Host
Class A addresses
First octet is between 0 - 127
Network
Number
between 0 - 127






Host
Host
Host
8 bits
8 bits
8 bits
With 24 bits available for hosts,
there a 224 possible addresses.
That’s 16,777,216 nodes!
There are 126 class A addresses.

0 and 127 have special meaning and are not used.
16,777,214 host addresses, one for network address and one for broadcast
address.
Only large organizations such as the military, government agencies, universities, and
large corporations have class A addresses.
Cable Modem ISPs have 24.0.0.0 and Pacbell DSL users have 63.0.0.0
Class A addresses account for 2,147,483,648 of the possible IPv4 addresses.
That’s 50 % of the total unicast address space, if classful was still used in the Internet!
Class B addresses
First octet is between 128 - 191
Network Network
Number
between
128 - 191




Host
Host
8 bits
8 bits
With 16 bits available for hosts,
there a 216 possible addresses.
That’s 65,536 nodes!
There are 16,384 (214) class B networks.
65,534 host addresses, one for network address and one for broadcast
address.
Class B addresses represent 25% of the total IPv4 unicast address space.
Class B addresses are assigned to large organizations including corporations
(such as Cisco, government agencies, and school districts).
Class C addresses
First octet is between 192 - 223
Network Network Network
Host
8 bits
Number
between
192 - 223



With 8 bits available for hosts,
there a 28 possible addresses.
That’s 256 nodes!
There are 2,097,152 possible class C networks.
254 host addresses, one for network address and one for broadcast
address.
Class C addresses represent 12.5% of the total IPv4 unicast address
space.
Problems with IPv4 Addressing


Address Depletion
Internet Routing Table Explosion
Class D and E
12.5%
Class C
12.5%
Class B
25%
Class A
50%
IP address shortage


In the early days of the Internet, IP addresses were allocated to
organizations based on request rather than actual need.
No medium size - Hosts:

Class A: 16 million (approx.)

Class B: 65,536

Class C: 256
Subnet Mask

The solution to the IP address shortage was thought to be the subnet
mask.

Formalized in 1985 (RFC 950), the subnet mask breaks a single class A, B
or C network in to smaller pieces.
Solutions to IP Address shortage

Classless Inter-Domain Routing (CIDR)

VLSM and Route Aggregation (supernetting, route summarization)

NAT/PAT

IPv6
The Subnet Mask





The Subnet Mask corresponds to the IP address.
A “1” bit in the subnet mask means that the corresponding
bit in the IP address should be read as a network number
A “0” bit in the subnet mask means that the corresponding
bit in the IP address should be read as a host bit.
The Subnet Mask is a 32-bit number.
Its job is to tell routers (and humans) which bits are
network number and which bits are used to
represent hosts.
The Default Subnet Masks (no subnets)
1st octet
2nd octet
3rd octet
4th octet
Class A
Network
Host
Host
Host
Class B
Network Network
Host
Host
Class C
Network Network Network
Host
Class A or /8
11111111
00000000
00000000
00000000
Class B or /16
11111111
11111111
00000000
00000000
Class C or /24
11111111
11111111
11111111
00000000
A “1” bit in the subnet mask means that the corresponding bit in the IP
address should be read as a network number
 A “0” bit in the subnet mask means that the corresponding bit in the IP
address should be read as a host bit.
 /n “slash” tells us how many “1” bits are in the subnet mask.

The Default Subnet Masks (no subnets)
1st octet
2nd octet
3rd octet
4th octet
Class A
Network
Host
Host
Host
Class B
Network Network
Host
Host
Class C
Network Network Network
Host
Class A or /8
255
0
0
0
Class B or /16
255
255
0
0
Class C or /24
255
255
255
0
A “1” bit in the subnet mask means that the corresponding bit in the IP
address should be read as a network number
 A “0” bit in the subnet mask means that the corresponding bit in the IP
address should be read as a host bit.

What is subnetting?
Network Network
172
16
Network Network





Host
Host
0
0
Subnet
Host
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, one for the subnet IP
address and one for the subnet broadcast IP address.
You lose 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. (This subnet can be
used in most networks.)
Analogy
100 apples = 98 Usable Apples
Before subnetting:

In any network (or subnet) we can
not use all the IP addresses for host
addresses.

We lose two addresses for every
network or subnet.
1. Network Address - One address is
reserved to that of the network. For
Example: 207.21.54.0 /16
2. Broadcast Address – One address is
reserved to address all hosts in that
network or subnet. For Example:
207.21.54.255
This gives us a total of 254 usable
hosts
Analogy
98 Apples
(100 – 2)

10 barrels x 10 apples = 100 apples
10
10
10
10
10
10
10
10
10
It is the same as taking a barrel of 100 apples
and dividing it into 10 barrels of 10 apples
each.
10
2 = 1 network address + 1 broadcast address
9 barrels x 8 apples = 72 apples
8
8
(less 2)
98 Apples
(100 – 2)
8
(less 2)

(less 2)
8
(less 2)
8
(less 2)

(less 2)
8
8

8
(less 2)
8
(less 2)
However, in subnetting we will see that we lose two
apples per subnet, one for the address and one for the
broadcast.
We also lose the last basket of apples, subnet, as it
contains the broadcast address for the entire network.
In older networks, we also lost the first basket, subnet,
as it contained the address of the entire network, but
this is usually no longer the case.
(less 2)
X
10
X
Subnetting a Class C Address
Class C address 207.21.54.0
Address
Default Mask
Network
207
Network
21
Network
54
Host
0
255
11111111
255
11111111
255
11111111
0
00000000
Network Network Network
Host
8 bits
Number
between
192 - 223
With 8 bits available for hosts,
there a 28 possible addresses.
That’s 256 nodes!
Subnetting a Class C Address
Class C address 207.21.54.0
Address
Default Mask




Network
207
Network
21
Network
54
Host
0
255
11111111
255
11111111
255
11111111
0
00000000
Network Address: 207.21.54.0
(note this address)
Default Mask:
255.255.255.0 (/24)
Broadcast Address: 207.21.54.255 (note this address)
Hosts: 207.21.54.1 through 207.21.54.254
Class C: 4-bit Mask (/28)
Address
Subnet
Mask




Network
207
Network
21
Network Subnet Host
54
0
11001111
00010101
00110110
00000000
11111111
11111111
11111111
11110000
255
255
255
240
Network Address: 207.21.54.0
(note this address)
Broadcast Address: 207.21.54.255 (note this address)
Default Mask:
Subnet Mask:
255.255.255.0
255.255.255.240
207.21.54.0/28 (Subnet mask 255.255.255.240)
Subnets
What are the hosts for each subnet?
11001111
00010101
00110110
00000000
207.21.54.0/28
11001111
00010101
00110110
00010000
207.21.54.16/28
11001111
00010101
00110110
00100000
207.21.54.32/28
11001111
00010101
00110110
00110000
207.21.54.48/28
11001111
00010101
00110110
01000000
207.21.54.64/28
11001111
00010101
00110110
01010000
207.21.54.80/28
11001111
00010101
00110110
01100000
207.21.54.96/28
11001111
00010101
00110110
01110000
207.21.54.112/28
11001111
00010101
00110110
10000000
207.21.54.128/28
11001111
00010101
00110110
10010000
207.21.54.144/28
11001111
00010101
00110110
10100000
207.21.54.160/28
11001111
00010101
00110110
10110000
207.21.54.176/28
11001111
00010101
00110110
11000000
207.21.54.192/28
11001111
00010101
00110110
11010000
207.21.54.208/28
11001111
00010101
00110110
11100000
207.21.54.224/28
11001111
00010101
00110110
11110000
207.21.54.240/28
207.21.54.0/28 (Subnet mask 255.255.255.240)
11001111
00010101
00110110
01100000
Network Address
207.21.54.96/28
11001111
00010101
00110110
01100001
207.21.54.97/28
11001111
00010101
00110110
01100010
207.21.54.98/28
11001111
00010101
00110110
01100011
207.21.54.99/28
11001111
00010101
00110110
01100100
207.21.54.100/28
11001111
00010101
00110110
01100101
207.21.54.101/28
11001111
00010101
00110110
01100110
207.21.54.102/28
01100111
207.21.54.103/28
01101000
207.21.54.104/28
14 Usable
Hosts
00010101
00110110
11001111
00010101
00110110
11001111
11001111
00010101
00110110
01101001
207.21.54.105/28
11001111
00010101
00110110
01101010
207.21.54.106/28
11001111
00010101
00110110
01101011
207.21.54.107/28
11001111
00010101
00110110
01101100
207.21.54.108/28
11001111
00010101
00110110
01101101
207.21.54.109/28
11001111
00010101
00110110
01101110
207.21.54.110/28
01101111
Broadcast Address
207.21.54.111/28
11001111
00010101
00110110
207.21.54.0/28 (Subnet mask 255.255.255.240)
Subnets
00000000
207.21.54.0/28
00010000
207.21.54.16/28
00100000
207.21.54.32/28
00110000
207.21.54.48/28
00110110
01000000
207.21.54.64/28
00010101
00110110
15 usable
subnets with
14
00110110
hosts00010101
per subnet = 210
usable
hosts. (Lose 00110110
2
00010101
hosts00010101
per subnet, subnet
00110110
and broadcast.)
01010000
207.21.54.80/28
01100000
207.21.54.96/28
01110000
207.21.54.112/28
10000000
207.21.54.128/28
10010000
207.21.54.144/28
10100000
207.21.54.160/28
11001111
00010101
00110110
Can’t use last subnet,
because the 00110110
broadcast
11001111
00010101
address for that subnet is 207.21.54.255, the
11001111
00010101
same as the broadcast
address for 00110110
the entire
network. You lose
all those hosts. 00110110
11001111
00010101
10110000
207.21.54.176/28
11000000
207.21.54.192/28
11010000
207.21.54.208/28
11100000
207.21.54.224/28
11001111
11110000
207.21.54.240/28
11001111
00010101
00110110
Can
use the first subnet
on newer networks,
11001111
00010101
00110110even
though
the subnet 00010101
address 207.21.54.0
is the
11001111
00110110
same as the address for the entire network.
11001111
00010101
00110110
11001111
11001111
11001111
11001111
11001111
11001111
11001111
00010101
00010101
00110110
(25400010101
without subnetting)
00110110
00010101
00110110
Other subnetting options…
Address
Subnet
Mask
Network
207
Network
21
Network Subnet Host
54
0
11001111
00010101
00110110
00000000
11111111
11111111
11111111
11110000
255
255
255
240
What Subnet Mask to use?:

More subnets, but fewer hosts per subnet.

Fewer subnets, but more hosts per subnet.

Choose mask that gives you enough hosts for your largest subnet, but
also gives you enough subnets, including future expansion.
Better Solutions:

RFC 1918 – Priviate Address Space (next week)

VLSM (Variable Length Subnet Masks) – Semester 2
Class C: 2-bit Mask (/26)
3 usable subnets, 62 usable hosts per subnet
Address
Mask
Network
207
Network
21
Network Sub Host
54
0
11001111
11111111
00010101
11111111
00110110
11111111
00000000
11000000
255
255
255
192
Class C: 3-bit Mask (/27)
7 usable subnets, 30 usable hosts per subnet
Address
Mask
Network
207
Network
21
Network
54
Sub Host
0
11001111
11111111
00010101
11111111
00110110
11111111
00000000
11100000
255
255
255
224
Class C: 4-bit Mask (/28)
15 usable subnets, 14 usable hosts per subnet
Address
Mask
Network
207
Network
21
Network
54
Sub Host
0
11001111
11111111
00010101
11111111
00110110
11111111
00000000
11110000
255
255
255
240
Class C: 5-bit Mask (/29)
31 usable subnets, 6 usable hosts per subnet
Address
Mask
Network
207
Network
21
Network
54
Sub
Host
11001111
11111111
00010101
11111111
00110110
11111111
00000000
11111000
255
255
255
248
0
Class C: 6-bit Mask (/30)
63 usable subnets, 2 usable hosts per subnet
Address
Mask
Network
207
Network
21
Network
54
Sub
Host
11001111
11111111
00010101
11111111
00110110
11111111
00000000
11111100
255
255
255
252
0
Logical And – Why

Why: The logical AND function is used to extract the
subnet ID from a host IP address and its subnet Mask

Question: With out using the table from the previous group
exercise, can you tell to which subnet the host 200.133.175.199
belongs???
Logical And – How
Host IP Address (in binary format)
AND
Subnet Mask (in binary format)
= Subnet ID
1 And 1 = 1
1 And 0 = 0
0 And 0 = 0
0 and 1 = 0
Short cut: X And 255 = X
X And 0 = 0
Logical AND Exercise

Given the IP Address: 199.10.10.110/248






What is the subnet mask?
How many bits were borrowed?
How many subnets were created
What is the number of theoretical hosts per subnet?
Using the Logical And function, find the subnet ID where the host resides
What is the broadcast address for this subnet?
Example



Say company XYZ was assigned a Class C network number of
200.100.50.0/24 (apologies to anyone who may actually own this
domain address:). You want to utilize this network between two
departments within the company. You can do this by subnetting that
network.
Break this network into 4 subnets of 32 IP addresses each.
Connect the subnets Using layer three devices (Routers).
Building the Topology


Now, we will use real Cisco routers and switches to connect two LANs (Let’s say,
the HR department LAN and the IT department LAN)
During this lab make sure that you take the time to do the following:




Check the different types of interfaces that a router can have
Know what each type of an interface is used for
Know what type of cable is used with each interface
Ask Questions
Default Gateway


The role of Routers in connecting subnets
What is a Gateway?

Combination of software and hardware that enable two different network
segments to exchange data

Examples: Cisco Routers, Linksys routes, Linux servers with multiple NICs
and routing services installed, windows 2000 server with multiple NICs and
RRAS installed.

The IP address of a router’s port through which a network is connected to the
router

Every device has to have a default gateway to communicate with other
devices outside its network
Rules
1. Each router’s interface has to be on a separate network ( You can’t have two different
interfaces on the same network)
2. Each interface on the router has to be assigned an ip address and a subnet mask
3. Routers’ interfaces usually take the first available IP address on a network
4. Switches are layer 2 devices and do not need an IP address to work
5. Each PC on the network must be configured with the correct IP properties. Your PC will need
an IP address and a subnet mask to be able to communicate with other hosts on the same
network. Your PC will need a default gateway to be able to communicate with other hosts on a
different network
6. PCs and their Default Gateway must belong to the same network.
iMac
iMac
iMac
iMac
iMac
iMac
iMac
iMac
Building The Topology with Packet Tracer



Interconnect Devices
Simulate how a Packet traverses a simple WAN
How would it be if we added a third network to the
diagram, Let’s say Admin LAN?
Subnetting Class B
Subnet Example
Class B address 172.16.0.0
Using Subnets: subnet mask 255.255.252.0 or /22
Network Network
Subnet
Host
Default Subnet Mask:
255.255.0.0 or /16
11111111
11111111
00000000
00000000
New Subnet Mask:
255.255.252.0 or /22
11111111
11111111
11111100
00000000



Applying a mask which is larger than the default subnet mask, will
divide your network into subnets.
Class B default subnet mask is 255.255.0.0 or /16
Subnet mask used here is 255.255.252.0 or /22
Subnet Example
Class B address 172.16.0.0
Using Subnets: subnet mask 255.255.252.0 or /22
Network Network
Subnet
Host
172
172
16
16
0
4
Host
Host
172
172
172
172
16
16
16
16
8
12
Etc.
248
Host
Host
Host
Host
172
16
252
Host
Subnets
63
Subnets
26 - 1
Cannot use last
subnet as it
contains broadcast
address
Putting it all together!
Putting it all together!
Host IP Address
138.101.114.250
Class
B
Subnet Address of This
Subnet or Wire

Subnet Mask
No. of
Subnet
Bits
Maximum
Ordinal
# of Subnets Number of
s = (n – 2)
this Subnet
255.255.255.192
Range of Host Addresses
For this subnet
Broadcast Address of This
Subnet
Given the following Host IP Address and Subnet mask fill in the blanks
including:

Subnet Address

Range of Host Addresses

Broadcast Address
Putting it all together!
IP Address
Mask
138.
10001010
11111111
255.
101.
01100101
11111111
255.
114.
01110010
11111111
255.
250
11111010
11000000
192
Step 1:
Translate Host IP Address and Subnet Mask into binary notation
Putting it all together!
Host IP Address
138.101.114.250
IP Address
Mask
Network
Class
B
Subnet Mask
255.255.255.192
138.
10001010
11111111
10001010
138
101.
01100101
11111111
01100101
101
114.
01110010
11111111
01110010
114
250
11111010
11000000
11000000
192
Step 2:
Determine the Network (or Subnet) where this Host address lives:
1. Draw a line under the mask
2. Perform a bit-wise AND operation on the IP Address and the Subnet
Mask

1 AND 1 results in a 1

0 AND anything results in a 0
3. Express the result in Dotted Decimal Notation
4. The result is the Subnet Address of this Subnet or “Wire” which is
138.101.114.192
Putting it all together!
Host IP Address
138.101.114.250
IP Address
Mask
Network
Class
B
Subnet Mask
255.255.255.192
138.
10001010
11111111
10001010
138
101.
01100101
11111111
01100101
101
114.
01110010
11111111
01110010
114
250
11111010
11000000
11000000
192
More on the bit-wise AND operation to determine Subnet Address
Performed on the IP Address and the Subnet Mask

1 AND 1 results in a 1

0 AND anything results in a 0
End result is to get the Subnet (or Network) address:

Copy all bits in IP address that is above the 1’s in the subnet
mask

The rest of the bits to the right are 0’s
Putting it all together!
Host IP Address
138.101.114.250
Class
B
Subnet Mask
255.255.255.192
G.D.
IP Address
Mask
Network
10001010
11111111
10001010
01100101
11111111
01100101
S.D.
01110010
11 111010
11111111
11 000000
01110010
11 000000
 subnet
  host 
counting range
counting
range
Step 3:
Determine which bits in the address contain Network information and
which contain Host information:

Divide the Classful address (Great Divide) from the rest of the address.

Divide the subnet from the hosts (Small Divide) between the last “1” and the
first “0” in the subnet mask.
Host IP Address
138.101.114.250
Class
B
Subnet Mask
255.255.255.192
G.D.
S.D.
IP Address
Mask
Network
10001010
11111111
10001010
01100101
11111111
01100101
01110010
11 111010
11111111
11 000000
01110010
11 000000
 subnet
  host 
counting range
counting
range
First Host
10001010
138
01100101
101
01110010
114
11
000001
193
Last Host
10001010
138
01100101
101
01110010
114
11
111110
254
Broadcast
10001010
138
01100101
101
01110010
114
11
111111
255
Host Portion

First Host: all 0’s and a 1

Last Host: all 1’s and a 0

Broadcast: all 1’s
All in one page!
G.D.
S.D.
IP Address
Mask
Network
10001010
11111111
10001010
01100101
11111111
01100101
01110010
11 111010
11111111
11 000000
01110010
11 000000
 subnet
  host 
counting range
counting
range
First Host
10001010
138
01100101
101
01110010
114
11
000001
193
Last Host
10001010
138
01100101
101
01110010
114
11
111110
254
Broadcast
10001010
138
01100101
101
01110010
114
11
111111
255
Host IP Address
Class
138.101.114.250
B
Subnet Address of This
Subnet or Wire
138.101.114.192
Subnet Mask
255.255.255.192
No. of
Subnet
Bits
10
Range of Host Addresses
For this subnet
138.101.114.193 through
138.101.114.254
Maximum
# of Subnets
s = (n – 2)
1022=(10242)
Ordinal
Number of
this Subnet
459
Broadcast Address of This
Subnet
138.101.114.255
Host IP Address
Class
138.101.114.250
B
Subnet Address of This
Subnet or Wire
138.101.114.192
IP Address
Mask
Network
138.
10001010
11111111
10001010
138
Subnet Mask
255.255.255.192
No. of
Subnet
Bits
10
Range of Host Addresses
For this subnet
138.101.114.193 through
138.101.114.254
101.
01100101
11111111
01100101
101
Maximum
# of Subnets
s = (n – 2)
1022=(10242)
Ordinal
Number of
this Subnet
459
Broadcast Address of This
Subnet
138.101.114.255
114.
01110010
11111111
01110010
114
250
11111010
11000000
11000000
192
Number of Subnet bits

Number of bits in the subnet mask which are greater than the
default mask.
Maximum number of Subnet

The number of subnets to the second power.

102 = 1,024

Subtract the last one which is the broadcast subnet = 1,023

Some documentation says subtract two, first and last = 1,022
Host IP Address
Class
138.101.114.250
B
Subnet Address of This
Subnet or Wire
138.101.114.192
IP Address
Mask
Network
138.
10001010
11111111
10001010
138
Subnet Mask
255.255.255.192
No. of
Subnet
Bits
10
Range of Host Addresses
For this subnet
138.101.114.193 through
138.101.114.254
101.
01100101
11111111
01100101
101
Maximum
# of Subnets
s = (n – 2)
1022=(10242)
Ordinal
Number of
this Subnet
459
Broadcast Address of This
Subnet
138.101.114.255
114.
01110010
11111111
01110010
114
250
11111010
11000000
11000000
192
Ordinal Number of this Subnet

This will tell you which number is this subnet in the list.

Use the number of subnet bits, 10.
0000000000 = subnet 0
0000000101 = subnet 5
0000000001 = subnet 1
Etc.
0000000010 = subnet 2
0111001011 = subnet 459
0000000011 = subnet 3
Etc.
0000000100 = subnet 4
1111111111 = subnet 1,023
Case 1
1.
Suppose you are given the IP address
195.5.5.0 and wish to connect
Springfield and Bedrock to Southpark.
Create an IP addressing scheme that
will meet the following requirements:

A: Each subnet must support
between 25 and 30 devices.

B: You must have enough
subnets to address each network.
i.
What is the subnet mask for this network?
ii.
What is the broadcast address of the 3rd subnet?
iii.
On the diagram, assign a subnet address to each network and give each
router interface an appropriate IP address for that network.
List of networks
Case 1 Answer
for the 195.5.5.0 network with the subnet mask 255.255.255.224
192.5.5.33/27
Hosts
Network
from
195.5.5.0
195.5.5.1
192.5.5.65/27
Southpark
Broadcast Address
to
195.5.5.30 195.5.5.31
195.5.5.32 195.5.5.33 195.5.5.62 195.5.5.63
192.5.5.34/27
192.5.5.66/27
195.5.5.64 195.5.5.65 195.5.5.94 195.5.5.95
195.5.5.96 195.5.5.97 195.5.5.126 195.5.5.127
195.5.5.128 195.5.5.129 195.5.5.158 195.5.5.159
Springfield
192.5.5.97/27
Bedrock
192.5.5.129/27
195.5.5.160 195.5.5.161 195.5.5.190 195.5.5.191
195.5.5.192 195.5.5.193 195.5.5.222 195.5.5.223
195.5.5.224 195.5.5.225 195.5.5.254 195.5.5.255
-
IP:192.5.5.98/27
SM: 255.255.255.224
GW: 192.5.5.97
IP:192.5.5.130/27
SM: 255.255.255.224
GW: 192.5.5.129
Rules
1. Each router’s interface has to be on a separate network ( You can’t have two different
interfaces on the same network)
2. Each interface on the router has to be assigned an ip address and a subnet mask
3. Routers’ interfaces usually take the first available IP address on a network
4. Switches are layer 2 devices and do not need an IP address to work
5. Each PC on the network must be configured with the correct IP properties. Your PC will net
an IP address and a subnet mask to be able to communicate with other hosts on the same
network. Your PC will net a default gateway to be able to communicate with other hosts on a
different network
6. PCs and their Default Gateway must belong to the same network.
Case 2

a.
b.
c.
d.
e.
Given the IP address 199.199.199.172 with a subnet mask of
255.255.255.192. Answer the following:
How many bits were borrowed?
How many subnets have been created?
How many host address per subnet?
What is the subnet address of the network containing the given IP address?
What is the broadcast address of the network containing the given IP
address?
Case 2 Answer
List of networks
for the 199.199.199.0 network with the subnet mask 255.255.255.192
Hosts
Network
from
199.199.199.0
199.199.199.1
Broadcast Address
to
199.199.199.62 199.199.199.63
199.199.199.64 199.199.199.65 199.199.199.126 199.199.199.127
199.199.199.128 199.199.199.129 199.199.199.190 199.199.199.191
199.199.199.192 199.199.199.193 199.199.199.254 199.199.199.255
A: 2
B: 4
C: 64
D: 199.199.199.128
E: 199.199.1299.191