variable-length subnet masking (vlsm) by r. benjamin kessler, ccie #8762

36
Variable-Length Subnet Masking (VLSM) By R. Benjamin Kessler, CCIE #8762 M ID W EST N ETW O RK S ERVICES G RO UP

Upload: amie-wood

Post on 13-Jan-2016

242 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Variable-Length Subnet Masking (VLSM) By R. Benjamin Kessler, CCIE #8762

Variable-Length Subnet Masking (VLSM)

By

R. Benjamin Kessler, CCIE #8762

MIDWESTNETWORKSERVICESG

R O U P

Page 2: 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

Page 3: Variable-Length Subnet Masking (VLSM) By R. Benjamin Kessler, CCIE #8762

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

Page 4: Variable-Length Subnet Masking (VLSM) By R. Benjamin Kessler, CCIE #8762

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

Page 5: Variable-Length Subnet Masking (VLSM) By R. Benjamin Kessler, CCIE #8762

IP Address Classes

• Network “Class” determined by the high order address bits

© Copyright 2005 – Midwest Network Services Group, LLC – all rights reserved Slide # 5

Page 6: Variable-Length Subnet Masking (VLSM) By R. Benjamin Kessler, CCIE #8762

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

Page 7: Variable-Length Subnet Masking (VLSM) By R. Benjamin Kessler, CCIE #8762

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

Page 8: Variable-Length Subnet Masking (VLSM) By R. Benjamin Kessler, CCIE #8762

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

Page 9: Variable-Length Subnet Masking (VLSM) By R. Benjamin Kessler, CCIE #8762

Subnetting

Internet

179.11.0.0

179.11.16.0

179.11.32.0

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

Single advertisement to the Internet;Multiple segments/subnets internally

Page 10: Variable-Length Subnet Masking (VLSM) By R. Benjamin Kessler, CCIE #8762

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

Page 11: Variable-Length Subnet Masking (VLSM) By R. Benjamin Kessler, CCIE #8762

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

Page 12: Variable-Length Subnet Masking (VLSM) By R. Benjamin Kessler, CCIE #8762

Subnet Example

• Host A needs to communicate with Servers 1 & 2.

• Must make “ARP or Route” decision

© Copyright 2005 – Midwest Network Services Group, LLC – all rights reserved Slide # 12

179.11.32.0/20

`

179.11.48.0/20

179.11.35.22/20 179.11.46.89/20

179.11.47.254/20

179.11.63.254/20

179.11.50.1/20

Host “A” Server 1

Server 2

Page 13: Variable-Length Subnet Masking (VLSM) By R. Benjamin Kessler, CCIE #8762

Subnet Example

Subnet Mask:255.255.240.0 11111111.11111111.11110000.00000000

Host A:179.11.35.22 10110011.00001011.00100011.00010110

Server 1:179.11.46.89 10110011.00001011.00101110.01011001

Gateway – intf 1:179.11.47.254 10110011.00001011.00101111.11111110

Server 2:179.11.50.1 10110011.00001011.00110010.00000001

Gateway – intf 2:179.11.63.254 10110011.00001011.00111111.11111110

© Copyright 2005 – Midwest Network Services Group, LLC – all rights reserved Slide # 13

Page 14: Variable-Length Subnet Masking (VLSM) By R. Benjamin Kessler, CCIE #8762

Problems with Subnetting

• Once designated, the size and number of subnets remains static. Making changes requires an organization to completely re-address 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

Page 15: Variable-Length Subnet Masking (VLSM) By R. Benjamin Kessler, CCIE #8762

Example Network

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

179.11.32.0/22

179.11.48.0/22Network A: 300 Hosts

179.11.64.0/22

179.11.80.0/22

Network B: 50 Hosts

Network C: 2 Hosts

Network D: 20 Hosts

Network E: 500 Hosts

179.11.96.0/22

Page 16: Variable-Length Subnet Masking (VLSM) By R. Benjamin Kessler, CCIE #8762

Variable Length SubnetMasking (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

Page 17: Variable-Length Subnet Masking (VLSM) By R. Benjamin Kessler, CCIE #8762

Variable Length SubnetMasking (VLSM)

• VLSM goes “Hand-in-hand” with Classless Inter-Domain 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

Page 18: Variable-Length Subnet Masking (VLSM) By R. Benjamin Kessler, CCIE #8762

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

Page 19: Variable-Length Subnet Masking (VLSM) By R. Benjamin Kessler, CCIE #8762

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

Page 20: Variable-Length Subnet Masking (VLSM) By R. Benjamin Kessler, CCIE #8762

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

Page 21: Variable-Length Subnet Masking (VLSM) By R. Benjamin Kessler, CCIE #8762

Example Networkw/VLSM

– 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

179.11.32.0/23

179.11.48.0/27Network A: 300 Hosts

179.11.64.0/26

179.11.80.0/23

Network B: 50 Hosts

Network C: 2 Hosts

Network D: 20 Hosts

Network E: 500 Hosts

179.11.96.0/30

Page 22: Variable-Length Subnet Masking (VLSM) By R. Benjamin Kessler, CCIE #8762

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

Page 23: Variable-Length Subnet Masking (VLSM) By R. Benjamin Kessler, CCIE #8762

BIG Corp Network

© Copyright 2005 – Midwest Network Services Group, LLC – all rights reserved Slide # 23

Internet

179.11.0.0/16

Widget Mfg Division

179.11.16.0/20

Sales Division

179.11.64.0/19

Headquarters

179.11.128.0/18

Page 24: Variable-Length Subnet Masking (VLSM) By R. Benjamin Kessler, CCIE #8762

Widget Mfg Division

© Copyright 2005 – Midwest Network Services Group, LLC – all rights reserved Slide # 24

BIG CorpWAN

179.11.16.0/20

Muncie Plant

179.11.16.0/22

Hartford City Plant

179.11.22.0/23

Tipton Plant

179.11.28.0/24

Page 25: Variable-Length Subnet Masking (VLSM) By R. Benjamin Kessler, CCIE #8762

Muncie Plant

© Copyright 2005 – Midwest Network Services Group, LLC – all rights reserved Slide # 25

Widget Div.WAN

179.11.16.0/22

Plant Office Shop Floor Shipping Dock

`

179.11.16.0/24

179.11.16.11/24Server 1

Wkstn A179.11.16.87/24

`

179.11.17.0/24

Wkstn C179.11.17.55/24

`

Wkstn B

179.11.17.54/24

`

179.11.18.0/24

179.11.18.66/24Server 2

Wkstn D179.11.18.91/24

Page 26: Variable-Length Subnet Masking (VLSM) By R. Benjamin Kessler, CCIE #8762

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

Page 27: Variable-Length Subnet Masking (VLSM) By R. Benjamin Kessler, CCIE #8762

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

Page 28: Variable-Length Subnet Masking (VLSM) By R. Benjamin Kessler, CCIE #8762

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

Page 29: Variable-Length Subnet Masking (VLSM) By R. Benjamin Kessler, CCIE #8762

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

Page 30: Variable-Length Subnet Masking (VLSM) By R. Benjamin Kessler, CCIE #8762

Requirements for VLSM

• The routing protocols must carry prefix-length (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

Page 31: Variable-Length Subnet Masking (VLSM) By R. Benjamin Kessler, CCIE #8762

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

Page 32: Variable-Length Subnet Masking (VLSM) By R. Benjamin Kessler, CCIE #8762

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

Page 33: Variable-Length Subnet Masking (VLSM) By R. Benjamin Kessler, CCIE #8762

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

Page 34: Variable-Length Subnet Masking (VLSM) By R. Benjamin Kessler, CCIE #8762

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

Page 35: Variable-Length Subnet Masking (VLSM) By R. Benjamin Kessler, CCIE #8762

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

Page 36: Variable-Length Subnet Masking (VLSM) By R. Benjamin Kessler, CCIE #8762

Questions?

© Copyright 2005 – Midwest Network Services Group, LLC – all rights reserved Slide # 36