You are on page 1of 48

IP Addressing

RST-2002 © 2003, Cisco Systems, Inc. All rights reserved. 2


IP Addressing

• Basic Addressing
• Working with Addresses
• Summarization & Subnets
• VLSM
• Working with VLSM Networks
• Classful Addressing
• Working with Classful Addressing

RST-2002 © 2003, Cisco Systems, Inc. All rights reserved. 3


Basic Addressing

• IP addresses are Dots separate the sections


written in dotted
decimal format.
10.1.1.1
• Four sections are
separated by dots.
• Each section contains Each section
a number between 0 contains a number
and 255. between 0 and 255

RST-2002 © 2003, Cisco Systems, Inc. All rights reserved. 4


Basic Addressing

• Why is each section a number


between 0 and 255? Dots separate the sections
• Computers operate in
binary, humans operate in
decimal. 10.1.1.1
• Computers treat IP
addresses as a single large
32 digit binary number, but
this is hard for people to do.
• So, we split them up into Each section
four smaller sections so we contains a number
can remember and work
with them better! between 0 and 255
Why????

RST-2002 © 2003, Cisco Systems, Inc. All rights reserved. 5


Basic Addressing

10.1.1.1
• 32/4 == 8. 00001010 00000001 00000001 00000001
8 8 8 8
• 28 = 256.
32
• But, computers
number starting at 0, Each 8 digit group
so to make a space of represents a number
between 0 and 255
256 numbers, we
number from 0 to 255.

RST-2002 © 2003, Cisco Systems, Inc. All rights reserved. 6


Basic Addressing

• Each device on a network is


assigned an IP address. 10.1.1.1
• Each IP address has two
fundamental parts:
00001010 00000001 00000001 00000001
• The network portion, which
describes the physical wire

Network

Host
the device is attached to.
• The host portion, which
identifies the host on that
wire.
• How can we tell the difference
between the two sections?

RST-2002 © 2003, Cisco Systems, Inc. All rights reserved. 7


Basic Addressing

• The network mask shows 10.1.1.1


us where to split the
network and host sections. 00001010 00000001 00000001 00000001
• Each place there is a 1 in
the network mask, that

Network

Host
binary digit belongs to the
network portion of the
address.
• Each place there is a 0 in 11111111 11111111 11111111 00000000
the network mask, that
binary digit belongs to the
host portion of the address.
255.255.255.0

RST-2002 © 2003, Cisco Systems, Inc. All rights reserved. 8


Basic Addressing

• An alternative set of
10.1.1.1
terminology is:
• The network portion of 00001010 00000001 00000001 00000001
the address is called the
prefix.

Prefix

Host
• The host portion of the
address is called the host.
• The network mask is
expressed as a prefix 11111111 11111111 11111111 00000000
length, which is a count
of the number of 1’s in the 8 + 8 + 8 = 24
subnet mask.

10.1.1.1/24

RST-2002 © 2003, Cisco Systems, Inc. All rights reserved. 9


Basic Addressing

• The network address is 10 1 1 0/24


the IP address with all 00001010 000000011 00000001 00000000
0’s in the host bits. prefix host

• The broadcast address these bits are 0, so this is the network address
is the IP address with
all 1’s in the host bits. 10 1 1 255/24
00001010 000000011 00000001 11111111
• Packets sent to either
address will be prefix host
delivered to all the
these bits are 1, so this is the broadcast address
hosts connected to the
wire.

RST-2002 © 2003, Cisco Systems, Inc. All rights reserved. 10


Working with Addresses

• Two of the most


common questions
you are going to face
when dealing with IP 192.168.100.80/26
addresses are: ????
• What’s the network?
• What’s the host?
• How dow we figure
this out?

RST-2002 © 2003, Cisco Systems, Inc. All rights reserved. 11


Working with Addresses (The Hard Way)

192
• First, convert the IP divide by 2
remainder
address into binary. This 96 0

Right
divide by 2
is easier than it looks. 48
remainder
0
divide by 2
• Work with one octet at a remainder
24 0
time. divide by 2
remainder
12 0
• Divide by two, farm out the divide by 2

remainder on the side. 6


divide by 2
remainder
0

• The bottom is the binary 3


remainder
0
divide by 2
MSD, the top the binary remainder
LSD. 1 1

Left
divide by 2
remainder
0 1

RST-2002 © 2003, Cisco Systems, Inc. All rights reserved. 12


Working with Addresses (The Hard Way)

Write down the IP 11000000 10101000 01100100 01010000


address. 192 168 100 80
If you have a prefix 11111111 11111111 11111111 11000000
length, just wrote 8 +8 +8 +2 == 26
down the number of
1’s. If you have a
network mask,
computer the binary
as with the IP
address.
AND these two. 11000000 10101000 01100100 01000000
Convert back to 192 168 100 64
dotted decimal. This
is the network
address.

RST-2002 © 2003, Cisco Systems, Inc. All rights reserved. 13


Working with Addresses (The Hard Way)

Write down the IP 11000000 10101000 01100100 01010000


address. 192 168 100 80
If you have a prefix 11111111 11111111 11111111 11000000
length, just wrote 8 +8 +8 +2 == 26
down the number of
1’s. If you have a
network mask,
computer the binary
as with the IP
address.
NOR these two. 00000000 00000000 00000000 00010000
Convert back to 0 0 0 16
dotted decimal. This
is the host address.

RST-2002 © 2003, Cisco Systems, Inc. All rights reserved. 14


Working with Addresses (The Hard Way)

128 1 128
• To convert from 64 0 0
binary to decimal, use 32 1 32
a simple chart. 16 0 0
• Add the number 8 1 8
indicated for each 1 4 0 0
set in the binary 2 0 0
number.
1 0 0
168

RST-2002 © 2003, Cisco Systems, Inc. All rights reserved. 15


Working with Addresses (The Easy Way)

• First, if you are using a


network mask, convert it 192 == 11000000
to a prefix length.
• For each octet in the
network mask that is 255,
255.255.255.192
add 8 to the prefix length. 8 +8 +8 +2 == 26
• For the one octet that isn’t
255, convert to binary and
add the right number of
bits--or use a chart!

RST-2002 © 2003, Cisco Systems, Inc. All rights reserved. 16


Working with Addresses (The Easy Way)

• Take the prefix length and 192.168.100.80/26


divide by 8.
• Take the resulting number, These three
and ignore those octets octets are
out of the IP address-- part of the
these are all part of the network
network address! 26/8 == 3 (remainder 2)
• We’re going to use the
remainder to find the
fourth octet of the network The remainder tells us
address. what the network address
in the fourth octet is

RST-2002 © 2003, Cisco Systems, Inc. All rights reserved. 17


Working with Addresses (The Easy Way)

Remainder == 2
• Take the remainder, and find
the corresponding “multiple” 8 7 6 5 4 3 2 1
on the chart; in this case, 64. 1 2 4 8 16 32 64 128
• The largest multiple of 64 that
will fit into 80 is 64, so the
network is 64. 64 x 1 == 64
• Add the three octets we “set 64 x 2 == 128
aside” earlier, and the network
(prefix!) is 192.168.100.64/26. Network is 64!
• 80 - 64 == 16, so the host 192.168.100.64/26
address is 16. 80 - 64 == 16
16 Hosts!

RST-2002 © 2003, Cisco Systems, Inc. All rights reserved. 18


Working with Addresses (The Easy Way)

Remainder == 2
• How many hosts are in this
network? The remainder tells
us there are 64 addresses, 8 7 6 5 4 3 2 1
minus the network and 1 2 4 8 16 32 64 128
broadcast addresses, so 62
hosts.
• To find the broadcast address, 64 addresses
subtract 1 from the number of 64 - 2 == 62 hosts
hosts, and add that number to
the network address. 64 + (64 - 1) == 127
• The key is to work in octets, 192.168.100.127 is the
rather than trying to work with
the entire IP address at once!
broadcast address

RST-2002 © 2003, Cisco Systems, Inc. All rights reserved. 19


Working with Addresses (The Easy Way)

• What if the prefix length is less


192.168.100.80/22
than 24?
• Take the prefix length and These three
divide by 8. octets are
part of the
• Take the resulting number,
network
and ignore those octets out of
the IP address--these are all 22/8 == 2 (remainder 6)
part of the network address!
• We’re going to use the
remainder to find the third The remainder tells us
octet of the network address. what the network address
in the third octet is

RST-2002 © 2003, Cisco Systems, Inc. All rights reserved. 20


Working with Addresses (The Easy Way)

Remainder == 6
• Take the remainder, and find
the corresponding “multiple”
8 7 6 5 4 3 2 1
on the chart; in this case, 4.
1 2 4 8 16 32 64 128
• The largest multiple of 64 that
will fit into 80 is 64, so the
network is 64.
4 x 25 == 100
• Add the two octets we “set 4 x 26 == 104
aside” earlier, and make any
octets after the network 0’s Third octet is 100!
(the fourth octet). Set the fourth octet to 0.
• The network (prefix!) is
192.168.100.0/22. 192.168.100.0/22

RST-2002 © 2003, Cisco Systems, Inc. All rights reserved. 21


Working with Addresses (The Easy Way)

“0” octets == 1
• To find the number of 1 x 256 == 256
hosts, take the number of
octets set to 0, which is 1 Remainder == 6
in this case (the fourth
octet), and multiply by 256.
8 7 6 5 4 3 2 1
• Next, take the number
1 2 4 8 16 32 64 128
relating to the remainder
from the chart, and
multiple this by the number
we just found above. 4 x 256 == 1024
1024 – 2 == 1022 hosts
• Subtract two.

RST-2002 © 2003, Cisco Systems, Inc. All rights reserved. 22


Working with Addresses (The Easy Way)

• The key is to work in octets, rather than


trying to work with the entire IP address at
once!

RST-2002 © 2003, Cisco Systems, Inc. All rights reserved. 23


Summarization & Subnets

10.1.1.8
10.1.1.7
10.1.1.4
10.1.1.2
• A single network address
(prefix!) represents a set of
hosts attached to a wire.
• We can abstract this, and
simply say that a prefix
represents a set of reachable
addresses.
• We can say that we’ve
“summarized” information
about the hosts attached to the
physical wire by referring to the 10.1.1.0/26
entire group as a single
network.

RST-2002 © 2003, Cisco Systems, Inc. All rights reserved. 24


Summarization & Subnets

10.1.1.2/32 These
• In effect, we’ve shortened the
network part of the address 10.1.1.4/32 host
(prefix!), and lengthened the host 10.1.1.7/32 addresses
portion of the address, in effect are
describing more hosts 10.1.1.8/32
(destinations) in a single address. described
• If we can shorten the prefix length by this
to describe multiple hosts with a 10.1.1.0/26 network
single network address, why can’t
we shorten the prefix length so a 10.1.1.64/26
single network address describes These
two networks?
networks
• We can! It’s called address 10.1.1.0/25 are
summarization, or just
summarization. described
by this
network

RST-2002 © 2003, Cisco Systems, Inc. All rights reserved. 25


Summarization & Subnets

10.1.1.0 through 00001010 00000001 00000001 00000000


10.1.1.31. 10 1 1 0
11111111 11111111 11111111 11000000

10.1.1.32 through 00001010 00000001 00000001 01000000


10.1.1.63. 10 1 1 64
11111111 11111111 11111111 11000000
10.1.1.0 through 00001010 00000001 00000001 00000000
10.1.1.63, so it’s the 10 1 1 0
same space!
11111111 11111111 11111111 10000000

Changing the mask bit from 1 to 0, which shortens the


prefix length, means the bit in the two networks that
distinguish them from one another are now considered
host bits!

RST-2002 © 2003, Cisco Systems, Inc. All rights reserved. 26


Summarization & Subnets

10.1.1.2/32 These
• A network which is a part 10.1.1.4/32 host
of another network is 10.1.1.7/32 addresses
called a subnet. 10.1.1.8/32 are
subnets of
• There is another term, the
this
supernet, but it’s
definition depends on 10.1.1.0/26 network
whether you are using 10.1.1.64/26
VLSM subnetting, or These
calssful subnetting, so it networks
will be defined in the next 10.1.1.0/25 are
two sections. subnets of
this
network

RST-2002 © 2003, Cisco Systems, Inc. All rights reserved. 27


VLSM

• VLSM: Variable Length


Subnet Masking 10.1.1.0/24
• It simply means that the
10.1.2.0/25
entire IP address space is 10.1.2.128/26
treated as one flat address 10.1.2.192/27
space.
• Any prefix length is All of these are valid in
allowed in the network at the same network!
any point.

RST-2002 © 2003, Cisco Systems, Inc. All rights reserved. 28


VLSM

• At this point, you pretty much already know VLSM!


You already know how to find the network address,
broadcast address, and number of hosts in a
network.
• Two other common problems in working with VLSM
networks remain:
• Building summary addresses from groups of networks.
We won’t cover this here (maybe later in routing).
• Building network addressing schemes from a given
number of hosts and networks.

RST-2002 © 2003, Cisco Systems, Inc. All rights reserved. 29


Working with VLSM Networks

• You have 5 subnets with the following numbers of hosts on them: 58,
14, 29, 49, 3
• You are given the address space 10.1.1.0/24.
• Determine what subnets you could use to fit these hosts into it.
• How to solve this:
• Start with the chart!
• Order the networks from the largest to the smallest.
• Find the smallest number in the chart that will fit the number of the
largest number of hosts + 2.
• Continue through each space needed until you either run out of space, or
you finish.

RST-2002 © 2003, Cisco Systems, Inc. All rights reserved. 30


Working with VLSM Networks

• 58, 14, 29, 49, 3: reorder to


58, 49, 29, 14, 3. Start with 58. 8 7 6 5 4 3 2 1
• Smallest number larger than 1 2 4 8 16 32 64 128
(58 + 2) is 64. 64 is 2 bits.
• 24 bits of prefix length in the 32 < (58 + 2) < 64
address space given, add 2
for 26. 24 + 2 == 26
• First network is 10.1.1.0/26. 10.1.1.0/26 takes
• The next network is 10.1.1.0 care of the first 58
+ 64, so we start the next hosts
“round” at 10.1.1.64. Start the next block
at 10.1.1.64

RST-2002 © 2003, Cisco Systems, Inc. All rights reserved. 31


Working with VLSM Networks

• Next block is 49 hosts.


8 7 6 5 4 3 2 1
• Smallest number larger than
1 2 4 8 16 32 64 128
(49 + 2) is 64. 64 is 2 bits.
• 24 bits of prefix length in the
address space given, add 2 for 32 < (49 + 2) < 64
26.
24 + 2 == 26
• We start this block at 10.1.1.64,
so network is 10.1.1.64/26. 10.1.1.64/26 takes
• The next network is 10.1.1.64 + care of the next 49
64, so we start the next hosts
“round” at 10.1.1.128.
Start the next block
at 10.1.1.128

RST-2002 © 2003, Cisco Systems, Inc. All rights reserved. 32


Working with VLSM Networks

• Next block is 29 hosts.


8 7 6 5 4 3 2 1
• Smallest number larger than (29
+ 2) is 32. 32 is 3 bits. 1 2 4 8 16 32 64 128
• 24 bits of prefix length in the
address space given, add 3 for 16 < (29 + 2) < 32
27.
• We start this block at 24 + 3 == 27
10.1.1.128, so network is
10.1.1.128/27. 10.1.1.128/27
takes care of the
• The next network is 10.1.1.128 +
32, so we start the next “round” next 29 hosts
at 10.1.1.160. Start the next block
at 10.1.1.160

RST-2002 © 2003, Cisco Systems, Inc. All rights reserved. 33


Working with VLSM Networks

• Next block is 14 hosts.


8 7 6 5 4 3 2 1
• Smallest number larger than (14
+ 2) is 16. 16 is 4 bits (actually 1 2 4 8 16 32 64 128
equal, but it still works!).
• 24 bits of prefix length in the
address space given, add 4 for
(14 + 2) == 16
28. 24 + 4 == 28
• We start this block at 10.1.1.160,
so network is 10.1.1.160/27. 10.1.1.160/28
• The next network is 10.1.1.160 +
takes care of the
16, so we start the next “round” next 14 hosts
at 10.1.1.176. Start the next block
at 10.1.1.176

RST-2002 © 2003, Cisco Systems, Inc. All rights reserved. 34


Working with VLSM Networks

• Last block is 3 hosts.


8 7 6 5 4 3 2 1
• Smallest number larger than
(3 + 2) is 8. 8 is 5 bits. 1 2 4 8 16 32 64 128

• 24 bits of prefix length in the


address space given, add 5 4 < (5 + 2) < 8
for 29.
24 + 5 == 29
• We start this block at
10.1.1.176, so network is 10.1.1.176/29
10.1.1.176/29. takes care of the
• This is the last block of next 14 hosts
hosts, so we’re done!

RST-2002 © 2003, Cisco Systems, Inc. All rights reserved. 35


Working with VLSM Networks

10.1.0.0/23

subnets
supernet
• A subnet is any network
which is “part of” a larger 10.1.1.0/24
network space.
10.1.2.0/24
• A supernet is any network

subnets
supernet
which covers a larger
space than a given 10.1.2.0/25
network, including the 10.1.2.128/25
space covered by the
network. supernet

subnet
10.1.2.128/26

RST-2002 © 2003, Cisco Systems, Inc. All rights reserved. 36


Classful Addressing

• Classful subnetting is similar to VLSM,


with two more rules:
• The IP address space is divided into
“classes,” with each class having a specific
“natural” prefix length. Each block of
address space is called a “major net.”
• You cannot have more than one prefix length
within a major net.

RST-2002 © 2003, Cisco Systems, Inc. All rights reserved. 37


Classful Addressing

Network Class Beginning Natural Range of Example Major


Digits in Prefix Addresses Networks
Binary Length

Class A 10XX 8 1.0.0.0/8 11.0.0.0/8


through 100.0.0.0/8
126.0.0.0/8 120.0.0.0/8
Class B 110X 16 128.0.0.0/16 130.1.0.0/16
through 148.45.0.0/16
191.0.0.0/16 190.100.0.0/16
Class C 1110 24 192.0.0.0/24 193.1.3.0/24
through 193.1.4.0/24
223.0.0.0/24 192.2.5.0/24

RST-2002 © 2003, Cisco Systems, Inc. All rights reserved. 38


Classful Addressing

• It’s illegal to have multiple


network masks within a 10.1.1.0/24 two different
single major network. 10.1.2.0/24 prefix lengths
in the same
10.1.3.0/25
• There cannot be a mix of / major network
24’s and /25’s in the 10.1.3.128/25
10.0.0.0/8 major network.
11.1.1.0/25
• There cannot be a mix of /
25’s and /26’s in the
11.1.1.128/26
11.0.0.0/8 network.

RST-2002 © 2003, Cisco Systems, Inc. All rights reserved. 39


Working with Classful Addressing

• You can find the network address,


broadcast address, and number of hosts
as we described earlier.
• You can find the number of networks by
subtracting the network mask from the
natural mask, and then using the chart.

RST-2002 © 2003, Cisco Systems, Inc. All rights reserved. 40


Working with Classful Addressing

• 10.1.1.0/25 is in the
10.0.0.0 class A major
network. 10.1.1.0/25
• The natural prefix length 10.0.0.0/8 is class A
for a class A network is /8. 25 – 8 == 17
• Subtract the natural prefix 17/8 == 2, 1 remaining
length from the actual
prefix length.
• Divide by 8, holding the
remainder on the side.

RST-2002 © 2003, Cisco Systems, Inc. All rights reserved. 41


Working with Classful Addressing

10.1.1.0/25
• Find the remainder in 10.0.0.0/8 is class A

the power of two’s 25 – 8 == 17


chart. 17/8 == 2, 1 remaining

• Multiply the result, (256 x 2) x 128 == 65536


256, and the number
from the power of
8 7 6 5 4 3 2 1
two’s chart.
1 2 4 8 16 32 64 128
• Subtract 2.
65536 – 2 == 65534 networks

RST-2002 © 2003, Cisco Systems, Inc. All rights reserved. 42


Working with Classful Addressing

10 0 0 0/24
• Subnet 0 00001010 00000000 00000000 00000000
natural natural
• The network with network host
all the between the configured
these bits are 0, so this is subnet 0
network
host and the
natural major net
set to 0. 10.0.0.0/16 Yes

• This only exists in 10.0.1.0/16 No


classful 172.31.0.0/24 Yes
addressing
172.31.1.0/24 No
schemes.
192.168.100.0/25 Yes

RST-2002 © 2003, Cisco Systems, Inc. All rights reserved. 43


Working with Classful Addressing

10 255 255 0/24


00001010 11111111 11111111 00000000
• Broadcast Subnet natural natural
network host
• The network with configured
all the bits between network these bits are 1, so this is
the broadcast network
the host and the
natural major
10.255.0.0/16 Yes
network set to 1.
10.255.0.0/24 No
• This only exists in
172.31.255.0/24 Yes
calssful address
schemes. 172.31.255.0/25 No

192.168.100.128/25 Yes

RST-2002 © 2003, Cisco Systems, Inc. All rights reserved. 44


Working with Classful Addressing

• You have 5 subnets with the following numbers of hosts on them: 58,
14, 29, 49, 3
• You are given the address space 10.1.0.0/22.
• Determine what subnets you could use to fit these hosts into it.
• How to solve this:
• Start with the chart!
• Find the largest set of hosts.
• Find the smallest number in the chart that will fit the number of the
largest number of hosts + 2.
• Use that prefix length for all the subnets (remember you cannot have
different subnet masks within the same major network).

RST-2002 © 2003, Cisco Systems, Inc. All rights reserved. 45


Working with Classful Addressing

• A subnet is any prefix with


a prefix length longer than 172.18.1.0/24 Subnet
the natural prefix length of 10.2.0.0/9 Subnet
the major network. 172.34.0.0/15 Supernet
• A supernet is any prefix 192.168.44.64/25 Subnet
with a prefix length 192.168.44.0/23 Supernet
shorter than the natural
prefix length of the major
network.

RST-2002 © 2003, Cisco Systems, Inc. All rights reserved. 46


Private & Special Address Space

Address Space Range of Addresses

10.0.0.0/8 10.0.0.0 through 10.255.255.255


172.16.0.0/19 172.16.0.0 through 172.31.0.0

192.168.0.0/16 192.168.0.0 through 192.168.255.255


Network Class Beginning Digits in Binary Range of Addresses
Class D 11110x 224.0.0.0 through
(Multicast) 239.255.255.255
Class E 11111x 240.0.0.0 through ....
(Experimental)

RST-2002 © 2003, Cisco Systems, Inc. All rights reserved. 47


Cisco IOS Show IP Route

two different prefix


2651A#sho ip route lengths under the
.... same major
network
Gateway of last resort is not set

C 208.0.12.0/24 is directly connected, Serial0/2


....
S 208.1.10.0/24 [1/0] via 208.0.12.11
....
144.2.0.0/16 is variably subnetted, 2 subnets, 2 masks
S 144.2.2.0/24 [1/0] via 208.0.12.11
S 144.2.3.0/29 [1/0] via 208.0.12.11
C 208.0.7.0/24 is directly connected, Serial0/0
C 208.0.6.0/24 is directly connected, FastEthernet0/0
C 208.0.0.0/24 is directly connected, FastEthernet0/1
S 208.1.0.0/16 [1/0] via 208.0.12.11

a supernet and natural


mask in the same
network address space

RST-2002 © 2003, Cisco Systems, Inc. All rights reserved. 48

You might also like