Transcript VLSM

MIDWEST
N ETWORK
SERVICES
GROUP
Variable-Length Subnet Masking
(VLSM)
By
R. Benjamin Kessler, CCIE #8762
Session Overview
• A Brief History of IPv4 Addressing
• How to subnet a network
• Why VLSM? What problem are we trying
to solve?
• Typical uses of VLSM
• How to do VLSM Math
• Questions
© Copyright 2005 – Midwest Network Services Group, LLC – all rights reserved
Slide # 2
Obligatory OSI Model Reference
• IP Addressing functions “live” at layer 3 of
the OSI model
© Copyright 2005 – Midwest Network Services Group, LLC – all rights reserved
Slide # 3
IPv4 Addressing History
• Original Specifications (RFCs 790 & 791 –
Sept., 1981)
– Fixed Length of four octets (32 bits)
• Up to 4,294,967,296 unique hosts
– Each address begins with the “network”
portion followed by the “host” portion
– Three “Classes” (A, B, & C)
© Copyright 2005 – Midwest Network Services Group, LLC – all rights reserved
Slide # 4
IP Address Classes
• Network “Class” determined by the high
order address bits
© Copyright 2005 – Midwest Network Services Group, LLC – all rights reserved
Slide # 5
IP Address Classes (cont’d)
• Class “A” Networks –
– 128 networks (7 bits)
– Up to 16,777,214 hosts per network
• Class “B” Networks –
– 16,384 networks (14 bits)
– Up to 65,534 hosts per network
• Class “C” Networks –
– 2,097,152 networks (21 bits)
– Up to 254 hosts per network
© Copyright 2005 – Midwest Network Services Group, LLC – all rights reserved
Slide # 6
Problems with IPv4 Addresses
• How to Scale…
– Class “C” networks were too small
– Class “B” networks were too big
© Copyright 2005 – Midwest Network Services Group, LLC – all rights reserved
Slide # 7
Subnetting
• Internet Standard Subnetting Procedure –
RFC 950 (Aug., 1985)
– Defined a method to split a network into
smaller (equal-size) pieces
– Increased flexibility for local admins
– Reduced Internet routing table size
– Increased stability of global routing table
© Copyright 2005 – Midwest Network Services Group, LLC – all rights reserved
Slide # 8
Subnetting
Single advertisement to the Internet;
Multiple segments/subnets internally
179.11.16.0
179.11.32.0
179.11.0.0
Internet
179.11.48.0
179.11.64.0
179.11.80.0
179.11.96.0
...
© Copyright 2005 – Midwest Network Services Group, LLC – all rights reserved
Slide # 9
Subnet Masking
• Separates IP address into network and host
portions in a “classless” manner
• Used to determine if the destination host is
“local” or “remote.” – ARP or Route?
• A bitwise AND is performed to determine how
datagrams are to be sent:
IF bitwise_and(dest_ip_addr, my_ip_mask)
= bitwise_and(my_ip_addr, my_ip_mask)
THEN send dg locally (ARP)
ELSE send dg to gateway (Route)
© Copyright 2005 – Midwest Network Services Group, LLC – all rights reserved
Slide # 10
Subnet Masking
IP Address:
179.11.35.22
10110011.00001011.00100011.00010110
Subnet Mask:
255.255.240.0
11111111.11111111.11110000.00000000
Subnet Address (all zeros in host bits):
179.11.32.0
10110011.00001011.00100000.00000000
Broadcast Address (all ones in host bits):
179.11.47.255
10110011.00001011.00101111.11111111
Host address written as 179.11.35.22/255.255.240.0
Subnet Mask = 20 bits; also known as “Prefix Length”
“CIDR Notation” for the address would be: 179.11.35.22/20
© Copyright 2005 – Midwest Network Services Group, LLC – all rights reserved
Slide # 11
Subnet Example
• Host A needs to
communicate with
Servers 1 & 2.
• Must make “ARP or
Route” decision
Server 2
179.11.50.1/20
179.11.48.0/20
179.11.63.254/20
179.11.47.254/20
179.11.32.0/20
`
179.11.35.22/20
179.11.46.89/20
Host “A”
Server 1
© Copyright 2005 – Midwest Network Services Group, LLC – all rights reserved
Slide # 12
Subnet Example
Subnet Mask:
11111111.11111111.11110000.00000000
255.255.240.0
Host A:
10110011.00001011.00100011.00010110
179.11.35.22
Server 1:
10110011.00001011.00101110.01011001
179.11.46.89
Gateway – intf 1:
10110011.00001011.00101111.11111110
179.11.47.254
Server 2:
10110011.00001011.00110010.00000001
179.11.50.1
Gateway – intf 2:
179.11.63.254
10110011.00001011.00111111.11111110
© Copyright 2005 – Midwest Network Services Group, LLC – all rights reserved
Slide # 13
Problems with Subnetting
• Once designated, the size and number of
subnets remains static. Making changes
requires an organization to completely readdress all network subnets
• A lot of IP addresses are wasted on
networks with only a few hosts
© Copyright 2005 – Midwest Network Services Group, LLC – all rights reserved
Slide # 14
Example Network
Network A: 300 Hosts
Network D: 20 Hosts
179.11.80.0/22
179.11.48.0/22
179.11.96.0/22
Network C: 2 Hosts
179.11.64.0/22
179.11.32.0/22
Network B: 50 Hosts
Network E: 500 Hosts
Each Subnet can support up-to 1022 hosts
–
–
–
–
–
Network A: wastes 722 addresses (70%)
Network B: wastes 972 addresses (95%)
Network C: wastes 1020 addresses (99%)
Network D: wastes 1002 addresses (98%)
Network E: wastes 522 addresses (51%)
© Copyright 2005 – Midwest Network Services Group, LLC – all rights reserved
Slide # 15
Variable Length Subnet
Masking (VLSM)
• Concept introduced in RFC 1009
(Requirements for Internet Gateways –
June, 1987)
– “Flexible use of the available address space
will be increasingly important in coping with
the anticipated growth of the Internet. Thus,
we allow a particular subnetted network to
use more than one subnet mask.”
© Copyright 2005 – Midwest Network Services Group, LLC – all rights reserved
Slide # 16
Variable Length Subnet
Masking (VLSM)
• VLSM goes “Hand-in-hand” with Classless InterDomain Routing (CIDR)
• Legacy routing protocols are considered
“classful” and don’t support VLSM – e.g. RIPv1,
IGRP, EGP, etc.
• More recent protocols support VLSM by
including the subnet mask (or prefix length) of a
network in the route advertisement and are said
to be “classless” – e.g. OSPF, EIGRP, IS-IS,
BGPv4, etc.
© Copyright 2005 – Midwest Network Services Group, LLC – all rights reserved
Slide # 17
Classful vs Classless
• Classful:
– Size defined by the class (A, B, C, etc.)
– Fixed Network portion
– RIP & IGRP are classful routing protocols
• Classless:
– Network portion can be any size
– Protocol sends subnet (prefix) information
with routes – e.g. 192.168.64.0/18
– RIPv2, EIGRP, OSPF, BGPv4 and IS-IS
© Copyright 2005 – Midwest Network Services Group, LLC – all rights reserved
Slide # 18
Why VLSM?
• Benefits –
– Allows an organization to more efficiently
assign IP address space
– Provides for route summarization/aggregation
on non-classfull boundaries
• Reduces the size of a routing table
• Increases stability (reduces route flapping)
© Copyright 2005 – Midwest Network Services Group, LLC – all rights reserved
Slide # 19
Efficient Address Assignment
• In our previous example, we had our
network (179.11.0.0/16) subnetted to with
a 22-bit mask – a vast majority of the
addresses were wasted using this mask
on all subnets.
• By using VLSM, we can more efficiently
assign addresses; this frees the wasted
addresses for re-use in other parts of the
network.
© Copyright 2005 – Midwest Network Services Group, LLC – all rights reserved
Slide # 20
Example Network
w/VLSM
Network A: 300 Hosts
Network D: 20 Hosts
179.11.80.0/23
179.11.48.0/27
179.11.96.0/30
Network C: 2 Hosts
179.11.64.0/26
179.11.32.0/23
Network B: 50 Hosts
Network E: 500 Hosts
–
–
–
–
–
Network A: Using 300 of 512 hosts (59% efficiency)
Network B: Using 50 of 62 hosts (80% efficiency)
Network C: Using 2 of 2 hosts (100% efficiency)
Network D: Using 20 of 30 hosts (67% efficiency)
Network E: Using 500 of 512 hosts (98% efficiency)
© Copyright 2005 – Midwest Network Services Group, LLC – all rights reserved
Slide # 21
VLSM Operation
• Conceptually, a network is divided into
subnets; some of the subnets are further
divided into sub-subnets; and some of the
sub-subnets are divided into sub2-subnets.
• VLSM permits the recursive division of a
network prefix.
© Copyright 2005 – Midwest Network Services Group, LLC – all rights reserved
Slide # 22
BIG Corp Network
179.11.0.0/16
Internet
Widget Mfg Division
Sales Division
Headquarters
179.11.16.0/20
179.11.64.0/19
179.11.128.0/18
© Copyright 2005 – Midwest Network Services Group, LLC – all rights reserved
Slide # 23
Widget Mfg Division
179.11.16.0/20
BIG Corp
WAN
Muncie Plant
Hartford City Plant
Tipton Plant
179.11.16.0/22
179.11.22.0/23
179.11.28.0/24
© Copyright 2005 – Midwest Network Services Group, LLC – all rights reserved
Slide # 24
Muncie Plant
179.11.16.0/22
Widget Div.
WAN
179.11.18.0/24
179.11.17.0/24
179.11.16.0/24
`
`
`
`
Server 1
Wkstn A
179.11.16.11/24
179.11.16.87/24
Wkstn C
179.11.17.54/24
179.11.17.55/24
Server 2
Wkstn D
179.11.18.66/24
179.11.18.91/24
Plant Office
Shop Floor
Shipping Dock
Wkstn B
© Copyright 2005 – Midwest Network Services Group, LLC – all rights reserved
Slide # 25
VLSM Operation
• The recursive process does not require
the same prefix-length at each level of
recursion.
• The recursive subdivision can be carried
out as far as required…until you run out of
bits
© Copyright 2005 – Midwest Network Services Group, LLC – all rights reserved
Slide # 26
VLSM Design Considerations
•
At each level of the hierarchy:
1. How many total subnets does this level
require today?
2. How many hosts are there on this level’s
largest subnet today?
3. How much growth do we anticipate in the
near future for each of the above? OK, at
least double it!
© Copyright 2005 – Midwest Network Services Group, LLC – all rights reserved
Slide # 27
VLSM Design and RFC 1918
• Address allocation used to be much
“harder” because of the need to justify
your addressing requirements to some
regional addressing authority (e.g. ARIN).
• For nearly all enterprises, the advent of
RFC 1918 and NAT/PAT has made this
much “easier”
© Copyright 2005 – Midwest Network Services Group, LLC – all rights reserved
Slide # 28
VLSM Design and RFC 1918
• Companies can use “private” addresses
internally:
– 10.0.0.0 – 10.255.255.255.255 (10/8)
– 172.16.0.0 – 172.31.255.255 (172.16/12)
– 192.168.0.0 – 192.168.255.255 (192.168/16)
• Address allocations can be much more “liberal”
than before.
• Private Addressing and NAT have extended the
life of IPv4 addresses for the last 24 years and
will continue to do so for several years down the
road.
© Copyright 2005 – Midwest Network Services Group, LLC – all rights reserved
Slide # 29
Requirements for VLSM
• The routing protocols must carry prefixlength (subnet mask) information for each
route advertisement.
• All routers must consistently forward IP
datagrams based on the longest match
rule
• For route aggregation to occur, the
addresses must be assigned in contiguous
blocks so that there is topological
significance.
© Copyright 2005 – Midwest Network Services Group, LLC – all rights reserved
Slide # 30
Requirements for VLSM
• Routing Protocols –
– OSPF, IS-IS, RIPv2, EIGRP, BGPv4 allow the
deployment of VLSM by including the prefix
length value along with each route
advertisement.
– RIPv1 and IGRP only send the network
information (no subnet mask) in each route
advertisement and thus are not capable of
supporting VLSM.
© Copyright 2005 – Midwest Network Services Group, LLC – all rights reserved
Slide # 31
Requirements for VLSM
• Longest Match Rule
– When forwarding a packet, a router will always prefer the route
with the longest matching prefix over other, less-specific routes.
router# show ip route
....
S 192.168.32.0/26 [90/25789217] via 10.1.1.1
S 192.168.32.0/24 [120/4] via 10.1.1.2
S 192.168.32.0/19 [110/229840] via 10.1.1.3
....
– A route with a longer prefix describes a subnet that has fewer
possible destination hosts and thus is “more specific.”
– Routers must forward datagrams using the route with the
“longest match”
– A packet destined toward 192.168.32.1 will be directed toward
10.1.1.1 because it is the most-specific matching route.
© Copyright 2005 – Midwest Network Services Group, LLC – all rights reserved
Slide # 32
Requirements for VLSM
• Contiguous Assignments
– Hierarchical routing requires that addresses be
assigned to reflect the actual network topology.
– Routing information is reduced by taking a block of
addresses assigned to a particular region of the
network (or topology) and aggregating them into a
single routing update for the entire set.
– This can be done recursively at various points within
the hierarchy.
– If addresses do not have topological significance,
aggregation cannot be performed and the size of the
routing tables would not be reduced.
© Copyright 2005 – Midwest Network Services Group, LLC – all rights reserved
Slide # 33
Typical Subnet Masks Used
• LAN Segments – various masks (/30 or larger)
• Router Loopback Interfaces (/32) for
management and routing protocol purposes
• Point-to-Point (P2P) Wide-Area-Network (WAN)
Interfaces (/30 or /31)
• Multi-point WAN interfaces (/30 or larger)
© Copyright 2005 – Midwest Network Services Group, LLC – all rights reserved
Slide # 34
VLSM Math
• Essentially the same as “regular” subnetting,
except that subnets can be re-subnetted as
needed.
• How many hosts per subnet?
2n – 2 hosts per subnet
– Where ‘n’ is the number of “host” bits in the subnet
• How many “sub” subnets?
2x subnets
– Where ‘x’ is the number of subnet bits “borrowed” from
the parent network
© Copyright 2005 – Midwest Network Services Group, LLC – all rights reserved
Slide # 35
Questions?
© Copyright 2005 – Midwest Network Services Group, LLC – all rights reserved
Slide # 36