Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 46

IP Addressing

Albert Espinal S.
IP Addressing
IP Addressing is a logical addressing scheme at
the Network Layer of the OSI Model.
Like all Network Layer addressing schemes (IPX,
AppleTalk, DECnet, CLNS, etc.), IP addresses have
two parts:
♦ Network—identifies the network or subnet
♦ Host—identifies the device on that network/subnet
An IP Address’ 32 bits are expressed in 4 octets
(called dotted-decimal notation).
IP addresses are divided into five class types
depending upon the value of bit positions in the
first octet.
IP Address Classes
Class A: 1.0.0.0 to 127.0.0.0
Network Host Host Host

0 ___
1st Octet Bits: ___ X ___
X ___
X ___
X ___
X ___
X ___
X
(The 128 bit is off.)

Class B: 128.0.0.0 to 191.255.0.0


Network Network Host Host

1 ___
1st Octet Bits: ___ 0 ___
X ___
X ___
X ___
X ___
X ___
X
(The 128 bit is on and the 64 bit is off.)

Class C: 192.0.0.0 to 223.255.255.0


Network Network Network Host

1 ___
1st Octet Bits: ___ 1 ___
0 ___
X ___
X ___
X ___
X ___
X
(The 128 and 64 bits are on. The 32 bit is off.)
Reserved IP Address Classes

Multicasting
Class D: 224.0.0.0 to 239.0.0.0

1 ___
1st Octet Bits: ___ 1 ___
1 ___
0 ___
X ___
X ___
X ___
X
(The 128, 64, and 32 bit are on. The 16 bit is off.)

Experimental
Class E: 240.0.0.0 to 255.0.0.0

1 ___
1st Octet Bits: ___ 1 ___
1 ___
1 ___
X ___
X ___
X ___
X
(The 128, 64, 32, and 16 bit are all on.)
Private IP Addresses
Private IP Addresses cannot exist on the public Internet.
Your gateway router uses Name Address Translation (NAT)
to give outbound packets a “legitimate” IP source address.
Private Addressing and NAT are discussed later.

Class A: 10.0.0.0
(Favored by large enterprises because of its flexibility)

Class B: 172.16.0.0 to 172.31.0.0


(In the 3rd Octet, the 128, 64, and 32 bit are off. The 16 bit is on.)

Class C: 192.168.0.0 to 192.168.255.0


(256 separate Class C Addresses)
Why Subnet?
Remember: we are usually dealing with a
broadcast topology.
Can you imagine what the network traffic
overhead would be like on a network with 254
hosts trying to discover each others MAC
addresses?
Subnetting allows us to segment LANs into logical
broadcast domains called subnets, thereby
improving network performance.
Four Subnetting Steps
To correctly subnet a given network address into
subnet addresses, ask yourself the following
questions:
1. How many bits do I need to borrow?
2. What’s the subnet mask?
3. What’s the “magic number” or multiplier?
4. What are the first three subnetwork addresses?
Let’s look at each of these questions in detail
1. How many bits to borrow?
First, you need to know how many host bits you
have to work with.
Second, you must know either how many subnets
you need or how many hosts per subnet you
need.
Finally, you need to figure out the number of bits
to borrow.
1. How many bits to borrow?
How many host bits do I have to work with?
♦ Depends on the class of your network address.
 Class C: 8 host bits
 Class B: 16 host bits
 Class A: 24 host bits
♦ Remember: you must borrow at least 2 bits for subnets
and leave at least 2 bits for host addresses.
♦ 2 bits borrowed allows 22 - 2 = 2 subnets
♦ Anyway, that’s how we learned it in our CCNA
Curriculum. You will soon discover that subnet zero is
actually available for your use.
1. How many bits to borrow?
How many subnets or hosts do I need?
A simple formula:
♦ Host Bits = Bits Borrowed + Bits Left
♦ HB = BB + BL

I need x subnets: 2 2x


BB

I need x hosts: 2 2x


BL

Remember: we need to subtract two hosts to


provide for the subnetwork and broadcast
addresses.
1. How many bits to borrow?
Class C Example: 210.93.45.0
♦ Design goals specify at least 5 subnets so how many
bits do we borrow?
♦ How many bits in the host portion do we have to work
with (HB)?
Since it’s a Class C, we have 8 bits to work with.
♦ What’s the BB in our HB = BB + BL formula?
8 = BB + BL
♦ 2 to what power will give us at least 5 subnets?
23 - 2 = 6 subnets
♦ How many bits are left for hosts?
Since 8 = 3 + BL, then BL = 5
♦ So how many hosts can we assign to each subnet?
25 - 2 = 30 hosts
1. How many bits to borrow?
Class B Example: 185.75.0.0
♦ Design goals specify no more than 126 hosts per
subnet, so how many bits do we need to leave (BL)?
♦ How many bits in the host portion do we have to work
with (HB)?
Since it’s a Class B, we have 16 bits to work with.
♦ What’s the BL in our HB = BB + BL formula?
16 = BB + BL
♦ 2 to what power will give us 126 hosts per subnet?
27 - 2 = 126 hosts
♦ How many bits are left for subnets?
Since 16 = BB + 7, then BB = 9
♦ So how many subnets can we have?
29 - 2 = 510 subnets
2. What’s the subnet mask?
We determine the subnet mask by adding up the decimal
value of the bits we borrowed.
In the previous Class C example, we borrowed 3 bits.
Below is the host octet showing the bits we borrowed and
their decimal values.

1 1 1
128 64 32 16 8 4 2 1

We add up the decimal value of these bits and get 224.


That’s the last non-zero octet of our subnet mask.
So our subnet mask is 255.255.255.224
Remember: The subnet mask has all 1s in the network portion.
3. What’s the “magic number?”
To find the “magic number” or the multiplier we
will use to determine the subnetwork addresses,
we subtract the last non-zero octet from 256.
♦ Note: The “magic number” can also be found by
determining the value of the last bit borrowed.
In our Class C example, our subnet mask was
255.255.255.224. 224 is our last non-zero octet.
Our magic number is 256 - 224 = 32
♦ Note: The last bit borrowed was the 32 bit.
Last Non-Zero Octet
Memorize this table. You should be able to:
♦ Quickly calculate the last non-zero octet when given the
number of bits borrowed or...
♦ Determine the number of bits borrowed when given the
last non-zero octet.
Bits Non-Zero
Borrowed Octet
1 128
2 192
3 224
4 240
5 248
6 252
7 254
8 255
4. What are the subnets?
We now take our “magic number” and use it as a
multiplier.
Our Class C address was 210.93.45.0.
We borrowed bits in the fourth octet, so that’s
where our multiplier occurs.
♦1st subnet: 210.93.45.32
♦2nd subnet: 210.93.45.64
♦3rd subnet: 210.93.45.96
♦4th subnet: 210.93.45.128
♦5th subnet: 210.93.45.160
♦6th subnet: 210.93.45.192
Host & Broadcast Addresses
Now you can see why we subtract 2 when
determining the number of host addresses.
♦ Let’s look at our 1st subnet: 210.93.45.32
♦ What is the total range of addresses up to our next
subnet, 210.93.45.64?
210.93.45.32 to 210.93.45.63 or 32 addresses
♦ .32 cannot be assigned to a host. Why?
Because it is the subnet’s address.
♦ .63 cannot be assigned to a host. Why?
Because it is the subnet’s broadcast address.
♦ So our host addresses are .33 - .62 or 30 host
addresses--just like we figured out earlier.
Practice Your Subnetting!!
If you have not yet mastered subnetting, now is
the time to do so.
♦ this curriculum assumes the ability to quickly subnet
without pencil & paper! (much like the ability to add
and subtract is assumed in Algebra)
♦ You will need to be able to evaluate an addressing
scheme quickly just by looking at the address and
subnet mask.
♦ Furthermore, Variable Length Subnet Masking (VLSM)
becomes much easier if you’ve mastered subnetting.
♦ To practice, simply take any network address/design
goal scenario and subnet it!! For example...
 192.168.1.0 with at least 30 subnets
 172.16.0.0 with at least 500 hosts per subnet
 10.0.0.0 with at least 2000 subnets
202.151.37.0/26
Subnet mask?
♦ 255.255.255.192
Bits borrowed?
♦ Class C so 2 bits borrowed
Magic Number?
♦ 256 - 192 = 64
First useable subnet address?
♦ 202.151.37.64
Third useable subnet address?
♦ 64 + 64 + 64 = 192, so 202.151.37.192
198.53.67.0/30
Subnet mask?
♦ 255.255.255.252
Bits borrowed?
♦ Class C so 6 bits borrowed
Magic Number?
♦ 256 - 252 = 4
Third useable subnet address?
♦ 4 + 4 + 4 = 12, so 198.53.67.12
Second subnet’s broadcast address?
♦ 4 + 4 + 4 - 1 = 11, so 198.53.67.11
200.39.89.0/28
What kind of address is 200.39.89.0?
♦ Class C, so 4 bits borrowed
♦ Last non-zero octet is 240
♦ Magic number is 256 - 240 = 16
♦ 32 is a multiple of 16 so 200.39.89.32 is a subnet
address--the second subnet address!!
What’s the broadcast address of 200.39.89.32?
♦ 32 + 16 -1 = 47, so 200.39.89.47
194.53.45.0/29
What kind of address is 194.53.45.26?
♦ Class C, so 5 bits borrowed
♦ Last non-zero octet is 248
♦ Magic number is 256 - 248 = 8
♦ Subnets are .8, .16, .24, .32, ect.
♦ So 194.53.45.26 belongs to the third subnet address
(194.53.45.24) and is a host address.
What broadcast address would this host use to
communicate with other devices on the same
subnet?
♦ It belongs to .24 and the next is .32, so 1 less is .31
(194.53.45.31)
No Worksheet Needed!
After some practice, you should never need a
subnetting worksheet again.
The only information you need is the IP address
and the CIDR notation.
For example, the address 221.39.50.0/26
You can quickly determine that the first subnet
address is 221.39.50.64. How?
♦ Class C, 2 bits borrowed
♦ 256 - 192 = 64, so 221.39.50.64
For the rest of the addresses, just do multiples of
64 (.64, .128, .192).
The Key!!
MEMORIZE THIS TABLE!!!

Bits Non-Zero
Borrowed Octet
1 128
2 192
3 224
4 240
5 248
6 252
7 254
8 255
Practice On Your Own
Below are some practice problems. Take out a
sheet of paper and calculate...
♦ Bits borrowed
♦ Last non-zero octet
♦ Second subnet address and broadcast address
1. 192.168.15.0/26
2. 220.75.32.0/30
3. 200.39.79.0/29
4. 195.50.120.0/27
5. 202.139.67.0/28
6. Challenge: 132.59.0.0/19
7. Challenge: 64.0.0.0/16
Depletion of IPv4
IP became ARPA’s protocol for host-to-host
communications on January 1, 1982.
“It is urgent that the implementation of IP/TCP be begun on all...ARPANET
hosts as soon as possible and no later than 1 January 1982.” (RFC 801, p. 2)

The designers of IP could not foresee the


explosive growth of the what they had come to
call the Internet.
In 1981, they figured that a 32 bit address with
more than 4 billion possible host addresses would
never be exhausted.
However, ten years later they were scrambling to
solve just that problem: address space depletion.
Solving the Depletion Crisis
In 1992, IETF had two main concerns:
♦ Class A is gone and Class B is almost gone
♦ Internet routing tables are huge!!
Therefore, over the next several years they came
up with solutions:
♦ Route Summarization using CIDR Notation
♦ Variable Length Subnet Masking
♦ Private Addressing and NAT
♦ IP Unnumbered on WAN links
♦ IP version 6
VLSM will be discussed in the next section.
Private Addressing, IP Unnumbered, IPv6 will be
discussed following VLSM.
CIDR Notation
Classless Interdomain Routing is a method of
representing an IP address and its subnet mask
with a network prefix and bitmask.
For example: 192.168.50.0/27
What do you think the 27 tells you?
♦ 27 is the number of 1 bits in the subnet mask.
Therefore, 255.255.255.224
♦ Also, you know 192 is a Class C, so we borrowed 3
bits!! How do we know that?
Default subnet mask for Class C is 255.255.255.0 or /24
♦ Finally, you know the magic number is 256 - 224 = 32,
so the first useable subnet address is 192.168.50.32!!
Let’s see the power of CIDR notation.
Route Summarization
Also known as Route Aggregation and
Supernetting, Route Summarization is a method of
representing multiple, contiguous subnets with
one aggregated address.
Without route summarization, the routing tables of
the Internet would’ve collapsed back in the mid
1990s.
Route summarization benefits include...
♦ More efficient routing
♦ reduced CPU usage
♦ reduced memory requirements
Route Flapping
Route Flapping is the process of a route
continuously going up and then down
♦ Can be caused by physical or data-link layer problems
Route Summarization effectively insulates
upstream routers from continually recalculating
their routing tables because of route flapping.
♦ The flapping network’s border router is summarizing
and advertising all local networks as one route.
Route Summarization Example
Your enterprise has four Class C addresses:
♦ 199.100.0.0/24
♦ 199.100.1.0/24
♦ 199.100.2.0/24
♦ 199.100.3.0/24
Notice these addresses are contiguous.
With CIDR notation, we can represent all four
addresses as 199.100.0.0/22. How?
Because all four addresses have the first 22 bits in
common (called a prefix).
Route Summarization Example
We can summarize these addresses because none
of them have the 4 bit turned on in the 3rd octet.
Below is 199.100.0.0/22 worked out in binary.
Being able to work at the bit level is crucial when
supernetting to summarize a range of addresses.
How does route summarization help reduce
routing tables?
199.100.0.0 1100 0111 0110 0100 0000 00 00 0000 0000
199.100.1.0 1100 0111 0110 0100 0000 00 01 0000 0000
199.100.2.0 1100 0111 0110 0100 0000 00 10 0000 0000
199.100.3.0 1100 0111 0110 0100 0000 00 11 0000 0000
Bitmask 1111 1111 1111 1111 1111 11 00 0000 0000
Route Summarization Example
Your AS advertises a summarized route to your ISP.
The ISP, in turn, advertises a further summarized route to
the Internet, thereby reducing the Internet’s routing table.
199.100.0.0/24
The
Internet

199.100.1.0/24

t
199.100.0.0/22
0/16 rne
Advertised to ISP 0. te
0 0. o In
1
Autonomous 9 9. ed t
1 ti s
r
System d ve
ISP A

199.100.2.0/24

199.100.3.0/24
VLSM Overview
You may have noticed in your CCNA studies that
addressing a WAN link is often a waste of host
addresses.
VLSM allows you to subnet a subnet!
WAN links only need 2 addresses for hosts.
Therefore, using VLSM would yield a CIDR
notation of /30 on WAN links.
In addition, with the ip subnet-zero
command enabled by default on Cisco IOS 12.0
and higher, you can now use subnet zero.
VLSM Example
You have a small Class C network with 6 LANs &
30 hosts (192.168.1.0/27)
NO MORE ADDRESSES for WAN links!!
Solution: Use subnet zero and subnet it further:
♦ 192.168.1.4/30
♦ 192.168.1.8/30
♦ 192.168.1.12/30
♦ 192.168.1.16/30
♦ 192.168.1.20/30
♦ 192.168.1.24/30
♦ 192.168.1.28/30
You now have enough addresses for 7 WAN links.
VLSM Example
.32/27
The graphic shows how
you can have your 6
subnets with 30 hosts and
.64/27 still have subnets leftover
.4/30
AS for WAN links.
.96/27
192.168.1.0
The hub router would then
.8/30
summarize all the subnets
as 192.168.1.0/24
.128/27
.12/30
This simple demonstration
.160/27 of VLSM hides its true
power... SCALABILITY!!
Let’s explore that power.
.192/27
The Three-Layer Model
Remember our three layers from Ch. 1?
♦ Core, Distribution, and Access
With VLSM, route summarization and the
appropriate routing protocol, we can scale our
network making routing much more efficient.
Using the address 172.16.0.0, we could do the
following, summarizing up to the Core Layer:
♦ All WAN links:
172.16.0.4/30 through 172.16.0.248/30
♦ All Distribution routers and attached networks:
172.16.1.0/24 through 172.16.255.0/24
♦ All Access routers and attached networks:
172.16.1.32/27 through 172.16.255.32/27
VLSM & The Three Layers
Core Layer 172.16.0.0/16 Route sent to ISP

172.16.0.4/30 Route Summaries

Distribution Layer
172.16.1.0/24 172.16.2.0/24 172.16.3.0/24

Access Layer

172.16.2.32/27 172.16.2.64/27 172.16.2.96/27


VLSM Routing Protocols
Only the classless routing protocols shown in the
table below support VLSM.

Classful Classless
RIPv1 RIPv2
IGRP EIGRP
EGP OSPF
BGPv3 BGPv4
RIPv1 versus RIPv2
RIPv1...
♦ does not send subnet mask information
 the receiving router applies its subnet mask or the default
♦ broadcasts its updates
♦ does not support authentication
RIPv2...
♦ supports VLSM
♦ multicasts its updates
♦ supports authentication
♦ However, RIPv2 is still limited to 15 hops and only
considers hops as its metric.
Private Addressing & NAT
As discussed earlier, private IP addresses cannot exist on
the Internet.
Therefore, we use Name Address Translation (NAT) to
dynamically give packets a real IP address.
♦ ISPs will only give you a limited number of real IP addresses (if
any!). So NAT configuration also includes the ability to “overload” a
real IP.
♦ The purpose of NAT overloading is to allow multiple local inside
addresses to share a single global outside address.
♦ This is done by tracking source ports from the transport layer. As
packets leave, not only do they get a real IP but are also tagged
with a port number to identify the session (and host) as packets
return from the destination.
IP Unnumbered
IP Unnumbered is used to conserve more space on WAN
links.
♦ Serial interfaces “borrow” an IP address from another interface
(typically a LAN interface)
Rules for using IP unnumbered:
♦ Only point-to-point serial interfaces
♦ Both sides must belong to the same major network with the same
subnet mask or…
♦ Different major network with default subnet masks
Drawbacks to using IP unnumbered:
♦ Cannot ping the interface
♦ Cannot boot a network IOS image over interface
♦ Cannot use IP security
Configuring IP Unnumbered
Router(config)#interface s0
Router(config-if)#ip unnumbered e0
DHCP & Easy IP
Hosts configured to dynamically obtain their
IP addresses will send a DHCP broadcast
upon booting.
♦ The gateway router will respond either with an
IP address or a DHCP router address.
Cisco’s Easy IP
♦ “Plug and Play” routing that allows a remote
router to get a real IP address from the ISP
♦ Then the remote router uses DHCP/NAT to
provide access to internal LAN clients.
DHCP operation
The client sends a DHCPDISCOVER broadcast to
all nodes
The server sends a DHCPOFFER unicast to client
The client sends a DHCPREQUEST broadcast to all
nodes
The server sends a DHCPACK unicast to client
Helper Addresses
DHCP uses BootP’s UDP port numbers 67 & 68 to
broadcast for an IP addresses.
♦ Normally, routers will not forward UDP requests. This
causes a problem if the local router is not the DHCP
server.
♦ Therefore, we configure the host’s local router with a
helper address to which it will forward UDP requests for
services.
UDP Services Forwarded by Helper Command
Service Port Service Port
Time 37 BOOTP/DHCP client 68
TACAS 49 TFTP 69
DNS 53 NetBIOS name 137
BOOTP/DHCP server 67 NetBIOS datagram 138
Internet Protocol, version 6
IPv4 will eventually perish even with…
♦ Subnetting (1985)
♦ VLSM (1987)
♦ CIDR (1993)
The proliferation of IP addressable devices will
eventually exceed IPv4’s limit of 4 billion
addresses.
IPv6 is a 128 bit address. But because of the
success of NAT and private IPs, IPv4 will not go
away for some time.
IPv6 will require network administrators to re-
engineer their enterprises with new software and
new hardware.

You might also like