Monday, July 30, 2012

Host and Subnet Quantities


Introduction

An IP address is 32 bits long and made up of two components, a network portion and a host portion. The network address is used to identify the network and is common to all the devices attached to the network. The host (or node) address is used to identify a particular device attached to the network. The IP address is generally represented using the dotted-decimal notation, where 32 bits are divided into four octets. Each of the octets can be represented in a decimal format, separated by decimal points. For more information on IP addressing, refer to IP Addressing and Subnetting for New Users.

Prerequisites

Requirements

There are no specific requirements for this document.

Components Used

This document is not restricted to specific software and hardware versions.

Conventions

Refer to Cisco Technical Tips Conventions for more information on document conventions.

Classes

The following are the classes of IP addresses.
  • Class A "The first octet denotes the network address, and the last three octets are the host portion. Any IP address whose first octet is between 1 and 126 is a Class A address. Note that 0 is reserved as a part of the default address, and 127 is reserved for internal loopback testing.
  • Class B "The first two octets denote the network address, and the last two octets are the host portion. Any address whose first octet is in the range 128 to 191 is a Class B address.
  • Class C "The first three octets denote the network address, and the last octet is the host portion. The first octet range of 192 to 223 is a Class C address.
  • Class D "Used for multicast. Multicast IP addresses have their first octets in the range 224 to 239.
  • Class E "Reserved for future use and includes the range of addresses with a first octet from 240 to 255.

Subnetting and Tables

Subnetting is the concept of dividing the network into smaller portions called subnets. This is done by borrowing bits from the host portion of the IP address, enabling more efficient use of the network address. A subnet mask defines which portion of the address is used to identify the network and which denotes the hosts.
The following tables show all possible ways a major network can be subnetted, and, in each case, how many effective subnets and hosts are possible.
There are three tables, one for each class of addresses.
  • The first column shows how many bits are borrowed from the host portion of the address for subnetting.
  • The second column shows the resulting subnet mask in dotted decimal format.
  • The third column shows how many subnets are possible.
  • The fourth column shows how many valid hosts are possible on each of these subnets.
  • The fifth column shows the number of subnet mask bits.

Class A Host/Subnet Table

Class A
Number of
Bits Borrowed Subnet Effective Number of Number of Subnet
from Host Portion Mask Subnets Hosts/Subnet Mask Bits
------- --------------- --------- ------------- -------------
1 255.128.0.0 2 8388606 /9
2 255.192.0.0 4 4194302 /10
3 255.224.0.0 8 2097150 /11
4 255.240.0.0 16 1048574 /12
5 255.248.0.0 32 524286 /13
6 255.252.0.0 64 262142 /14
7 255.254.0.0 128 131070 /15
8 255.255.0.0 256 65534 /16
9 255.255.128.0 512 32766 /17
10 255.255.192.0 1024 16382 /18
11 255.255.224.0 2048 8190 /19
12 255.255.240.0 4096 4094 /20
13 255.255.248.0 8192 2046 /21
14 255.255.252.0 16384 1022 /22
15 255.255.254.0 32768 510 /23
16 255.255.255.0 65536 254 /24
17 255.255.255.128 131072 126 /25
18 255.255.255.192 262144 62 /26
19 255.255.255.224 524288 30 /27
20 255.255.255.240 1048576 14 /28
21 255.255.255.248 2097152 6 /29
22 255.255.255.252 4194304 2 /30
23 255.255.255.254 8388608 2* /31

Class B Host/Subnet Table

Class B      Subnet               Effective       Effective    Number of Subnet
Bits Mask Subnets Hosts Mask Bits
------- --------------- --------- --------- -------------
1 255.255.128.0 2 32766 /17
2 255.255.192.0 4 16382 /18
3 255.255.224.0 8 8190 /19
4 255.255.240.0 16 4094 /20
5 255.255.248.0 32 2046 /21
6 255.255.252.0 64 1022 /22
7 255.255.254.0 128 510 /23
8 255.255.255.0 256 254 /24
9 255.255.255.128 512 126 /25
10 255.255.255.192 1024 62 /26
11 255.255.255.224 2048 30 /27
12 255.255.255.240 4096 14 /28
13 255.255.255.248 8192 6 /29
14 255.255.255.252 16384 2 /30
15 255.255.255.254 32768 2* /31

Class C Host/Subnet Table

Class C      Subnet       Effective  Effective  Number of Subnet
Bits Mask Subnets Hosts Mask Bits
------- --------------- --------- --------- --------------
1 255.255.255.128 2 126 /25
2 255.255.255.192 4 62 /26
3 255.255.255.224 8 30 /27
4 255.255.255.240 16 14 /28
5 255.255.255.248 32 6 /29
6 255.255.255.252 64 2 /30
7 255.255.255.254 128 2* /31

Subnetting Example

The first entry in the Class A table (/10 subnet mask) borrows two bits (the leftmost bits) from the host portion of the network for subnetting, then with two bits you have four (22) combinations, 00, 01, 10, and 11. Each of these will represent a subnet.
Binary Notation                                        Decimal Notation 
-------------------------------------------------- -----------------
xxxx xxxx. 0000 0000.0000 0000.0000 0000/10 ------> X.0.0.0/10
xxxx xxxx. 0100 0000.0000 0000.0000 0000/10 ------> X.64.0.0/10
xxxx xxxx. 1000 0000.0000 0000.0000 0000/10 ------> X.128.0.0/10
xxxx xxxx. 1100 0000.0000 0000.0000 0000/10 ------> X.192.0.0/10
Out of these four subnets, 00 and 11 are called subnet zero and the all-ones subnet, respectively. Prior to Cisco IOS® Software Release 12.0, the ip subnet-zero global configuration command was required to be able to configure subnet zero on an interface. In Cisco IOS 12.0, ip subnet-zero is enabled by default. For more information on the all-ones subnet and subnet zero, refer to Subnet Zero and the All-Ones Subnet.
Note: The subnet zero and all-ones subnet are included in the effective number of subnets as shown in the third column.
Since the host portion has now lost two bits, the host portion will have only 22 bits (out of the last three octets). This means the complete Class A network is now divided (or subnetted) into four subnets, and each subnet can have 222 hosts (4194304). A host portion with all zeros is network number itself, and a host portion with all ones is reserved for broadcast on that subnet, leaving the effective number of hosts to 4194302 (222 " 2), as shown in the fourth column. An exception to this rule is 31-bit prefixes, marked with an asterisk ( * ).

Using 31-Bit Prefixes on IPv4 Point-to-Point Links

RFC 3021 leavingcisco.com describes using 31-bit prefixes for point-to-point links. This leaves 1 bit for the host-id portion of the IP address. Normally a host-id of all zeros is used to represent the network or subnet, and a host-id of all ones is used to represent a directed broadcast. Using 31-Bit prefixes, the host-id of 0 represents one host, and a host-id of 1 represents the other host of a point-to-point link.
Local link (limited) broadcasts (255.255.255.255) can still be used with 31-bit prefixes. But directed broadcasts are not possible to a 31-bit prefix. This is not really a problem because most routing protocols use multicast, limited broadcasts, or unicasts

No comments:

Post a Comment