IP address and network type
(1) IP Address
Different physical network technologies have different addressing methods. hosts in different physical networks have different physical network addresses. The inter-network technology is a high-level software technology that combines different physical network technologies. The inter-network technology uses a globally common address format to allocate an inter-network address for each network and each host across the network to shield the differences between physical network addresses. The IP protocol provides a common IP address format for the entire network, and allocates IP addresses under unified management to ensure that an IP address corresponds to an inter-network host (including a gateway ), in this way, the difference in physical addresses is blocked by the IP layer. The IP address used in the IP layer is called the internetaddress or IP address. It consists of the network number and host number. All hosts in the network use the same network number, and the host number is unique. The IP address is a 32-bit binary number, which is divided into four fields, each of which is 8 bits.
(2) three main network addresses
We know that different types of networks vary greatly from LAN to Wan and must be treated differently. Therefore, according to the network size, the network address is divided into three main types:
Class:
0 1 2 3 8 16 24
3 1 0 network No. Host No.
Class B: 1 0 network No. Host No.
Class C: 1 1 0 network No. Host No.
Class A addresses are used for a large network with a small number of (up to 27) hosts greater than 216. Each Class A network can accommodate a maximum of 224 hosts. Class B addresses are used for a host ranging from 28 ~ There are not many medium-sized networks in the range of 216, and a maximum of 214 Class B networks. Class C addresses are used for a large number of small networks with a maximum of 221 Class C networks.
In addition to the above three primary class addresses A, B, and C, there are two other types of addresses, as shown below:
Class D: 1 1 1 0 multi-object address
Class E: 1 1 1 1 0 reserved for later use
The multi-object address is a multicast address that is weaker than the broadcast address. It is used to support the multi-object transmission technology. Class E address is used for future extension.
(3) network address specified by TCP/IP
In addition to identifying a host, there are several special forms of significance.
* Broadcast address
According to TCP/IP rules, the network address with the host number "1" is used for broadcast. It is called a broadcast address. Broadcast refers to sending packets to all hosts on the Internet at the same time.
* Limited broadcast
The broadcast address mentioned above contains a valid network number and host number, technically called the Direct Broadcast (boradcasting) address. Any point on the inter-network can be directly broadcast to any other network, but direct broadcast has a disadvantage that you need to know the network number of the sink network.
Sometimes it is necessary to broadcast in the network, but do not know the network number. According to TCP/IP rules, 32-bit "1" inter-network IP address is used for this site broadcast. This address is called the limited broadcast address ).
* "0" Address
According to the TCP/IP protocol, all the "0" Network numbers are interpreted as "local" networks.
* Return address
Class A network address 127 is a reserved address for network software testing and communication between local processes. It is called loopback address ). No matter what program, once data is sent using the return address, the protocol software returns immediately without any network transmission.
According to TCP/IP protocol, 1. Groups with network numbers 127 cannot appear on any network. 2. The host and gateway cannot broadcast any path information for this address. The preceding rules show that the addresses with host numbers "0" and "1" have special meanings in the TCP/IP protocol and cannot be used as valid addresses of a host.
Ii. Subnet Mask
(1) The subnet TCP/IP network technology is developed from a large mainstream machine environment. It can grow to the scale that was not expected by the original designers. The rapid expansion of the network scale poses a threat to the IP address mode. It does not guarantee the uniqueness of the host address, but brings two burdens: first, huge network address management overhead; second, the gateway path is expanding rapidly. The second is particularly prominent. The expansion of the path finding table not only reduces the efficiency of the gateway path finding (or even overflows the path finding table, resulting in a path finding fault ), more importantly, it will increase the overhead for refreshing internal and external paths, thus increasing the network burden.
Therefore, it is urgent to seek new technologies to cope with the problems arising from the growth of the network size. After careful analysis, we found that the increase in the size of the network is mainly due to the increase or decrease of network addresses. Therefore, the solution focuses on how to reduce network addresses. As a result, the multiplexing technology of IP addresses came into being.
By reusing technology, several physical networks share the same IP address, which will undoubtedly reduce the number of network addresses.
The subnet addressing technology, also called subnetrouting, is the most widely used IP address multiplexing method and has been standardized, and become part of the IP address mode.
Generally, a 32-bit IP address is divided into two parts: the network number and the host number. We call them the "inter-network part" and "local part" of the IP address respectively ". The subnet addressing technology further divides the local part into "physical network" and "host,
Some physical network hosts
Part of the inter-network. Local part
The "physical network" is used to identify different physical networks under the same IP address. It is a "subnet ".
(2) subnet mask IP protocol standard: each network that uses a subnet selects a 32-Bit mode. If a location in the bit mode is 1, one of the corresponding IP addresses is one of the network addresses (including the inter-network and physical network numbers). If a location in bit mode is 0, the corresponding IP address is one of the host addresses. For example, in bit mode: 11111111 11111111 11111111 00000000, the first three bytes are all 1, which indicates that the top three bytes of the corresponding IP address are the network address; the last byte is all 0, the last byte in the corresponding IP address is the host address. This bit mode is called subnet mask or "subnet mask ".
For ease of use, we often use the "dot-point integer notation" to represent an IP address and subnet mask. For example, the subnet mask of Class B addresses (11111111 11111111 11111111) is:
255.255.25.0 IP provides an interesting flexibility for defining the subnet mask, allowing the "0" and "1" bits in the subnet mask to be discontinuous. However, this subnet mask makes it difficult to allocate host addresses and understand the path finding table. In addition, a very small number of routers support using low-order or unordered bits in subnets, therefore, in actual application, each network usually adopts a continuous subnet mask. It is not recommended to use subnet masks such as 255.255.255.255.255.64and 255.255.255.160.
(3) The subnet mask and the IP address subnet mask can be used together with the IP address to distinguish the network number and host number of a network address.
For example, there is a class C address:
192.9.200.13 the default subnet mask is:
255.255.255.0 the network number and host number can be obtained as follows: Convert the IP address 192.9.200.13 to binary 11000000 00001001 11001000 00001101
Convert subnet mask 255.255.255.0 to binary 11111111 11111111 11111111 00000000
After the two binary logic and (and) operations, the result is that the network part is 11000000 00001001 11001000 00001101 and 11111111 11111111 11111111 00000000 11000000 00001001 11001000 00000000 and the result is 192.9.200.0, that is, the network number is 192.9.200.0.
After the subnet mask is reversed and the IP address logic and (and), the result is that the host part is 11000000 00001001 11001000 00001101 00000000 and 00000000 00000000 11111111 00000000 00000000 00000000 00001101 and the result is 0.0.0.13, that is, the host number is 13.
(4) The subnet mask and the IP address subnet mask can be used together with the IP address to distinguish the network number and host number of a network address.
For example, there is a class C address:
192.9.200.13 the default subnet mask is:
255.255.255.0 the network and host numbers can be obtained as follows:
Convert the IP address 192.9.200.13 to binary 11000000 00001001 11001000
Convert subnet mask 255.255.255.0 to binary 11111111 11111111 11111111 00000000
After the two binary number logics and (and) operations, the result is that the network part is 11000000 00001001 11001000 00001101 11111111 and 11111111 11111111 00000000 11000000 00001001 11001000 00000000 and the result is 192.9.200.0,
That is, the network number is 192.9.200.0.
After the subnet mask is reversed and the IP address logic and (and), the result is that the host part is 11000000 00001001 11001000 00001101 00000000 and 00000000 00000000 11111111 00000000 00000000 00000000 00001101 and the result is 0.0.0.13, that is, the host number is 13.
Iii. subnet division and instance based on the above analysis, we recommend that you define the subnet mask according to the following steps and the instance.
1. The number of subnets to be divided is converted to the M power of 2. If you want to divide 8 subnets, 8 = 23.
2. The power of m to which the number of subnets to be divided is obtained. For example 23, M = 3.
3. Convert the power m defined in the previous step to the M-bit host address in descending order and convert it to decimal. For example, if M is 3, it is 11100000 and converted to decimal 224, which is the final subnet mask. For a class-C network, the subnet mask is 255.255.255.255.255.255.255.255.255.224.0. For a class-B network, the subnet mask is 255.255.255.224.0.0.
Here, there is an equation between the number of subnets and the number of addresses occupied by the Host: 2 M = n. M indicates the number of digits that occupy the host address, and N indicates the number of subnets. Based on these principles, a class C network is divided into four subnets. If the network number we use is 192.9.200, the IP address of the host in the class C network is 192.9.200.1 ~ 192.9.200.254 (because the host addresses of all "0" and "1" have special meanings and are not valid IP addresses), the Network is divided into four parts. follow these steps:
4 = 22, take the power of 22, that is, 2, then the binary is 11, the host address occupies the High Order is 11000000, is converted to decimal 192. In this way, we can determine that the subnet mask is 192.9.200.192, And the IP address ranges of the four subnets are:
Binary decimal
11000000 00001001 11001000 00000001 11000000 00001001 11001000 00111110 192.9.200.1
192.9.200.62
11000000 00001001 11001000 01000001 11000000 00001001 11001000 01111110 192.9.200.65
192.9.200.126
11000000 00001001 11001000 10000001 11000000 00001001 11001000 10111110 192.9.200.129
192.9.200.190
11000000 00001001 11001000 11000001 11000000 00001001 11001000 11111110 192.9.200.193
192.9.200.254
Here, we will list the conversion tables of the number of network subnets and subnet masks in class A, B, and C for your reference.
Class:
Number of subnets occupied by the number of digits subnet mask number of hosts in the subnet
2 1 Listen 128.0.0 8,388,606
4 2 listen 192.0.0 4,194,302
8 3 255.224.0.0 2,097,150
16 4 255.240.0.0 1,048,574
32 5 255.248.0.0 524,286
64 6 255.252.0.0 262,142
128 7 255.254.0.0 131,070
128 8 255.255.0.0 65,534
Class B:
Number of subnets occupied by the number of digits subnet mask number of hosts in the subnet
2 1 100000000128.0 32,766
4 2 faster than 192.0 16,382
8 3 running 255.224.0 8,190
16 4 255.255.255.240.0 4,094
32 5 running 255.248.0 2,046
64 6 255.255.252.0 1,022
128 7 255.255.254.0 510
256 8 255.255.255.0 254
Class C:
Number of subnets occupied by the number of digits subnet mask number of hosts in the subnet
2 1 Gbit/s 2017100000000128 126
4 2 rows without errors 192 62
8 3 running 30
16 4 Tib 201710000240 14
32 5 bytes 255.255.248 6
64 6 bytes 255.255.252 2
Relationship between subnet mask and IP address
The subnet mask is used to determine whether the IP addresses of any two computers belong to the same subnetwork.
The simplest understanding is that after the IP address and subnet mask of the two computers perform the and operation, if the result is the same, the two computers are on the same sub-network and can communicate directly. That's simple.
See the following example:
Computing Demonstration: AA
I P address 192.168.0.1
Subnet Mask 255.255.255.0
And Operation
Convert to binary for calculation:
I P address 1102.16.10101000.00000000.00000001
Subnet Mask 11111111.111111.1111111111.00000000
And Operation
111000000.10101000.00000000.00000000
Convert to decimal: 192.168.0.0. Operation demonstration 2:
I P address 192.168.0.254, subnet mask 255.255.0, and Operation
Convert to binary for calculation:
I P address: 1102.16.10101000.20.2.16.11111110
Subnet Mask: 11111111.111111.11111111.00000000
And Operation: 111000000.10101000.00000000.00000000
Converted to decimal: 192.168.0.0
Computing demonstration 3:
I P address 192.168.0.4, subnet mask 255.255.0, And, convert to binary for calculation:
I P address 1102.16.10101000.00000000.00000100
Subnet Mask 11111111.111111.1111111111.00000000
And Operation
111000000.10101000.00000000.00000000
Converted to decimal: 192.168.0.0
After the and operation on the IP addresses and subnet masks of the three groups of computers, we can see that the operation results are the same. All are 192.168.0.0
Therefore, the computer will regard the three computers as the same sub-network and then communicate with each other. The proxy server used by my current organization is planned as the internal network.
Maybe you have to ask, how many IP addresses are available for such subnet masks? You can calculate this.
According to the above, we can see that the IP address inside the LAN is defined by ourselves (of course, it is the same as other IP addresses), which is determined by the subnet mask through the analysis of 255.255.255.0. It can be concluded that:
The first three IP addresses can only be fixed to 192.168.0, so only the last one is left. Obviously, an IP Address can only have (Power 8-1 of 2), that is, 256-1 = 255. Generally, the last digit is 0 or 255.
So you may ask: what if my subnet mask is not 255.255.255.0? You can also do this. Assume that your subnet mask is 255.255.128.0.
Then the first two IP addresses in your lan must be fixed (What, why? Do you understand the above? · # ¥)
In this way, you can follow the calculation below to see how many machines can be deployed in the same sub-network.
1. Decimal 128 = binary 1000 0000
2. the IP address and subnet mask must be used for and operations.
3. I P address 0001000000001001.1 *******.********
Subnet Mask 11111111.111111.0000000.00000000
And Operation 0001000000001001001.0000000.00000000
Converted to decimal:
16. 73. 128. 0
4. We can see that the available Intranet IP addresses are: 000000000001001.0000000.00000000 to 000000000001001.11111111.11111111.
5. Convert to decimal:
16.73.128.0 to 16.73.20.255
6. 0 and 255 are generally used internally for special purposes. Usually not used.
7. The final result is as follows: all available IP addresses in our unit are:
192.168.128.1-192.168.128.254
192.168.129.1-192.168.129.254
.............
192.168.142.1-192.168.142.254
192.168.143.1-192.168.143.254
.............
192.168.254.1-192.168.254
192.168.255.1-192.168.255.254
8. The total number is (255-128 + 1) * (254-1 + 1) = 128*254 = 32512
Faint !!!! @#! @ We can't afford to buy so many machines after buying all our companies! · ¥! ·#
9. Check whether the result is correct.
(1) set the IP address to 192.168.128.1
Ping 192.168.129.233 and pass the test
Access http: // 192.168.129.233 to display the Home Page
(2) set the IP address to 192.168.255.254
Ping 192.168.129.233 and pass the test
Access http: // 192.168.129.233 to display the Home Page
10. Conclusion
The above proves that our conclusion is correct.
Now you can check the number of machines in your subnet.
2017100000000128
Decomposition: 11111111.111111.1111111111.000000
Therefore, the IP address of your internal network can only be XXXXXXXX. XXXXXXXX. xxxxxxxx.00000000 to XXXXXXXX. XXXXXXXX. xxxxxxxx1161111111.