I. Concepts and functions of two subnet masks 3. Why do I need to use a subnet mask 4. How do I use a subnet mask to obtain a network/Host address 5? What is the classification of a subnet mask 6. subnet addressing technology 7. How to divide subnets and determine about how to determine subnet mask VIII Summary About Subnet Mask and subnet division tutorial, this tutorial requires a certain degree of Foundation (except for the master). We recommend that you read the previous tutorial on IP address before reading this tutorial. Are you ready? Let's get started !! The concept and function of a Two-subnet mask is a 32-bit binary value applied to TCP/IP networks. It can block part of an IP address, in this way, the Network part and the host part of the IP address are separated. Based on the subnet mask, the administrator can further divide the network into several subnets. 3. Why do we need to use the subnet mask? Although we say that the subnet mask can separate the network part from the host part of the IP address, we still have questions. For example, why do we need to distinguish the network address from the host address? What will happen after the distinction? Well, let's talk about it in detail! When two computers using the TCP/IP protocol communicate with each other, we perform the 'and' operation by comparing the subnet mask of the local computer with the IP address of the receiver's host, you can get the network number of the target host. Because each host is configured with a local IP address and subnet mask When configuring the TCP/IP protocol, you can know the network number of the host. By comparing the two network numbers, you can know whether the receiver host is on the current network. If the network number is the same, it indicates that the receiver is on the current network, data packets can be directly sent to the target host through the relevant protocol. If the network number is different, it indicates that the target host is on the remote network, then the data packet will be sent to the vro on the current network. The vro sends the data packet to other networks until it reaches the destination. In this process, you can see that the subnet mask is indispensable! 4. How can I use a subnet mask to obtain the Network/Host address? Since the subnet mask is so important, how can I separate the network address and host address in the IP address? The process is as follows: 1. Convert the IP address and subnet mask into binary; 2. Convert the IP address and subnet mask in binary format to the "and" operation. Then, convert the answer to the decimal format to get the network address; 3. Remove the subnet mask in the binary form from the backend. 4. perform the "and" Operation on the subnet mask and IP address after the backend. Then, convert the answer to a decimal value to obtain the host address. The following is an example: Suppose there is an I P address: 192.168.0.1 subnet mask is 255.255.255.0 and converted to binary: I P address 112.1600.10101000.00000000.00000001 subnet mask merge the two into the "and" Operation: 111000000.10101000.00000000.00000000 to convert it to decimal: 192.168.0.0 this is the network address of the above IP address, host address and so on. Tip: as we observe that the subnet mask above is the default subnet mask of the class C address (I .e., the subnet is not divided), we can see that the network address is the first three parts of the IP address, that is, the first three bytes. Q: What? You still don't understand? Ask me why I want to perform the "and" operation instead of other operations? In fact, you should be able to understand the above example carefully. '1' does not affect the result when performing the 'and' operation. '0' returns 0 when performing the 'and' operation, using this feature of 'and, when the administrator sets the subnet mask, the bits corresponding to the network address on the subnet mask are set to '1', And the other bits are set to '0 ', when it is treated as "and", the network number in the IP address will be retained into the result, and the host number will be set to 0. In this way, the network number will be parsed and the host number will be the same, you only need to first take the subnet mask as the 'back', while doing the 'and '. Five subnet mask Classification 1) default subnet mask: that is, no subnet is divided, the corresponding network number bits are set to 1, and the host number is set to 0. Default subnet mask of A-class network: 255.0.0.0 B-class network default subnet mask: 255.255.0.0 C-class network default subnet mask: 255.255.255.0 2) custom subnet mask: divide a network into several subnets, you need to use different network numbers or subnet numbers for each segment. In fact, we can consider that host numbers are divided into two parts: Subnet numbers and subnet host numbers. The format is as follows: IP addresses not divided by subnets: network number + host number: IP address after subnet division: network number + subnet host number, that is, after the IP address is divided into subnets, A part of the previous host number is assigned to the subnet number, and the rest is the subnet host number. The six subnet addressing technology introduces some knowledge about subnet masks. Let's take a look at subnet division. Do not think that subnet division has nothing to do with subnet mask, subnet division is also implemented by subnet masks. A subnet is a logical network generated on an IP address. It allows a network address to span multiple physical networks, that is, a network address represents multiple networks (obviously this can save IP addresses ). Oh, does it sound strange? How can a network be divided into many subnets inexplicably? So what is the purpose of doing so? Let me give you an example: for example, if you are a network administrator of a school, your school has four network classrooms in different physical locations, each of which has 25 machines, your task is to configure IP addresses and subnet masks for these machines. You may think this is simple. Apply for four class C addresses, one for each classroom, and then configure them one by one. Well, this is true in theory, but have you ever thought it would be a waste? You have wasted a total of (254-25) x 4 = 916 IP addresses, if all network administrators do this, the IP addresses on the Internet will be exhausted in a very short period of time. Obviously, you cannot do this. You should divide subnets. To put it bluntly, the subnet division is like this: because after the subnet is divided, the network number of the IP address remains the same, so there is still only one network outside the LAN, that is, the network represented by the network number, but it is another scene inside the network, because the subnet numbers of each of our subnets are different, use the IP address and subnet mask after dividing the subnet (note that the subnet mask here is not the default subnet mask, but the custom subnet mask, which is calculated by the Administrator) when performing the "and" operation, each subnet will get a different subnet address, thus realizing the division of the network (with a different address, of course, it will be able to differentiate each subnet, interesting ). Subnet addressing technology: Subnet partitioning helps solve the following problems: 1) massive network address management costs: If you are an administrator of A-class network, you will certainly have a headache for managing a large number of hosts; 2) the steep expansion of the routing table in the vro: When the vro and other vrouters exchange routing tables, the Internet load is very high, the calculation required is also high; 3) the IP address space is limited and will eventually be exhausted: this is a crucial issue. The rapid development of the Internet makes the original addressing method unable to adapt, however, some IP addresses cannot be fully utilized, resulting in waste. Therefore, it is important and sometimes necessary to divide subnets as needed when configuring a LAN or other networks. Currently, subnet addressing technology has been used by most local networks. 7. Before dividing subnets and determining subnet masks, you must consider the current network requirements and future demand plans. Subnetworks are divided mainly from the following aspects: 1. number of physical segments in the network (that is, the number of subnets to be divided) 2. to determine the number of hosts in each physical segment, perform the following steps: Step 1: determine the number of physical network segments, convert them to binary, and determine the number of digits n. For example, if you need 6 subnets, the binary value of 6 is 110, and there are 3 digits in total, that is, n = 3. Step 2: Write the default subnet mask according to your IP address type. For example, in class C, the default subnet mask is 11111111.111111.1111.00000000. Step 3: Set the positions corresponding to the first n digits of the host number in the subnet mask to 1 and the remaining positions to 0. If n = 3 and is a class C address, the obtained subnet mask is decimal to obtain the class 224b address. The obtained subnet mask is 11111111.111111.1111.111120170.20.0000 and the decimal to obtain the class 2241_a address: the obtained subnet mask is 11111111.112.160.20.0000.00000000 in decimal format to get 255.224.0.0. Another: because the network is divided into six subnets, it occupies the first three digits of the host number. If it is a class C address, the host number can only be expressed as a host number of five digits. Therefore, the number of hosts in each subnet is equal to (the power of 2) -2 = 30, the total number of hosts identified by the six subnets will be less than 254. Please note this! Confused: 1 you may have such a question. For example, in the above example, the binary value of 6 is 110, so why do we need to set the positions corresponding to the first n digits of the host number in the subnet mask to 1, instead of replacing the first n digits with the binary 110 of 6? The answer is: What is the purpose of the subnet mask calculation? It is hoped that it will be able to parse the network number when doing "and, that is to say, the location corresponding to the network number should be 1 (of course, including the location corresponding to the subnet number). Obviously, it is wrong to write 110, if you write this statement, it means that the first two digits of the host number are used as the subnet number. In this way, a maximum of two subnets can be divided, the following describes how to calculate the number of subnets). It is obviously different from the six subnets we originally divided. In this way, you can understand white horse? 2 careful people may find that the subnet mask is the same for dividing 4 subnets, 5 subnets and 6 subnets, and the same as the subnet mask, is it wrong? Should the three subnet masks be different? Well, this is the case. Because the binary values of and 6 are 3, the three digits in the subnet mask are set to 1, so there is no problem with the Division, it's just a small problem in your understanding. If you divide it into four subnets, you can actually divide it into six subnets, but you only use four of them. For example, if you want to divide 8 subnets, The subnet mask is the same as that obtained by dividing 14 subnets, and all of them occupy 4 digits as the subnet number. 8. Related judgment method 1) how to determine whether a subnet is divided? This problem is very simple. If it uses the default subnet mask, it indicates that no subnet is divided. Otherwise, it must be divided. 2) How do I calculate the subnet address? The old method is to combine the IP address and subnet mask in binary form, and the result is the subnet address. 3) How do I calculate the host address? Let alone this. First, take the binary of the subnet mask as an 'back' and then use the IP address as an 'and '. 4) How do I calculate the number of subnets? We often mention this issue, starting with the subnet mask, there are two main steps: 1. Observe the binary form of the subnet mask and determine the number of digits N as the subnet number; 2. The number of subnets is 2 to the Npower-2. (Why remove 2, huh, let's look down) for example, there is a subnet mask: zookeeper, which has the binary value of 11111111.11111111.11111111.11100000. The visible value is 8 for 3 times of n = 3, 2, it indicates that the subnet address may be in the following eight situations: 000001010011100101110111, but it represents 000 of the network itself; 111 of the broadcast address is retained, so we need to subtract 2. Do you understand? 5) How do I calculate the total number of hosts and the number of hosts in the subnet? The total number of hosts = the number of subnets × the number of hosts in the subnet is explained in another example. For example, if the subnet mask is too large, we know that it can be divided into six subnets at most, how many hosts can there be in each subnet? In fact, I have already calculated for you. Because the network is divided into six subnets, it occupies the first three digits of the host number and is a class C address, the host number can only be expressed as a host number of five digits. Therefore, the number of hosts in the subnet is equal to (Power 5 of 2)-2 = 30. therefore, we can use this subnet mask to calculate that this network can identify a maximum of 6*30 = 180 hosts (as shown in the following figure, after dividing the subnet, the number of hosts that the entire network can identify will be reduced ). 6) Calculate the IP address range by using a custom subnet mask, We can get all possible IP address ranges for this network. Specific steps: 1 Write the binary subnet address; 2 convert the subnet address to the decimal number; 3 calculate the number of hosts that the subnet can accommodate; 4 obtain the IP address range (Starting address: Subnet address + 1; ending address: subnet address + number of hosts) assuming that a subnet mask is too many hosts, we can see that it can be divided into a maximum of six subnets, and the number of hosts in the subnet is 30, then all possible IP addresses and the calculation process is as follows: subnet-subnet address (Binary) ---------- subnet address ----- actual IP Range 1 -- region -- 202.112.10.32 -- 202.112.10.33-region -- region-region no. -- region -- 202.112.10.96 -- 202.112.10.97-region no. -- region -- 202.112.10.128 -- 202.112.10.129-202.112.10.1585 -- region -- 202.112.10.160 -- 202.112.10.161-202.112.10.1906 -- region -- 202.112.10.192 -- 202.112.10.193-202.112.10.222
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.