IPv4 Address Classes

navybeansvietnameseNetworking and Communications

Oct 24, 2013 (3 years and 7 months ago)

174 views

IPv4 Address Classes

The IPv4 address space can be subdivided into 5
classes

-

Class A, B, C, D
and E. Each class consists of a contiguous subset of the overall IPv4
address range.


With a few special exceptions explained further below, the values of the
leftmost four bits of an IPv4 address determine its class as follows:



Class

Leftmost bits

Start address

Finish address

A

0xxx

0.0.0.0

127.255.255.255

B

10xx

128.0.0.0

191.255.255.255

C

110x

192.0.0.0

223.255.255.255

D

1110

224.0.0.0

239.255.255.255

E

1111

240.0.0.0

255.255.255.255



All Class C addresses, for example, have the leftmost three bits set to '110',
but each of the remaining 29 bits may be set to either '0' or '1'
independently (as represented by an
x

in these bit positions):

110xxxxx
xxxxxxxx xxxxxxxx xxxxxxxx

Converting the above to dotted decimal notation, it follows that all Class C
addresses fall in the range from 192.0.0.0 through 223.255.255.255.









IP Address Class E and Limited Broadcast

The IPv4 networking standard defi
nes Class E addresses as reserved,
meaning that they should not be used on IP networks. Some research
organizations use Class E addresses for experimental purposes. However,
nod
es

that try to use these addresses on the Internet will be unable to
communicate properly.

A special type of IP address is the limited broadcast address
255.255.255.255. A broadcast involves delivering a message from one
sender to many recipients. Sender
s direct an IP broadcast to
255.255.255.255 to indicate all other nodes on the local network (
LAN
)
should pick up that message. This broadcast is 'limited' in that it does not
r
each every node on the Internet, only nodes on the LAN.

Technically, IP reserves the entire range of addresses from 255.0.0.0
through 255.255.255.255 for broadcast, and this range should not be
considered part of the normal Class E range.













IP
Address Class D and Multicast

The IPv4 networking standard defines Class D addresses as reserved for
multicast. Multicast is a mechanism for defining groups of nodes and
sending IP messages to that group rather than to every node on the LAN
(broadcast) or
just one other node (unicast).

Multicast is mainly used on research networks. As with Class E, Class D
addresses should not be used by ordinary nodes on the Internet
.

IP Address Class A, Class B, and Class C

Class A, Class B, and Class C are the three cl
asses of addresses used on IP
networks in common practice, with three exceptions as explained next.















IP Loopback Address

127.0.0.1 is the loopback address in IP. Loopback is a test mechanism of
network adapters
. Messages sent to 127.0.0.1 do not get delivered to the
network. Instead, the adapter intercepts all loopback messages and returns
them to the sending application. IP applications often use this feature to

test the behavior of their network interface.

As with broadcast, IP officially reserves the entire range from 127.0.0.0
through 127.255.255.255 for loopback purposes. Nodes should not use this
range on the Internet, and it should not be considered part of

the normal
Class A range
.
















Zero Addresses

As with the loopback range, the address range from 0.0.0.0 through
0.255.255.255 should not be considered part of the normal Class A range.
0.x.x.x addresses serve no particular function in IP, but
nodes attempting
to use them will be unable to communicate properly on the Internet.



















Private Addresses

The IP standard defines specific address ranges within Class A, Class B, and
Class C reserved for use by private networks (
intranets
). The table below
lists these reserved ranges of the IP address space.

Class

Private start address

Private finish address

A

10.0.0.0

10.255.255.255

B

172.16.0.0

172.31.25
5.255

C

192.168.0.0

192.168.255.255

Nodes are effectively free to use addresses in the private ranges if they are
not connected to the Internet, or if they reside behind
f
irewalls

or other
gateways

that use
Network Address Translation (NAT)
.















CIDR
-

Classless Inter
-
Domain Routing


IPv4
TCP/IP

Subnet Table

While subnetting might be easy enough to grasp as a concept, it can be a
bit involved, and even mind
-
boggling in part due
to the required
manipulations of binary numbers. Many people understand the ideas behind
subnetting, but find it hard to follow the actual steps required to
subnet a
network. The table bel
ow is intended as a quick reference and a fairly
complete example of

IPv4

subnetting.


Subnet Mask
(Netmask)

Binary

CIDR

Hosts
*

Inverse Mask
**

Notes

255.255.255.255

11111111.11111111.11111111.11111111

/32

1

0.0.0.0

single host mask

255.255.255.25
4

11111111.11111111.11111111.11111110

/31

0



unusable mask, no host
bits

255.255.255.252

11111111.11111111.11111111.11111100

/30

2

0.0.0.3



255.255.255.248

11111111.11111111.11111111.11111000

/29

6

0.0.0.7



255.255.255.240

11111111.11111111.11111111.
11110000

/28

14

0.0.0.15



255.255.255.224

11111111.11111111.11111111.11100000

/27

30

0.0.0.31



255.255.255.192

11111111.11111111.11111111.11000000

/26

62

0.0.0.63



255.255.255.128

11111111.11111111.11111111.10000000

/25

126

0.0.0.127



255.255.255.0

11111111.11111111.11111111.00000000

/24

254

0.0.0.255

1 Class C network













255.255.254.0

11111111.11111111.11111110.00000000

/23

510

0.0.1.255

2 Class C
networks

2
55.255.252.0

11111111.11111111.11111100.00000000

/22

1022

0.0.3.255

4 Class C

255.255.248.0

11111111.11111111.11111000.00000000

/21

2046

0.0.7.255

8 Class C

255.255.240.0

11111111.11111111.11110000.00000000

/20

4094

0.0.15.255

16 Class C

255.255.224.0

1
1111111.11111111.11100000.00000000

/19

8190

0.0.31.255

32 Class C

255.255.192.0

11111111.11111111.11000000.00000000

/18

16382

0.0.63.255

64 Class C

255.255.128.0

11111111.11111111.10000000.00000000

/17

32766

0.0.127.255

128 Class C

255.255.0.0

11111111.
11111111.00000000.00000000

/16

65534

0.0.255.255

1 Class B Network (255
Class C)













255.254.0.0

11111111.11111110.00000000.00000000

/15

131070

0.1.255.255

2 Class B networks

255.252.0.0

11111111.11111100.00000000.00000000

/14

262142

0.3.255.255

4 Class B

255.248.0.0

11111111.11111000.00000000.00000000

/13

524286

0.7.255.255

8 Class B

255.240.0.0

11111111.11110000.00000000.00000000

/12

1M

0.15.255.255

16 Class B

255.224.0.0

11111111.11100000.00000000.00000000

/11

2M

0.31.255.255

32 Class B

25
5.192.0.0

11111111.11000000.00000000.00000000

/10

4M

0.63.255.255

64 Class B

255.128.0.0

11111111.10000000.00000000.00000000

/9

8M

0.127.255.255

128 Class B

255.0.0.0

11111111.00000000.00000000.00000000

/8

16M

0.255.255.255

1 Class A Network (255
Class B
)













254.0.0.0

11111110.00000000.00000000.00000000

/7

32M

1.255.255.255

2 Class A

252.0.0.0

11111100.00000000.00000000.00000000

/6

64M

3.255.255.255



248.0.0.0

11111000.00000000.00000000.00000000

/5

128M

7.255.255.255



240.0.0.0

11110000.00
000000.00000000.00000000

/4

256M

15.255.255.255



224.0.0.0

11100000.00000000.00000000.00000000

/3

512M

31.255.255.255



192.0.0.0

11000000.00000000.00000000.00000000

/2

1024M

63.255.255.255



128.0.0.0

10000000.00000000.00000000.00000000

/1

2048M

127.2
55.255.255



0.0.0.0

00000000.00000000.00000000.00000000

/0

4096M

255.255.255.255



* Usable Hosts
-

(2^N
-
2) method.

** Inverse mask is calculated by subtracting each subnet mask octet value
from 255. The inverse mask is primarily used in Cisco access co
ntrol lists
(ACLs). The rationale behind an inverse mask is that logical ANDing an
inverse mask and an
IP address

gives the host portion of the address,
instead of the n
etw
ork / subnet

portion that a standard subnet mask would.
This is of more interest to certain
TCP/IP

functions.



CIDR Example:

192.182.154.208
/28

Determine the network # range

of the host #’s

IP number in binary
110
0
0000.10110110.10011010.11010000

Netmask:

11111111.11111111.11111111.11110000

And the two binary strings:

Result:

11000000.10110110.10011010.11010000 =

192.182.154.208

Host range:

192.182.154.11010000 can’t use
it’s
the
network number

192.182.154.11010001 1
st

host number = 192.182.154.209

Last value:

192.182.154.11011111 can’t use,
it’s the
broadcast
address

Last value for host #:

192.182.154.110
1111
0

= 222

Number of possible hosts = 222
-
209+1=14

Written in subnet not
ation the address range is

192.182.154.208

with a subnet of 255.255.255.240

IPv6 Address Types


Increasing the IP address pool was one of the major forces behind
developing IPv6. It uses a 128
-
bit address, meaning that we have a
maximum of 2¹²⁸ addresses a
vailable, or
340,282,366,920,938,463,463,374,607,431,768,211,456, or enough to
give multiple IP addresses to every grain of sand on the planet. So our
friendly old 32
-
bit IPv4 dotted
-
quads don't do the job anymore; these
newfangled IPs require eight 16
-
bit

hexadecimal colon
-
delimited blocks. So
not only are they longer, they use numbers and letters. At first glance,
those mondo IPv6 addresses look like impenetrable secret code:

2001:0db8:3c4d:0015:0000:0000:abcd:ef12


IPv6 Address Types

IPv6 does not use c
lasses. IPv6 supports the following three IP address
types:



unicast



multicast



anycast

Unicast and multicast messaging in IPv6 are conceptually the same as in
IPv4. IPv6 does not support broadcast, but its multicast mechanism
accomplishes essentially th
e same effect. Multicast addresses in IPv6 start
with 'FF' (255) just like IPv4 addresses.

Anycast in IPv6 is a variation on multicast. Whereas multicast delivers
messages to all nodes in the multicast group, anycast delivers messages to
any one node in t
he multicast group. Anycast is an advanced networking
concept designed to support the failover and load balancing needs of
applications.





IPv6 Reserved Addresses

IPv6 reserves just two special addresses: 0:0:0:0:0:0:0:0 and
0:0:0:0:0:0:0:1. IPv6 uses 0
:0:0:0:0:0:0:0 internal to the protocol
implementation, so nodes cannot use it for their own communication
purposes. IPv6 uses 0:0:0:0:0:0:0:1 as its loopback address, equivalent to
127.0.0.1 in IPv4.


Address Ranges


These are the address ranges available

to use, as assigned by the
IANA
(Internet Assigned Numbers Authority)
. All the others are reserved:

IPv6 Prefix Allocation

--------------------------------------

0000::/8 Reserve
d by IETF

2000::/3 Global Unicast

FC00::/7 Unique Local Unicast

FE80::/10 Link Local Unicast

FF00::/8 Multicast


These blocks are reserved for examples

and documentation

---------------------------------------

3fff:ffff::/32

2001:0DB
8::/32 EXAMPLENET
-
WF

The loopback address and IPv6 addresses with embedded IPv4 addresses
come from the 0000::/8 address block.

Anycast addresses come from the unicast address space, so you can't tell
from the prefix that they are anycast addresses.





Address Dissection

You'll probably be running mixed IPv6/IPv4 networks for some time. IPv6
addresses must total 128 bits. IPv4 addresses are represented like this:

0000:0000:0000:0000:0000:0000:192.168.1.25

Eight blocks of 16 bits each are required in a
n IPv6 address. The IPv4
address occupies 32 bits, so that is why there are only seven colon
-
delimited blocks.

The localhost address is 0000:0000:0000:0000:0000:0000:0000:0001.

Naturally we want shortcuts, because these are long and all those zeroes
are
just dumb
-
looking. Leading zeroes can be omitted, and contiguous
blocks of zeroes can be omitted entirely, so we end up with these:

2001:0db8:3c4d:0015:0:0:abcd:ef12

2001:0db8:3c4d:0015::abcd:ef12

::192.168.1.25

::1