PDF(38.1 KB) View with Adobe Reader on a variety of devices
ePub(81.6 KB) View in various apps on iPhone, iPad, Android, Sony Reader, or Windows Phone
Mobi (Kindle)(69.0 KB) View on Kindle device or Kindle app on multiple devices
Updated:May 17, 2023
The documentation set for this product strives to use bias-free language. For the purposes of this documentation set, bias-free is defined as language that does not imply discrimination based on age, disability, gender, racial identity, ethnic identity, sexual orientation, socioeconomic status, and intersectionality. Exceptions may be present in the documentation due to language that is hardcoded in the user interfaces of the product software, language used based on RFP documentation, or language that is used by a referenced third-party product. Learn more about how Cisco is using Inclusive Language.
This document describes how IP addresses are used within hosts and subnets.
There are no specific requirements for this document.
This document is not restricted to specific software and hardware versions.
The information in this document was created from the devices in a specific lab environment. All of the devices used in this document started with a cleared (default) configuration. If your network is live, ensure that you understand the potential impact of any command.
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 with 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 addresses, refer to Configure IP Addresses and Unique Subnets for New Users.
These 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. Notice 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
As a concept, subnetting divides the network into smaller portions called subnets. This is done with borrowed bits from the host portion of the IP address, and this enables a 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 next 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.
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 can represent a subnet.
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 Software Release12.0, ip subnet-zero is enabled by default. For more information on the all-ones subnet and subnet zero, refer to Configure Subnet Zero and 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 can 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, this leaves 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 ( * ).
Use 31-Bit Prefixes on IPv4 Point-to-Point Links
RFC 3021 describes the use of 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. When 31-bit prefixes are used, 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.
Note: Only registered Cisco users can access internal Cisco sites, tools, and information.