Principles and Methods for dividing subnets

Source: Internet
Author: User

Subnet division definition: Internet organizations define five IP addresses, which are A, B, and C. There are 126 Class A networks, and each class A network may have 16777214 hosts, which are in the same broadcast domain. It is impossible to have so many nodes in the same broadcast domain. The network will be saturated due to broadcast communication. As a result, most of the 16777214 addresses are not allocated. You can further divide a class-based IP address into smaller networks. Each subnet is defined by the router and assigned a new subnet network address, the subnet address is created from the host part of the class-based network address. After the subnet is divided, the subnet mask is used to hide the subnet so that the network does not change from the outside. This is the subnet mask.

Subnet Mask

RFC 950 defines the use of the subnet mask. The subnet mask is a 32-bit binary number, and all the bits corresponding to the network address are set to 1, all bits corresponding to the host address are set to 0. The default subnet mask of a network is 255.0.0.0, the default subnet mask of B network is 255.255.0.0, and the default subnet mask of class C network is 255.255.255.0. Perform the logical "and" Operation on the subnet mask and IP address in bit to obtain the network address of the IP address. The remaining part is the host address, thus distinguishing the network address and host address of the specified IP address. The subnet mask is commonly expressed in dotted decimal notation. We can also use the network prefix to represent the subnet mask, that is, "/<number of network addresses> ". For example, 138.96.0.0/16 indicates that the subnet mask of Class B network 138.96.0.0 is 255.255.0.0.

Edit the current vro to determine the IP address

The subnet mask informs the router which part of the IP address is the network address and which part is the host address, so that the router can correctly determine whether any IP address is in this segment, so as to perform the route correctly. For example, there are two hosts. The IP address of Host 1 is 222.21.160.6, The subnet mask is 255.255.255.192, the IP address of host 2 is 222.21.160.73, And the subnet mask is 255.255.255.255.192. To send data to host 2, you must first determine whether the two hosts are in the same CIDR block. HOST 1 222.21.160.6 that is, the bitwise logic and Operation Result of the operator is 11011110.000101.1000000.00000000 host 2 222.21.160.73 that is, the result of the bitwise logic and operation of the operator is: the results of 11011110.000101.1000000.0000000 are different. That is to say, if the two hosts are not in the same network, the data must be sent to the default gateway first and then to the network of host 2. What happens if the subnet mask of host 2 is set to 255.255.255.128 by mistake? Let's compare the IP address of host 2 with the incorrect Subnet Mask "222.21.160.73: 255.255.255.255.128: 11111111.111111.11111111.20.000". The result is the same as the network address of host 1, HOST 1 and host 2 are considered to be in the same network, and data will not be sent to the default gateway, but will be directly transmitted in this network. Because the two hosts are not actually in the same network, data packets will be cyclically in the subnetwork until timeout and discarding. Data cannot arrive at the target machine correctly, resulting in network transmission errors. In turn, if the subnet mask of the two hosts was originally 255.255.255.128, And the subnet mask of host 2 was set to 255.255.255.192 by mistake, when the host always sends data from host 2, due to the IP address and the incorrect subnet mask phase, by mistake, if two hosts are in different networks, the communication between machines in the same subnet is considered as cross-network transmission, and data packets are sent 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 cannot be set at will. The subnet mask setting is related to the subnet division.

Edit settings

Subnet division is achieved by dividing the original network into several subnets by using several host locations of IP addresses as subnet addresses. When dividing subnets, the number of subnets increases as the number of hosts used by the subnet address increases, and the number of available hosts in each subnet decreases. Take the class C network as an example. The original 8-bit host bit, the power of 2 is 256 host addresses, and the default subnet mask is 255.255.0. One-bit host space is used to generate two subnets. Each subnet has 126 host addresses. Two-Bit host locations are used to generate four subnets. Each subnet has 62 host addresses ...... In each network, the first IP address (that is, the IP address of all hosts) and the last IP address (that is, the IP address of all hosts is 1) cannot be allocated to the host, therefore, the number of available IP addresses in each subnet is reduced by 2. Based on the number of hosts borrowed by the subnet ID, we can calculate the number of subnets, masks, and the number of hosts in each subnet. The list is as follows: ① Number of subnets ② Number of subnet digits ③ Subnet Mask (Binary) ④ Subnet Mask (decimal) ⑤ number of hosts per subnet ① 1 ~ 2 ② 1 ③ 11111111.111111.111111.0000000 ④ 2017100000000128 ⑤ 126 ① 3 ~ 4 ② 2 ③ 11111111.11111111.111111.11000000 ④ 2017100000000192 ⑤ 62 ① 5 ~ 8 ② 3 ③ 11111111.11111111.111111.11100000 ④ 255.255.255.255.255.⑤ 30 ① 9 ~ 16 ② 4 ③ 11111111.111111.111111.11110000 ④ 2017100000000240 ⑤ 14 ① 17 ~ 32 ② 5 ③ 11111111.11111111.111111.11111000 ④ 2017100000000248 ⑤ 6 ① 33 ~ 64 ② 6 ③ 11111111.111111.111111.11111100 ④ 255.255.255.255.252 ⑤ 2 in the class C network shown in the table above, if the subnet occupies 7-bit host space, only one host space is left, whether set to 0 or 1, it means that the host bit is all 0 or all 1. Because the host bit 0 represents the current network, and all 1 is reserved as the broadcast address, the subnet actually does not have the available host address, so the host bit should be kept at least two.

Edit the calculation procedure

1. determine the number of subnets to be divided and the number of hosts in each subnet. 2. Find the number of subnets that correspond to the number of digits N and the number of hosts that correspond to the number of digits M. 3. For the atomic netmask of the IP address, set the first n positions of the host address to 1 or the second M positions to 0 to obtain the subnet mask after the IP address is divided into subnets. For example, for type B networks 135.41.0.0/16, you need to divide them into 20 networks (subnets) that can accommodate 200 hosts ). Because 16 <20 <32, that is, 4 to the power of 2 <20 <5 to the power of 2, the subnet bit can be divided into 32 subnets, it can meet the requirements of dividing it into 20 subnets. The default subnet mask of the B-type network is 255.0.0, And the binary value is 11111111.111111.20..00000000. The subnet now occupies five more host bits. According to the definition of the subnet mask, the subnet mask after the subnet is divided should be 11111111.1111111000.00000000, and should be converted to decimal format 248.0. Now let's take a look at the number of hosts in each subnet. In the subnet, there are still 11 available host spaces, and the power of 2 is equal to 2048. In the case that all the host spaces are 0 and 1 are removed, 2046 Host IDS can be allocated, the subnet can accommodate 200 hosts to meet the requirements. According to the above method, the subnet is divided. Each subnet can accommodate a larger number of hosts than the required number, resulting in a waste of IP Address resources. To make more effective use of resources, we can also divide subnets based on the number of hosts required by the subnet. For the above example, 128 <200 <256, that is, 2 ^ 7 <200 <2 ^ 8, that is, in the 16-bit host bit of the B-class network, keep the eight-bit host bit. the other 16-8 = eight are considered as the subnet bit. You can set the Class B network to 138. 96.0.0 is divided into 256 (2 ^ 8) subnets that can accommodate 256-1-1 = 254 hosts (excluding all 0 full 1. In this case, the subnet mask is 11111111.111111.00000000 and the decimal value is 255.255.0. In the above example, we divided the subnets based on the number of subnets and the number of hosts. Two different results can meet the requirements. In fact, the subnet occupies 5 ~ The subnet obtained when the 8-bit host space can meet the above requirements. In actual work, what principles should be used to determine the number of host spaces?

Notes for editing this section

When dividing subnets, consider not only the current needs, but also the number of subnets and hosts required in the future. You can use more hosts than needed to obtain more subnets, saving IP Address resources. If you need more subnets in the future, you do not need to re-allocate IP addresses, however, the number of hosts in each subnet is limited. Conversely, the subnet mask uses a smaller number of host locations. The number of hosts in each subnet can increase, but the number of available subnets is limited. In general, the number of nodes in a network is too large, and the network will be saturated due to broadcast communication. Therefore, the increase in the number of hosts in the network is limited, that is, when conditions permit, more host locations are used for subnet locations. To sum up, the subnet mask settings are related to the division of subnets. The subnet mask is set differently and the obtained subnet is different. Each subnet can accommodate different numbers of hosts. If the setting is incorrect, data transmission may be incorrect.

Advantages of editing this section

1. Reduced network traffic 2. Improved network performance 3. Simplified Management 4. Easy to expand the geographic scope of How to creat subnets

Edit how to divide subnets in this section

First, you must note that the power of 2: The power of 2 0 to the power of 9 are: 1, 2, 4, 8, 16, 32, 64,128,256, and 512, respectively. it is also worth noting that the subnet division uses the host bit to take the removed part as the subnet bit. therefore, this means that the more subnets are divided, the less hosts each subnet will accommodate. the subnet masks subnet mask is used to identify which part of the IP address is the network address, which part is the host address, which consists of 1 and 0. The length is 32 bits, and all bits represent the network number. not all networks require subnets. Therefore, we introduce the default Subnet Mask (default subnet mask ). the default subnet mask of Class a ip addresses is 255.0.0.0; Class B is 255.255.0.0; Class C is 255.255.255.0 classless Inter-Domain Routing (CIDR) CIDR is called classless Inter-Domain Routing, ISP often uses this method to allocate an address to the customer. ISP provides the customer with a block size, similar to 192.168.10.32/28, this row of numbers tells you what the subnet mask is,/28 indicates how many bits are 1, max/32. but the first point you must know is: whether it is Class A, Class B or other class addresses, the maximum available value is only 30/, that is, retain 2 bits to the host bit CIDR value: 1. mask 255.0.0.0:/8 (default mask for Class A addresses) 2. mask listen 128.0.0:/9 3. mask listen 192.0.0:/10 4. mask 255.224.0.0:/11 5. mask listen 240.0.0:/12 6. mask listen 248.0.0:/13 7. mask 255.252.0.0:/14 8. mask 255.254.0.0:/15 9. mask 255.255.0.0:/16 (default mask for Class B addresses) 10. mask 255.255.128.0:/17 11. mask limit 192.0:/18 12. mask 127224.0:/19 13. mask 255.255.240.0:/20 14. mask 255.255.248.0:/21 15. mask 255.255.252.0:/22 16. mask 255.255.254.0:/23 17. mask 255.255.255.0:/24 (default mask for Class C addresses) 18. mask 255.255.255.128:/25 19. mask 255.255.255.192:/26 20. mask mask 255.255.255.mask:/27 21. mask 255.255.255.240:/28 22. mask 255.255.255.248:/29 23. mask 255.255.252:/30 subnetting class A, B & c Address

Quick cut for editing this section 1. How many subnets will your selected subnet mask generate?

The X power of 2-2 (X represents the mask bit, that is, the part of the binary system that is 1. In the current network,-2 is no longer required and can be used in all, however, you need to add the corresponding configuration commands. For example, you can use all the commands by adding the IP subnet zero command to the Cisco router .)

2. number of hosts per Subnet

The power of Y of 2-2 (Y represents the host bit, that is, the part with the hexadecimal value 0)

3. valid subnet is

Valid subnet mask = 256-10 (block size or base number)

4. The broadcast address of each subnet is

Broadcast address = subnetwork ID-1

5. Valid hosts for each subnet are

Ignore all the addresses in the subnet that are 0 and 1. The remaining addresses are valid host addresses. The last valid host address is the next sub-network number-2 (that is, the broadcast address-1)

Dividing specific instances of subnets based on the preceding shortcuts

Example of a Class C address: network address 192.168.10.0; subnet mask 255.255.192 (/26) 1. number of subnets = 2*2-2 = 2 2. number of hosts = 6 to the power of 2-2 = 62 3. valid subnet? : Block size = 256-192 = 64; therefore, the first subnet is 192.168.10.64, and the second subnet is 192.168.10.128 4. broadcast address: The next subnet-1. the broadcast addresses of the two subnets are 192.168.10.127 and 192.168.10.191 5. valid host range: the host address of the first subnet is 192.168.10.65 to 192.168.10.126; the second is 192.168.10.129 to 192.168.10.190 Class B address Example 1: Network Address: 172.16.0.0; subnet mask 255.255.192.0 (/18) 1. number of subnets = 2*2-2 = 2 2. number of hosts = 14 power of 2-2 = 16382 3. valid subnet? : Block size = 256-192 = 64; therefore, the first subnetwork is 172.16.64.0, and the last one is 172.16.128.0 4. broadcast address: The next subnet-1. therefore, the broadcast addresses of the two subnets are 172.16.127.255 and 172.16.191.255. valid host range: the host address of the first subnet is 172.16.64.1 to 172.16.127.254; the second is 172.16.128.1 to 172.16.191.254 Class B address Example 2: Network Address: 172.16.0.0; subnet mask 255.255.255.255.255.255.255.255.255.255) 1. the number of subnets = 11 to the power of 2-2 = 2046 (because the default mask of Class B addresses is 255.255.0.0, so the network bit is 8 + 3 = 11) 2. number of hosts = 5 to the power of 2-2 = 30 3. valid subnet? : Block size = 256-224 = 32; therefore, the first subnetwork is 172.16.0.32, and the last one is 172.16.2017192 4. broadcast address: The next subnet-1. therefore, the broadcast addresses of the first subnet and the last subnet are 172.16.0.63 and 172.16.20.223 5, respectively. valid host range: the host address of the first subnet is 172.16.0.33 to 172.16.0.62; the last one is 172.16.0000193 to 172.16.0000222 Variable Length subnet masks (vlsm)

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 A: 0 1 2 3 8 16 24 3 1 0 network no. Host No. B: 1 0 network No. Host No. Class C: 1 0 network No. Host No. A address is 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 follows: Class D: Class 1 1 1 0 multi-class address Class E: 1 1 1 1 0 after waiting, use the multi-object address (multicast address) as the multi-object transfer 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.

Functions of a variable-length Subnet Mask

The function of a variable-length Subnet Mask (vlsm) is to save IP address space and reduce the route table size. when vlsm is used, the routing protocol used must support it. These routing protocols include ripv2, OSPF, OSPF, and BGP. you can search for more vlsm knowledge.

Available tools for dividing subnets

It is easy to understand and master the network principle to learn about subnet division. Manual division and computing are complicated in actual work, there can be some automated auxiliary tools such as subnet splitters to facilitate the calculation and listing of the Division results to improve work efficiency.

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.