You are on page 1of 3


From Wikipedia, the free encyclopedia

Creating a subnet by dividing the host identifier
A subnetwork, or subnet, is a logical, visible subdivision of an IP network.[1]
The practice of dividing a network into two or more networks is called subnettin
Computers that belong to a subnet are addressed with a common, identical, most-s
ignificant bit-group in their IP address. This results in the logical division o
f an IP address into two fields, a network or routing prefix and the rest field
or host identifier. The rest field is an identifier for a specific host or netwo
rk interface.
The routing prefix is expressed in CIDR notation. It is written as the first add
ress of a network, followed by a slash character (/), and ending with the bit-le
ngth of the prefix. For example, is the prefix of the Internet Pr
otocol Version 4 network starting at the given address, having 24 bits allocated
for the network prefix, and the remaining 8 bits reserved for host addressing.
The IPv6 address specification 2001:db8::/32 is a large address block with 296 a
ddresses, having a 32-bit routing prefix. For IPv4, a network is also characteri
zed by its subnet mask, which is the bitmask that when applied by a bitwise AND
operation to any IP address in the network, yields the routing prefix. Subnet ma
sks are also expressed in dot-decimal notation like an address. For example, 255
.255.255.0 is the network mask for the prefix.
Traffic is exchanged (routed) between subnetworks with special gateways (routers
) when the routing prefixes of the source address and the destination address di
ffer. A router constitutes the logical or physical boundary between the subnets.
The benefits of subnetting an existing network vary with each deployment scenari
o. In the address allocation architecture of the Internet using Classless InterDomain Routing (CIDR) and in large organizations, it is necessary to allocate ad
dress space efficiently. It may also enhance routing efficiency, or have advanta
ges in network management when subnetworks are administratively controlled by di
fferent entities in a larger organization. Subnets may be arranged logically in
a hierarchical architecture, partitioning an organization's network address spac
e into a tree-like routing structure.
Contents [hide]
1 Network addressing and routing
2 IPv4 subnetting
2.1 Determining the network prefix
2.2 Subnetting
2.3 Special addresses and subnets
2.3.1 Subnet zero and the all-ones subnet
2.4 Subnet and host counts
3 IPv6 subnetting
4 See also
5 References
6 Further reading
7 External links
Network addressing and routing[edit]
Computers participating in a network such as the Internet each have at least one
logical address. Usually this address is unique to each device and can either b
e configured automatically with the Dynamic Host Configuration Protocol (DHCP) b
y a network server, manually by an administrator, or automatically by stateless
address autoconfiguration.
An address fulfills the functions of identifying the host and locating it on the

network. The most common network addressing architecture is Internet Protocol v

ersion 4 (IPv4), but its successor, IPv6, has been increasingly deployed since a
pproximately 2006. An IPv4 address consists of 32 bits, for readability written
in a form consisting of four decimal octets separated by dots, called dot-decima
l notation. An IPv6 address consists of 128 bits written in a hexadecimal notati
on and grouping 16 bits separated by colons.
For the purpose of network management, an IP address is divided into two logical
parts, the network prefix and the host identifier or rest field. All hosts on a
subnetwork have the same network prefix. This routing prefix occupies the mostsignificant bits of the address. The number of bits allocated within a network t
o the internal routing prefix may vary between subnets, depending on the network
architecture. While in IPv6 the prefix must consist of a set of contiguous 1-bi
ts, in IPv4 this is not enforced, though there is no advantage to using non-cont
iguous 1-bits. The host part is a unique local identification and is either a ho
st number on the local network or an interface identifier.
This logical addressing structure permits the selective routing of IP packets ac
ross multiple networks via special gateway computers, called routers, to a desti
nation host if the network prefixes of origination and destination hosts differ,
or sent directly to a target host on the local network if they are the same. Ro
uters constitute logical or physical borders between the subnets, and manage tra
ffic between them. Each subnet is served by a designated default router, but may
consist internally of multiple physical Ethernet segments interconnected by net
work switches or network bridges.
The routing prefix of an address is written in a form identical to that of the a
ddress itself. This is called the network mask, or subnet mask, of the address.
For example, a specification of the most-significant 18 bits of an IPv4 address,
11111111.11111111.11000000.00000000, is written as If this mask
designates a subnet within a larger network, it is also called the subnet mask.
This form of denoting the network mask, however, is only used for IPv4 networks.
The modern standard form of specification of the network prefix is CIDR notation
, used for both IPv4 and IPv6. It counts the number of bits in the prefix and ap
pends that number to the address after a slash (/) character separator:, netmask is written as
In IPv6, 2001:db8::/32 designates the address 2001:db8:: and its network prefix
consisting of the most significant 32 bits.
This notation was introduced with Classless Inter-Domain Routing (CIDR) in RFC 4
632. In IPv6 this is the only acceptable form to denote network or routing prefi
In classful networking in IPv4, prior to the introduction of CIDR, the network p
refix could be directly obtained from the IP address, based on its highest order
bit sequence. This determined the class (A, B, C) of the address and therefore
the network mask. Since the introduction of CIDR, however, assignment of an IP a
ddress to a network interface requires two parameters, the address and its netwo
rk mask.
In IPv4, on-link determination for an IP address is given simply by the address
and netmask configuration, as the address cannot be disassociated from the on-li
nk prefix.[2] For IPv6, however, on-link determination is different in detail an
d requires the Neighbor Discovery Protocol (NDP).[3][4] IPv6 address assignment
to an interface carries no requirement of a matching on-link prefix and vice ver
sa, with the exception of link-local addresses.
While subnetting may improve network performance in an organizational network, i
t increases routing complexity, since each locally connected subnet must be repr

esented by a separate entry in the routing tables of each connected router. Howe
ver, by careful design of the network, routes to collections of more distant sub
nets within the branches of a tree-hierarchy can be aggregated by single routes.
Variable-length subnet masking (VLSM) functionality in commercial routers made
the introduction of CIDR seamless across the Internet and in enterprise networks