Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Subnet
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Internet Protocol version 4== {{see also|IPv4 subnetting reference}} ===Determining the network prefix=== An IPv4 subnet mask consists of 32 bits; it is a sequence of ones (''1'') followed by a block of zeros (''0''). The ones indicate bits in the address used for the network prefix and the trailing block of zeros designates that part as being the host identifier. The following example shows the separation of the network prefix and the host identifier from an address ({{IPaddr|192.0.2.130}}) and its associated {{IPaddr||24}} subnet mask ({{IPaddr|255.255.255.0}}). The operation is visualized in a table using binary address formats. {| class="wikitable" style="margin:left;" ! ! Binary form ! Dot-decimal notation |- | IP address | <code>11000000.00000000.00000010.10000010</code> | 192.0.2.130 |- | Subnet mask | <code>11111111.11111111.11111111.00000000</code> | 255.255.255.0 |- | Network prefix | <code>11000000.00000000.00000010.00000000</code> | 192.0.2.0 |- | Host identifier | <code>00000000.00000000.00000000.10000010</code> | 0.0.0.130 |} The result of the [[bitwise AND]] operation of IP address and the subnet mask is the network prefix {{IPaddr|192.0.2.0}}. The host part, which is {{IPaddr|130}}, is derived by the bitwise AND operation of the address and the [[ones' complement]] of the subnet mask. ===Subnetting=== Subnetting is the process of designating some high-order bits from the host part as part of the network prefix and adjusting the subnet mask appropriately. This divides a network into smaller subnets. The following diagram modifies the above example by moving 2 bits from the host part to the network prefix to form four smaller subnets each one quarter of the previous size. {| class="wikitable" style="margin:left;" ! ! Binary form ! Dot-decimal notation |- | IP address | <code>11000000.00000000.00000010.10000010</code> | 192.0.2.130 |- | Subnet mask | <code>11111111.11111111.11111111.'''11'''000000</code> | 255.255.255.192 |- | Network prefix | <code>11000000.00000000.00000010.10000000</code> | 192.0.2.128 |- | Host part | <code>00000000.00000000.00000000.00000010</code> | 0.0.0.2 |} ===Special addresses and subnets=== IPv4 uses specially designated address formats to facilitate recognition of special address functionality. The first and the last subnets obtained by subnetting a larger network have traditionally had a special designation and, early on, special usage implications.<ref>{{cite web |url = http://www.cisco.com/en/US/tech/tk648/tk361/technologies_tech_note09186a0080093f18.shtml |title = Document ID 13711 - Subnet Zero and the All-Ones Subnet |publisher = [[Cisco Systems]] |date = 2005-08-10 |access-date = 2010-04-25 |quote = Traditionally, it was strongly recommended that subnet zero and the all-ones subnet not be used for addressing. [...] Today, the use of subnet zero and the all-ones subnet is generally accepted and most vendors support their use. |archive-date = 2014-02-09 |archive-url = https://web.archive.org/web/20140209020855/http://www.cisco.com/en/US/tech/tk648/tk361/technologies_tech_note09186a0080093f18.shtml |url-status = live }}</ref> In addition, IPv4 uses the ''all ones'' host address, i.e. the last address within a network, for broadcast transmission to all hosts on the link. {{anchor|subnet zero}}{{anchor|all-ones subnet}} The first subnet obtained from subnetting a larger network has all bits in the subnet bit group set to zero. It is therefore called ''subnet zero''.<ref>{{cite web |url = http://www.cisco.com/en/US/tech/tk648/tk361/technologies_tech_note09186a0080093f18.shtml |title = Document ID 13711 - Subnet Zero and the All-Ones Subnet |publisher = [[Cisco Systems]] |date = 2005-08-10 |access-date = 2010-04-23 |quote = the first [...] subnet[...], known as subnet zero |archive-date = 2014-02-09 |archive-url = https://web.archive.org/web/20140209020855/http://www.cisco.com/en/US/tech/tk648/tk361/technologies_tech_note09186a0080093f18.shtml |url-status = live }}</ref> The last subnet obtained from subnetting a larger network has all bits in the subnet bit group set to one. It is therefore called the ''all-ones subnet''.<ref>{{cite web |url = http://www.cisco.com/en/US/tech/tk648/tk361/technologies_tech_note09186a0080093f18.shtml |title = Document ID 13711 - Subnet Zero and the All-Ones Subnet |publisher = [[Cisco Systems]] |date = 2005-08-10 |access-date = 2010-04-23 |quote = [...] the last subnet[...], known as [...] the all-ones subnet |archive-date = 2014-02-09 |archive-url = https://web.archive.org/web/20140209020855/http://www.cisco.com/en/US/tech/tk648/tk361/technologies_tech_note09186a0080093f18.shtml |url-status = live }}</ref> The IETF originally discouraged the production use of these two subnets. When the prefix length is not available, the larger network and the first subnet have the same address, which may lead to confusion. Similar confusion is possible with the broadcast address at the end of the last subnet. Therefore, reserving the subnet values consisting of all zeros and all ones on the public Internet was recommended,<ref name="rfc950p6">{{Cite IETF | rfc = 950 | publisher = [[IETF]] | author = Jeffrey Mogul | author2 = Jon Postel | authorlink2= Jon Postel | title = Internet Standard Subnetting Procedure | page = 6 | date = August 1985 | quote = It is useful to preserve and extend the interpretation of these special addresses in subnetted networks. This means the values of all zeros and all ones in the subnet field should not be assigned to actual (physical) subnets. }}</ref> reducing the number of available subnets by two for each subnetting. This inefficiency was removed, and the practice was declared obsolete in 1995 and is only relevant when dealing with legacy equipment.<ref name="rfc1878">{{Cite IETF | rfc = 1878 | publisher = [[IETF]] | title = Variable Length Subnet Table For IPv4 | author = Troy Pummill | author2 = Bill Manning | date = December 1995 | quote = This practice is obsolete! Modern software will be able to utilize all definable networks. }} (Informational RFC, demoted to category ''Historic'')</ref> Although the all-zeros and the all-ones host values are reserved for the network address of the subnet and its [[broadcast address]], respectively, in systems using CIDR all subnets are available in a subdivided network. For example, a {{IPaddr||24}} network can be divided into sixteen usable {{IPaddr||28}} networks. Each broadcast address, i.e. {{IPaddr|*.15}}, {{IPaddr|*.31}}, β¦, {{IPaddr|*.255}}, reduces only the host count in each subnets. ===Subnet host count=== The number of subnets available and the number of possible hosts in a network may be readily calculated. For instance, the {{IPaddr|192.168.5.0|24}} network may be subdivided into the following four {{IPaddr||26}} subnets. The highlighted two address bits become part of the network number in this process. {| class="wikitable" ! Network ! Network (binary) ! Broadcast address |- | 192.168.5.0/26 | <code>11000000.10101000.00000101.'''00'''000000</code> | 192.168.5.63 |- | 192.168.5.64/26 | <code>11000000.10101000.00000101.'''01'''000000</code> | 192.168.5.127 |- | 192.168.5.128/26 | <code>11000000.10101000.00000101.'''10'''000000</code> | 192.168.5.191 |- | 192.168.5.192/26 | <code>11000000.10101000.00000101.'''11'''000000</code> | 192.168.5.255 |} The remaining bits after the subnet bits are used for addressing hosts within the subnet. In the above example, the subnet mask consists of 26 bits, making it 255.255.255.192, leaving 6 bits for the host identifier. This allows for 62 host combinations (2<sup>6</sup>β2). In general, the number of available hosts on a subnet is 2<sup>''h''</sup>β2, where ''h'' is the number of bits used for the host portion of the address. The number of available subnets is 2<sup>''n''</sup>, where ''n'' is the number of bits used for the network portion of the address. There is an exception to this rule for 31-bit subnet masks,<ref name="rfc3021">{{Cite IETF|rfc=3021|title=Using 31-Bit Prefixes on IPv4 Point-to-Point Links|author1=A. Retana|author2=R. White|author3=V. Fuller|author4=D. McPherson|date=December 2000}}</ref> which means the host identifier is only one bit long for two permissible addresses. In such networks, usually [[Point-to-point (telecommunications)|point-to-point links]], only two hosts (the endpoints) may be connected and a specification of network and broadcast addresses is not necessary. {| class="wikitable sortable" |+ Subnet masks and IP addresses |- ! Mask !! IP addresses !! Hosts !! Netmask |- | {{IPaddr||31}} || 2 || 2 || {{IPaddr|255.255.255.254}} |- | {{IPaddr||30}} || 4 || 2 || {{IPaddr|255.255.255.252}} |- |{{IPaddr||29}} |8 |6 |{{IPaddr|255.255.255.248}} |- |{{IPaddr||28}} |16 |14 |{{IPaddr|255.255.255.240}} |- |{{IPaddr||27}} |32 |30 |{{IPaddr|255.255.255.224}} |- |{{IPaddr||26}} |64 |62 |{{IPaddr|255.255.255.192}} |- |{{IPaddr||25}} |128 |126 |{{IPaddr|255.255.255.128}} |- |{{IPaddr||24}} |256 |254 |{{IPaddr|255.255.255.0}} |- |{{IPaddr||23}} |512 |510 |{{IPaddr|255.255.254.0}} |- |{{IPaddr||22}} |1024 |1022 |{{IPaddr|255.255.252.0}} |- |{{IPaddr||21}} |2048 |2046 |{{IPaddr|255.255.248.0}} |- |{{IPaddr||20}} |4096 |4094 |{{IPaddr|255.255.240.0}} |- |{{IPaddr||19}} |8192 |8190 |{{IPaddr|255.255.224.0}} |- |{{IPaddr||18}} |16384 |16382 |{{IPaddr|255.255.192.0}} |- |{{IPaddr||17}} |32768 |32766 |{{IPaddr|255.255.128.0}} |- |{{IPaddr||16}} |65536 |65534 |{{IPaddr|255.255.0.0}} |}
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)