What is a subnet mask?

Source: Internet
Author: User
IP address Structure

To understand what a subnet mask is, you must understand the composition of IP addresses. The Internet is composed of many small networks, each of which has many hosts, thus forming a hierarchical structure. When designing an IP address, considering the hierarchical features of Address Allocation, each IP address is divided into two parts: the network number and the host number to facilitate IP address addressing.

What are the network numbers and host numbers of IP addresses? If this parameter is not specified, you do not know which bits are the network numbers and which are the host numbers. This requires subnet masks.

What is a subnet mask?

The subnet mask cannot exist independently. It must be used together with the IP address. The subnet mask has only one function, namely dividing an IP address into a network address and a host address.

The subnet mask must be set according to certain rules. Same as the IP address, the subnet mask length is also 32 bits, the network bits on the left are represented by the binary number "1", and the host bits on the right are represented by the binary number "0. As shown in the following figure, the IP address is "192.168.1.1" and the subnet mask is "255.255.255.0. Among them, "1" has 24, representing the corresponding 24-bit IP address on the left is the network number; "0" has 8, the eight-digit host number on the right of the corresponding IP address. In this way, the subnet mask determines the network number and host number in the 32-bit binary number of an IP address. This is very important for networks using the TCP/IP protocol. Only by using the subnet mask can the relationship between the subnet of a host and other subnets be indicated, so that the network can work normally.

Common Subnet Mask

There are hundreds of subnet masks. Here we only introduce the two most commonly used subnet masks, which are 255.255.255.0 and 255.255.0.0 ".

1. The subnet mask is "255.255.255.0" network: the last digit can be 0 ~ Any change within the range of 255, so 256 IP addresses can be provided. However, the actual number of available IP addresses is 256-2, that is, 254, because the host number cannot be "0" or all "1 ".

2. The subnet mask is a network of "255.255.0.0". The two numbers can be 0 ~ Any change within the range of 255 can provide 2552 IP addresses. However, the actual number of available IP addresses is 2552-2, that is, 65023.

The subnet mask of the IP address is not set arbitrarily. If the subnet mask is set too large, that is, the subnet range is expanded, data from the destination machine in the same subnet as the local machine may be sent according to the subnet routing rule, if the destination machine is considered to be in the same subnet due to incorrect judgment, the data packet will be circulated in the subnetwork until it times out and is discarded, so that the data cannot reach the destination machine correctly, network Transmission Error. If the subnet mask is set too small, the communication between machines in the same subnet will be considered as cross-subnet transmission, and data packets will be handed over to the default gateway for processing, this will inevitably increase the burden on the default gateway, resulting in reduced network efficiency. Therefore, the subnet mask should be set based on the network size.

If a network has no more than 254 computers, you can use "255.255.255.0" as the subnet mask. Currently, most local networks will not exceed this number, therefore, "255.255.255.0" is the most commonly used IP address subnet mask. I have seen that the largest primary and secondary school campus network has more than 1500 computers, and such a LAN can use "255.255.0.0 ".

Default Subnet Mask

In Windows 2000 Server, If you specify an IP address for a network adapter, the system automatically fills in a default subnet mask. This is the subnet mask automatically generated by Windows 2000 Server to save user input time. For example, the default subnet mask of "192.168.x.x" is "255.255.255.0 ". Generally, the IP address can use the default subnet mask.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.