Download as pdf or txt
Download as pdf or txt
You are on page 1of 16

IPv4 and IPv6 Addressing - Part 4: CIDR,

VLSM & IPv6 addressing


Walter Goralski, Juniper Networks - June 28, 2010

[Part 1 of this article begins with an overview of IP addressing. Part 2 reviews the network/host
boundary and examines the IPv4 address in detail. Part 3 looks at the IPv6 header and address, as
well as the basics of subnetting.]

CIDR and VLSM


Today, the standard methods for moving the network/host address boundary are variable-length
subnet masking (VLSM) for host addressing and routing inside a routing domain, and classless
interdomain routing (CIDR) for routing between routing domains. (We'll talk more about routing
domains later in this book. For now, think of a routing domain as an ISP's collection of routers.) And
although treated separately here for introductory reasons, it is important to realize that VLSM is the
fundamental mechanism of CIDR.

CIDR (defined in RFC 1519) and VLSM (defined in RFC 1860) address more general issues than
simple subnetting. We've been looking at addresses from the host perspective in this chapter so far.
Let's discuss CIDR from the router perspective.

CIDR was an immediate answer to two problems: first, the impending exhaustion of the Class A and
Class B address space, and second, the rapid increase in Internet core routing table sizes to handle
the many Class C addresses required to handle new users.

In CIDR, a block of contiguous IP addresses from the former classful address space are assigned in a
group, such as groups of Class C addresses. This allows a service provider or large customer to
configure IP networks from a few hosts up to 16,384 hosts. The number of contiguous addresses
needed is determined by a simple count of the number of host addresses required.

The original CIDR plan, applied to Class C addresses, is shown in Table 4.4. Contiguous address
numbers flow seamlessly between former class boundaries, allowing assignment of address "chunks"
for larger networks.

Table 4.4 Address Grouping under CIDR*

The CIDR RFC does not "subtract" two host addresses for the network itself (final bits all 0s) and a
broadcast address (final bits all 1s). CIDR applies mainly to router operation, and routers do not
assume any structure of the IP addresses in the packets they route.The limitation on assigning the
high and low IP addresses to a host interface is a function of the host TCP/IP implementation (and
some, like routers, do not enforce any limitations at all).

CIDR changed the terminology that applied to IP addresses. Routes to IP networks are now
represented by prefixes. A prefix consists of an IP network address, followed by a slash (/), and
followed with an indication of how many of the leftmost contiguous bits in the address are part of the
network mask applied for routing purposes.

For example, before CIDR, the Class C address 192.168.64.0 would ordinarily have a mask of
255.255.255.0. Subnetting could add bits to this major network mask, but only in the fixed patterns
and values outlined in the previous section. CIDR enabled a "CIDR-ized" network address to be
represented as 192.168.64.0/18, and that was all the information needed. Sometimes this is
abbreviated even further to just 192.168.64/18, but the two forms are equivalent. The notation just
means that a "subnet mask 18 bits long should be applied to 192.168.64.0." This is the same as
writing "192.168.64.0 with mask 255.255.192.0" but in more compact form.

CIDR (cont.)
Table 4.5 shows all possible prefix lengths, their netmasks in dotted decimal, and the number of
classful networks the prefix represents. It also shows the number of usable IPv4 addresses that can
be assigned to hosts once the network address itself and the directed broadcast address are
subtracted. We'll talk about the special 0/0 address and prefix length in Chapter 8. All possible mask
lengths are shown for /1 to /32. The /0 mask matches the whole Internet and is discussed in the
routing chapters.

Table 4.5 CIDR Prefixes and Addressing*

Even when CIDR was used, all bits after the IP network address had to be zero, an aspect of IP
addressing that did not change. For example, 192.168.64.0/18 was a valid IP network address, but
192.168.64.0/17 was not (due to the presence of the "1" bit for the "64" in the 17th bit position). This
aspect of CIDR is shown in Figure 4.6. The IP network 192.168.64.0/18 is a CIDR "supernet" because
the mask contained fewer bits than the natural mask in classful IP addressing.

FIGURE 4.6 CIDR in operation. Basically, supernetting moves the natural mask to the
left while subnetting moves it to the right.
The /31 Prefix
In many cases, a /31 prefix that allows only two IPv4 addresses on a subnet is useless.
Hosts are not normally assigned addresses that indicate the network itself (the lowest
address on the subnet) or the directed broadcast (the highest address on the subnet).
Because a /31 prefix only allows the final bit to be 0 or 1, this prefix is not useful for a
subnet with hosts. Most subnets normally use a /30 prefix at most, which yields two
useful host addresses in addition to the low and high addresses.
However, many router networks employ the /31 prefix to address the endpoints of a
point-to-point link such as SONET/SDH. There are no hosts to worry about, and only
the router network need worry about the use of internal address spaces. With /31
prefixes, a single Class C address space can be used to provide addresses for 128 (256
divided by 2) point-to-point inter-router links, not just 64 (256 divided by 4).

CIDR allowed the creation of a network such as 192.168.64.0/18 with 16,384 hosts (14
bits remain for the host portion of the 192.168.64.0 network) instead of requiring 64
separate IP network addresses to be assigned and configured. CIDR did more than allow
the grouping of contiguous Class C addresses into bigger networks than possible before.
Once the principle was established, CIDR allowed the aggregation of all possible IP
addresses under the specified prefix into this one compact notation. This kept routing
table sizes under control in the late 1990s.

Where does VLSM fit in? As mentioned, VLSM applied more to hosts and a single routing
domain. Basically, in the days of classful IP addressing, all subnets of the same address
had to have the same mask length. So you could, for example, subnet 10.0.0.0/8 into
10.0.0.0/16 subnets, but every device on every subnet had to have the same /16 mask.
This could be okay if all the subnetted LANs had roughly the same number of hosts, but
what about point-to-point links between routers on the subnet? They could get by with a
/31 or /30 mask because there were only two endpoints, but they had to have room for
the same thousands of hosts as the rest of the /16.

Note that the Illustrated Network is an offender: The links between our routers use /24
masks for point-to-point links.We would not do this in the real world, but it will help our
understanding of simple examples when we turn to routing later in this book.

IPV6 Addressing Details


IPV6 ADDRESSING DETAILS
Let's take a quick look at some of the differences between IPv4 and IPv6 addressing. The
use of the IPv6 address space is determined by the value of the first few bits of an IPv6
address. Routing in IPv6 is similar to IPv4 with CIDR and VLSM, but there are a few
points to be made to clarify this.

IPv6 addresses can be provider based, provider independent, or for local use. All
provider-based IPv6 addresses for "aggregatable" global unicast packets begin with
either 0010 (2) or 0011 (3) in the first four bit positions of the 128-bit IPv6 address.

Typical IPv6 address prefixes would look like:


2001:0400::/23
2001:05FF::/29
2001:0408::/35

and so on.

The 64 bits that make up the low-order bits of the IPv6 address must be in a format
known as the EUI-64 (64-bit Extended Unique Identifier). Normally, the 48-bit MAC
address consists of 3 bytes (24 bits) assigned to the manufacturer and 3 bytes (24 bits)
for the serial number of the NIC itself. A typical MAC address would look like
0000:900F:C27E.

The next to the last bit in the first byte of this address is the global/local bit, and is
usually set to a 0 bit (global). This means that the MAC address is globally assigned and
is using the native address assigned by the manufacturer. In EUI-64 format, this bit is
flipped and usually ends up being set to a 1 bit (the meaning is flipped too, so in IPv6, 1
here means global). This would make the first byte 02 instead of 00. For example,
0000:900F:C27E becomes 0200:900F:C27E (not always, but this is just a simple
example).

To convert a MAC address to a 64-bit address that can be used on an interface for the
host portion of an IPv6 address, we insert the string FFFE between the manufacturer
and the serial number fields of the MAC address (between the first and the last 3 bytes).
The MAC address becomes 0200:90FF:FE0F:C27E. This is more easily shown as follows:

• MAC address: 0200:900F:C27E


• Split in half: 0200:90 0F:C27E
• Insert FFFE: FF FE
• Form EUI-64: 0200:90FF:FE0F:C27E

Link-local IPv6 addresses begin with 1111 1110 1000 (FE80 in hexadecimal,
making the first two bytes FE80 if all of the trailing 6 bits in the second byte
are 0 bits). ULA local addresses are in the form FC00::/7. In IPv6, interfaces
are expected to have multiple addresses, a shift from IPv4. It's common to
find three IPv6 addresses on an interface: global, link local, and site local. It
is also common to use multiple link-local addresses, one based on the MAC
and the other based on random numbers.

Both forms usually end with the 48-bit IEEE MAC address, but again with
the added FFFE bits to form the EUI-64 identifier. The FC00 ULA address
forms are used as the private addresses in IPv6 (just as 10.0.0.0 and the
others in IPv4), and that's how they are used in this book.

IPv6 addresses appear in sources and outputs about equally with capitals
(FE80) or lower case (fe80), and we'll see both. (In the RFCs, however, these
are universally capitalized.) The major formats of the IPv6 address are
shown in Figure 4.7.

FIGURE 4.7 Major IPv6 address formats, showing how the value
of the initial bits determine format. The FC00 address format is
often used as private IPv6 address.

Two routers connected by a small LAN can use the link-local


IPv6 address of FE80::<EUI-64 formatted MAC address> on
their interfaces. This type of address is never advertised by an
IPv6 router attached to the Internet, and it cannot be used
across subnets. On point-to-point links, a distinguishing identifier
of the interface card other than the MAC address can be used at
the end of the link-local address.

ULA-L addresses can include a 16-bit subnet field, so these forms


of private IPv6 addresses can be used across subnets (through
routers), but these addresses are not usually advertised onto the
Internet. Using link-local and ULA-local IPv6 addresses, an
organization can build an entire global network, but usually only
if none of the traffic tries to travel across the Internet. If it does,
IPv6 provider–based addresses are needed.

This is similar to building a complete corporate network in IPv4


using the 10.0.0.0 private address space, but using Network
Address Translation (NAT) for traffic that must travel across the
Internet. However, in IPv6, hosts are assigned multiple
addresses, some global and some local. In this case, the lower
order bits (80 bits) of the site-local address (subnet and
interface) are just pasted onto the higher fields (48 bits) of the
provider-based forms of the IPv6 address.

What about private masks and routing in IPv6? As shown above,


prefix masks in IPv6 have the same general form as prefix masks
in IPv4. Here is a sample IPv6 link-local host address (this time
in lower case hex notation) and one possible network prefix for
it:

fe80::90:69ff:fea0:8000/128
fe80:: /64

As in keeping with all of the addresses used in this book, this


IPv6 address is a private address. The /64 mask tells the router
that the first 64 bits of the address are to be used for routing
purposes.

IP Address Assignment
IP Address Assignment
Most people get IP addresses from their ISP. But where do ISPs
get their IP addresses? Large organizations can still apply for
their own IP addresses independent from any ISP. To whom do
they apply?

IP addresses (and the Internet domain names associated with


them) were initially handed out by the Internet Assigned Number
Authority (IANA). Today the Internet Corporation for Assigned
Names and Numbers (ICANN), an international nonprofit
organization, oversees the process of assigning IP addresses.

Actual IP addresses are handed out by the following Regional


Internet Registries (RIRs):

• ARIN (American Registry for Internet Numbers) at


www.arin.net—ARIN has handed out IP addresses for
North and South America, the Caribbean, and Africa
below the Sahara since 1997.

• RIPE NCC (Reseaux IP European Network


Coordination Center) at www.ripe.net— RIPE assigns
IP addresses in Europe and surrounding areas.

• APNIC (Asian Pacific Network Information Center)


at www.apnic.net—APNIC assigns IP addresses in 62
countries and regions in Central Asia, Southeast
Asia, Indochina, and Oceania.

• LACNIC (Latin American and Caribbean Network


Information Center) at www.lacnic.net—LACNIC
assigns IP addresses from ARIN in 38 countries,
including Mexico.

• AfriNIC (African Network Information Center) at


www.afrinic.net—AfriNIC took over assignment of
African IP addresses from ARIN.
All of these Internet Registries databases (who has
what IP address space?) combined are known as the
Internet Routing Registry (IRR). Internet domain
names comprise a related activity, but (like IP
addresses) names must be globally unique and
(unlike IP addresses) can be almost anything.

For the latest information on IP address assignment,


which is always subject to change, see
www.icann.org. When it comes to IPv6, in particular,
IANA still hands out addresses to the registries,
which pass them along to IPv6 ISPs, who allocate
IPv6 addresses to their customers.

The current policy is given at www.arin.net/policy.


An older policy is used in this chapter (see
www.arin.net/policy/ipv6_policy.html) and uses these
prefixes at each step of the process:

• 2001::/16 is reserved for IANA.


• IANA hands out a /23 prefix to each
registry.
• Registry hands out a /32 or shorter
prefix to an IPv6 ISP.
• ISP allocates a /48 prefix for each
customer site.
• Local administrators add 16 bits for
each LAN on their network, for a /64
prefix.

This scheme is shown in Figure 4.8.

FIGURE 4.8 IPv6 address


allocation, showing how
various bits should be
assigned by different entities.
In some places, mobile phone
providers are heavy users of
IPv6 addresses.

When the LAN is included,


most IPv6 addresses have /64
network masks. This is the
prefix length used on the
Illustrated Network. IPv6
routers can perform the
following tasks:

• Route traffic to
a particular ISP
based on the first
32 bits of the
IPv6 destination
address.
• Route traffic to
a particular site
based on the first
48 bits of the
IPv6 destination
address.
• Route traffic to
a particular LAN
based on the first
64 bits of the
IPv6 destination
address.

In practice, IPv6
core routers can
look at (and build
forwarding tables
based on) /32 or
shorter prefixes,
routers inside a
particular AS
(routing domain)
can look at /48
prefixes, and site
routers on the
customer edge
can look at /64
prefixes to get
traffic right to
the destination
LAN.

Now we can
better
understand the
IPv6 address
assigned to CE0
that we saw at
the beginning of
the chapter:

FC00:ffb3:d5:b:2
05:85ff:fe88:ccdb

or

FC00:FFB3:00D5
:000B:0205:75FF
:FE88:CCDB

Let's break it
down one
element at a time
and see where it
all comes from:

• Reg
istry—
We
use
FC00
inste
ad of
2001
to
indic
ate a
privat
e
ULA-l
ocal
IPv6
addre
ss.
• ISP
—We
add
Best
ISP's
AS
numb
er of
6545
9
(0xFF
B3)
for
LAN
1 or
Ace
ISP's
AS
numb
er
6512
7
(0xFE
67)
for
LAN2
.
• Site
—We
add
telep
hony
area
code
213
(0x00
D5)
for
the
Los
Angel
es or
212
(0x00
D4)
for
New
York
sites.
(We
could
alway
s use
more
of the
phon
e
numb
er,
but
this is
enou
gh.)
• LA
N—W
e add
11
(0x00
0B)
for
LAN1
or 12
(0x00
0C)
for
LAN
2.
These
are
borro
wed
from
the
IPv4
addre
sses.
• EUI
-
64—W
e add
0x02
05
85FF
FE88
CCD
B for
the
hard
ware
MAC
addre
ss.

The
mask
is
/64,
natur
ally.
Keep
in
mind
that
in the
real
world
,
none
of
this
comp
lex
codin
g
woul
d be
done.

Print
ed
with
permi
ssion
from
Morg
an
Kauff
man,
a
divisi
on of
Elsevi
er.
Copyr
ight
2008.
"The
Illust
rated
Netw
ork:
How
TCP/I
P
Work
s in a
Mode
rn
Netw
ork"
by
Walte
r
Goral
ski.
For
more
infor
matio
n
about
this
title
and
other
simila
r
books
,
pleas
e visit
www.
elsevi
erdir
ect.co
m.

Relat
ed
links
:
IPv4
and
IPv6
Addr
essin
g-
Part
1:
Overv
iew |
Part
2:
The
IPv4
addre
ss |
Part
3:
The
IPv6
addre
ss
TCP/I
P
Embe
dded
Inter
net
Appli
catio
ns -
The
Netw
ork
Layer
, Part
1:
The
Inter
net
Proto
col |
Part
2:
IPv6,
ICMP
and
UDP |
Part
3:
Trans
missi
on
Contr
ol
Proto
col
(TCP)
Expa
nding
the
Embe
dded
Unive
rse:
Migr
ating
From
IPv4
to
IPv6
Guide
to
Embe
dded
Syste
ms
Archi
tectu
re -
Part
1:
Defini
ng
middl
ewar
e|
Part
2:
PPP
state
pseud
ocode
and
Inter
net
Proto
col |
Part
3:
Trans
port
layer
(UDP
) and
embe
dded
Java
and
netw
orkin
g
middl
ewar
e
exam
ples |
Part
4:
Appli
catio
n
layer
softw
are
exam
ples
An
IPv6
Refre
sher -
Part
I:
IPv6
Addr
essin
g|
Part
II:
Speci
al use
addre
sses |
Part
III:
IPv6
forma
t vs.
IPv4 |
Part
IV:
ICMP
for
IPv6 |
Part
V:
Neig
hbor
Disco
very
Proto
col
and
IPv6

You might also like