In the actual network environment, depending on the size of the network, the number of hosts in the network is different, the IP address is divided into A,b,c 3 for different sizes of the network, and the IP address is a 32-bit dotted decimal notation, only the IP address can not determine which network it belongs to, in the IP address of 32 bits, Using the first n bits to identify the network, the 32-N bit identifies the host in the network, usually with the first 8, 16 or 24 bits to identify the network address, given an IP address, then its network address is the IP address and 1 ... 10...0 (n 1,32-n 0) as a result of the operation. 1...10...0 (n 1,32-n 0) is called the subnet mask (netmask) for this network.
First, IP address division
Class A: netmask:255.0. 0.0 8-bit mask
the first bit of IP must be 0, Network address: 0 000 0001-0 111 1111, or 1-127, and network 127.0.0.0 for loopback, its effective network is 1-126, a total of 126 network addresses, each network address has (2^24-2) host Address---Network address host bit full 0 and broadcast address host bit all 1.
Class B: netmask:255.255.0.0 16-bit mask
the first two bits of IP must be ten, The network address is: 10 00 0000-10 11 1111, or 128-191, a total of 64*2^8 network addresses, each network address has (2^16-2) host address---Network address host bit all 0 and broadcast address host bit 1.
Class C: netmask:255.255.255.0 24-bit mask
the first three bits of IP must be Network Address: 110 0 0000-110 1 1111, i.e. 192-223 , a total of 32*2^16 network address, each network address has (2^8-2) host address---Network address host bit 0 and broadcast address host bit all 1.
For intra-LAN communication, there is a private IP address assigned
Class A: 10.0.0.0/8
Class B: 172.16.0.0/16-172.31.0.0/16
Class C: 192.168.0.0/24-192.168.255.0/24
There are two other categories:
Class D:
the first four bits of IP must be 1110, The network address is: 1110 0000-1110 1111, which does not point to a particular network, is currently used in multicast (multicast).
Class E:
the first four bits of IP must be 1111, The network address is: 1111 0000-1111 1111, reserved for future use.
Second, Sub-network division
in the actual application, a company applied for a public network, such as 201.1.2.0/24, but the company has two groups, a group of the number of hosts is 6, the number of hosts in the other group is 4, and do not want the two groups of hosts to communicate with each other, if you apply for a public network , the cost is too high, so it is necessary to divide this network into multiple subnets. The subnet is divided by the first m bits in the host bit in the network address and the network address bits as the bits that identify the network:
201.1.2.0 (2-bit), 00 and 11 are not considered first:
00:
01:
01 00 0001-01 11 1110:65-126
The network address is: 201.1.2.64/26, broadcast address is: 201.1.2.127
10:
10 00 0001-10 11 1110:129-190
The network address is: 201.1.2.128/26, broadcast address is: 201.1.2.191
11:
Note: Dividing subnets will waste addresses
The merging of subnets is the inverse process of sub-network division.
This article is from the "Code Encyclopedia" blog, be sure to keep this source http://lyjztz.blog.51cto.com/10037109/1677164
IP address partitioning type and subnetting