IPv4 Address Classes

advertisement
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
A
B
C
D
E
Leftmost bits
0xxx
10xx
110x
1110
1111
Start address
0.0.0.0
128.0.0.0
192.0.0.0
224.0.0.0
240.0.0.0
Finish address
127.255.255.255
191.255.255.255
223.255.255.255
239.255.255.255
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 defines 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,
nodes 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. Senders 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
reach 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 classes 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.255.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 firewalls 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 below is intended as a quick reference and a fairly
complete example of IPv4 subnetting.
Subnet Mask
(Netmask)
255.255.255.255
11111111.11111111.11111111.11111111
/32
1
255.255.255.254
11111111.11111111.11111111.11111110
/31
0
255.255.255.252
255.255.255.248
255.255.255.240
255.255.255.224
255.255.255.192
255.255.255.128
255.255.255.0
11111111.11111111.11111111.11111100
255.255.254.0
255.255.252.0
255.255.248.0
255.255.240.0
255.255.224.0
255.255.192.0
255.255.128.0
11111111.11111111.11111110.00000000
255.255.0.0
11111111.11111111.00000000.00000000
255.254.0.0
255.252.0.0
255.248.0.0
255.240.0.0
255.224.0.0
255.192.0.0
255.128.0.0
11111111.11111110.00000000.00000000
255.0.0.0
11111111.00000000.00000000.00000000
254.0.0.0
252.0.0.0
248.0.0.0
240.0.0.0
224.0.0.0
192.0.0.0
128.0.0.0
11111110.00000000.00000000.00000000
Binary
CIDR Hosts* Inverse Mask**
0.0.0.0
/30
11111111.11111111.11111111.11111000 /29
11111111.11111111.11111111.11110000 /28
11111111.11111111.11111111.11100000 /27
11111111.11111111.11111111.11000000 /26
11111111.11111111.11111111.10000000 /25
11111111.11111111.11111111.00000000 /24
2
6
14
30
62
126
254
0.0.0.3
0.0.0.7
0.0.0.15
0.0.0.31
0.0.0.63
0.0.0.127
0.0.0.255
/23
11111111.11111111.11111100.00000000 /22
11111111.11111111.11111000.00000000 /21
11111111.11111111.11110000.00000000 /20
11111111.11111111.11100000.00000000 /19
11111111.11111111.11000000.00000000 /18
11111111.11111111.10000000.00000000 /17
510
1022
2046
4094
8190
16382
32766
0.0.1.255
0.0.3.255
0.0.7.255
0.0.15.255
0.0.31.255
0.0.63.255
0.0.127.255
/16
/15
11111111.11111100.00000000.00000000 /14
11111111.11111000.00000000.00000000 /13
11111111.11110000.00000000.00000000 /12
11111111.11100000.00000000.00000000 /11
11111111.11000000.00000000.00000000 /10
11111111.10000000.00000000.00000000 /9
/8
/7
11111100.00000000.00000000.00000000 /6
11111000.00000000.00000000.00000000 /5
11110000.00000000.00000000.00000000 /4
11100000.00000000.00000000.00000000 /3
11000000.00000000.00000000.00000000 /2
10000000.00000000.00000000.00000000 /1
65534 0.0.255.255
131070 0.1.255.255
262142 0.3.255.255
524286 0.7.255.255
1M
0.15.255.255
2M
0.31.255.255
4M
0.63.255.255
8M
0.127.255.255
Notes
single host mask
unusable mask, no host
bits
1 Class C network
2 Class C networks
4 Class C
8 Class C
16 Class C
32 Class C
64 Class C
128 Class C
1 Class B Network (255
Class C)
2 Class B networks
4 Class B
8 Class B
16 Class B
32 Class B
64 Class B
128 Class B
1 Class A Network (255
Class B)
16M
0.255.255.255
32M
64M
128M
256M
512M
1024M
2048M
1.255.255.255 2 Class A
3.255.255.255
7.255.255.255
15.255.255.255
31.255.255.255
63.255.255.255
127.255.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 control 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 network / 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
11000000.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 1st 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.11011110 = 222
Number of possible hosts = 222-209+1=14
Written in subnet notation 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 available, 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 classes. 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 the 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 the 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
Reserved 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:0DB8::/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 an IPv6 address. The IPv4
address occupies 32 bits, so that is why there are only seven colondelimited 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
Download