International regulations: divide all IP addresses into A, B, C, D, E
Class A address: the range from 0 to 127,0 indicates that all IP addresses are retained, and 127 indicates that all IP addresses are retained and used to test the round-robin. Therefore
The range of Class A addresses is actually from 1.
For example: 10.0.0.1, the first part of the number is the network number, and the third part of the number is the number of the local computer. To convert to binary, A Class a ip address consists of A 1-byte network address and A 3-byte host address. The highest bit of the network address must be "0 ", the address range is 0.0.0.1 to 126.0.0.0. There are 126 available class A networks, each of which can accommodate more than 0.1 billion hosts (the number of hosts at the power of two is 24 ).
Use a subnet mask: 255.0.0.0.
Class B address: the range is from 128 to 191, for example, 172.161.1. The first and second numbers are network numbers, and the remaining two numbers are the numbers of the local computer. In binary format, a Class B IP address consists of two bytes of network address and two bytes of host address. The maximum bit of network address must be "10 ", the address range is 128.0.0.0 to 191.20.255. There are 16382 available class B networks, each of which can accommodate more than 60 thousand hosts.
Use a subnet mask to differentiate between them: 255.255.0.0
Class C address: the value ranges from 192 to 223, for example, 192.168.1.1. The first, second, and third segments are network numbers, and the last segment is the number of the local computer. In binary format, a class c ip address consists of a 3-byte network address and a 1-byte host address. The maximum network address must be 110 ". The range is from 192.0.0.0 to 223.20.255. A Class C network can contain more than 2.09 million hosts, and each network can accommodate 254 hosts.
Use a subnet mask for difference: 255.255.255.0
Class D address: the value ranges from 224 to 239. the first byte of the Class d ip address starts with "1110". It is a specially reserved address. It does not point to a specific network. Currently, this type of address is used in multi-point broadcast (Multicast. A multicast address is used to address a group of computers at a time. It identifies a group of computers that share the same protocol.
Class E address: the value ranges from 240 to 254. It starts with "11110" and is reserved for future use. The full zero ("0.0.0.0") Address corresponds to the current host. The IP address ("255.255.255.255.255") of "1" is the broadcast address of the current subnet.
In the daily network environment, B and C are basically used, and the three types of ADE addresses cannot be used.
From the above description, we can see that a lot of friends will make an error, that is, set the IP address starting with 192 to a Class B address, although Network Communication in the LAN is not affected, it is actually an irregular division.
192.168.0.1-192.168.0.254 the default subnet mask is 255.255.255.0, where 0 indicates in binary notation, 8 0. therefore, eight locations are not occupied by network numbers. The power of 2 indicates that there are 256 addresses, removing one header (network address) and one tail (host address ), it indicates that there are 254 Computer Host addresses. Therefore, if we want to divide these 254 addresses, We will occupy some of the last eight 0 locations.
If the first 0. S is used, then the subnet mask in hexadecimal notation is 11111111.111111.111111.0000000. If it is converted to hexadecimal notation 2017100000000128, what should the Computer Host be? In fact, it is very simple, it is the 7 power of 2 (no longer the 8 power of 2), the 7 power of 2 = 128, so if the subnet mask is 255.255.255.128, this class C address can be divided into two networks, each with a maximum of 128 hosts. 192.168.0.1-192.168.0.127 is one, and 192.168.0.128-192.168.0.255 is the second.
For another example, for a class C address, the IP address range is 192.168.0.1-192.168.0.254. For example, if the subnet mask is 255.255.192 (that is, the last 8 is the master location, it is occupied by two digits, in hexadecimal notation 11111111.11111111.11111111.11000000), the number of computer hosts in This CIDR block is the power 6 of 2 = 64, with a total of 2 to the power 2 = 4 CIDR blocks. The first CIDR block is 192.168.0.1-192.168.0.63, the second CIDR block is 192.168.0.64-192.168.0.127, the third CIDR block is 192.168.0.127-192.168.0.191, and the fourth CIDR block is 192.168.0.192-192.168.0.254.
From the two examples, we can sum up a rule that the host is occupied by N digits, so there is a 2 N-power network, that is, there will be 2 hosts to the power of 8-n.
Finally, let's briefly describe the subnet division method for Class B addresses.
Assume that there is a Class B IP address segment, and the subnet mask of 172.16.0.0-172.16255.255.255 is 255.255.0.0. Now we need to divide the network segment into subnets.
If you do not divide subnets, there is only one network. The network contains a power of 16 and more than 60 thousand hosts.
Therefore, if subnet division is required, the network address needs to be borrowed from the host address.
In example 1, the first step is to convert 172.16.0.0 255.255.0.0 to binary,
10101100 00010000 00000000 00000000 128 + 32 + 8 + 4 = 172 16
11111111 11111111 00000000 00000000 255.255.0.0
If the network address asks the host address to borrow two digits, The subnet mask is
11111111 11111111 11000000 00000000
201710000192.0
Because I borrowed two bits, I got 2 to the power of 2 and divided into 4 networks. Each network has a host address of 2 to the power of 14.
172.16.0.1-172.16.63.254
172.16.64.1-172.16.127.254
172.16.128.1-172.16.191.254
172.16.192.1-172.16.254.254
A brief description of the subnet mask: The subnet mask is a 32-bit address. It is used to shield a part of the IP address to distinguish the network ID and host ID. It indicates that the IP address is on the LAN, or remotely.
The preceding IP address is used as an example. For example, if a class c ip address is 192.168.0.1, The subnet mask is 255.255.255.0 (convert to binary format, and 255 in binary format indicates 8 1, that is, all accounts are full ). yang's statement indicates that the network number of the class c ip address is 192.168.0 and the host address is 1.
Among so many network IP addresses, some IP addresses are used in our LAN, that is, private IP addresses, which are not used in the Internet. Their scope is:
10.0.0.0 ~ 10.20.255.255
172.16.0.0 ~ 172.31.255.255
192.168.0.0 ~ 192.168.255.255
Next, let's discuss the problem of subnet division.
Suppose you have a class c ip address segment: 192.168.0.1-192.168.0.254, where 192.168.0 belongs to the network number, and 1-254 represents the maximum capacity to accommodate computer hosts. What we need to do now is to divide the 254 hosts again and separate them.
Example 2
If the Class B address 172.16.0.0-172.16.255.255 255.255.255.0.0 needs to be divided into smaller subnets, and the network address borrows 10 digits from the host address in total, from the binary perspective
Decimal 172.16.0.0 255.255.0.0
Binary 10101100 00010000 00000000 00000000 128 + 32 + 8 + 4 = 172 16
11111111 11111111 00000000 00000000
After 10 digits are borrowed
The subnet mask in binary format is 11111111.11111111.11111111.11111111600.
In decimal format, it is decimal limit 192.
So there are a total of 2 10 to the power of the network number, each network has 2 6 to the power of the address,
If you use decimal to represent so many addresses, it should be as follows (because there is a power of 2, too many, and it cannot be written one by one)
First 6, 172.16.0.1-172.16.0.63
172.16.0.64-172.16.0.127
172.16.0.128-172.16.0.191
172.16.0.192-172.16.0.254
172.16.1.1 --- 172.16.1.63
172.16.1.64-172.16.1.127
Last 6,
172.16.254.128-172.16.254.191
172.16.254.192-172.16.254.255
172.16.255.1 --- 172.16.20.63
172.16.000064-172.16.0000127
172.16.0000128-172.16.0000191
172.16.0000192-172.16.0000255
From the two examples, we can see that the division of Class B subnet addresses is actually the same as the division of Class C subnet addresses, except that when the division of Class C is to divide the fourth segment of the address, when dividing class B, you can either divide the third or fourth segment.