Computer network (4)-----Subnet Mask

Source: Internet
Author: User

Subnet mask (subnet mask) definition

It is a bitmask that indicates which bits of an IP address identify the subnet on which the host resides and which bits identify the host. The subnet mask cannot exist alone, it must be used in conjunction with an IP address. The subnet mask has only one function, which is to divide an IP address into two parts: network address and host address.

The internet is made up of many small networks that have many hosts on each network, which makes up a hierarchical structure.  IP address is designed to take into account the level of address allocation characteristics, each IP address is divided into two parts of the network number and host number, in order to facilitate IP address addressing operations. What is the network number and host number of the IP address? If you do not specify, you do not know which bits are the network number, which is the host number, which needs to be implemented through the subnet mask. Rules

The subnet mask setting must follow certain rules. As with the binary IP address, the subnet mask consists of 1 and 0, and 1 and 0 are contiguous respectively. The length of the subnet mask is also 32 bits, the left is the network bit, with the binary number "1", the number of 1 is equal to the length of the network bit, the right is the host bit, with the binary number "0" means that the number of 0 equals the length of the host bit. The purpose of this is to allow the mask and IP address to do bitwise AND operation with 0 to cover the number of the original host, without changing the number of the original network segment, and it is easy to determine the number of subnets by 0 digits (2 of the host bit-2, because the host number is 1 when the network broadcast address, all 0 indicates the network number, This is the two special addresses). Only through the subnet mask can you indicate the relationship of the subnet that the host resides with the other subnets, and make the network work properly.

explainOn the network, data is transmitted from one place to another, relying on IP addressing.
Logically, it is a two-step.
The first step, from the IP to find the network belonging to, like to find out what the person is the community;
Second cloth, and then from the IP to find the host in this network location, like in the community to find this person.

The network in the first step is called a "subnet" (Subnet).
Logically, the same subnet (Subnet) is typically used with the same gateway. It's like an entrance to a neighborhood.

The IP address of the IPV4 is 32 bits, in the form ofhttp/xxx.xxx.xxx.xxx , each XXX value is 0-255.
is the first three xxx the same, on behalf of the same subnet, or the top two, or other? This isn't necessarily.
Like the community has a lot of small, some communities have thousands of families, some of the community only a few.
Therefore, a "subnet mask" (Subnet mask) is introduced to identify the size of the subnet.

We generally see the IP address is the decimal encoding, so if a different perspective, from the binary point of view, each IP address is 32 bits 1 or 0.
The subnet mask, which is used to tell the coverage interval of this subnet. Of these 32 bits, the first number of bits is the network segment? Of course, the rest is the host segment.

To cite a typical example:
The first 24 bits in the IP represent the subnet number, and the last 8 bits represent the host number.
So the subnet mask is 24 1 (representing the first 24 bits is the subnet portion), plus 8 0 (the last 8 bits are the host part).
If the identity of the IP is inherited, it is 255.255.255.0.
Each of the 255 corresponds to 8 binary 1, and the last 0 corresponds to 8 binary 0.
The subnet can hold up to 256 hosts, which is the host number from 0 to 255.
Of course, there are not so many, some special numbers have reserved use (broadcast, gateway, etc.). Reference

Https://www.zhihu.com/question/21064101

Http://baike.baidu.com/link?url=MBckq9peGxxC75YDsmDX8fmdvSSY9q6BaO3Lfs4m0G_LFP3aa2H35ZT7J8ZJM0hRC7DDTVJHhtRpnEwfutGMPK

Computer network (4)-----Subnet Mask

Related Article

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.