subnet mask and subnet partitioningDirectory:
I. Summary
The concept and function of subnet mask
Third, why do I need to use the subnet mask
Four, how to use the subnet mask to get network/host address
Five, the classification of subnet mask
VI. Subnet Addressing Technology
Vii. How to divide subnets and determine subnet masks
Viii. related methods of judgment
I. Summary
Recently in my forum, we have a lot of discussion on subnet mask and subnet partition, because the front also wrote about the IP address of the tutorial, in order to continuity, wrote this about subnet mask and subnet division of the tutorial, learn this tutorial needs a certain basis (master of course, except), suggested that read the previous IP tutorial, Read the tutorial again. You ready. Here we go..
the concept and function of subnet mask
Subnet mask is a 32-bit binary value applied to TCP/IP network, which can block part of IP address and isolate the part of network and host in IP address, based on subnet mask, the administrator can divide the network into several subnets.
Third, why do I need to use the subnet mask
Although we say the subnet mask can be separated from the IP address of the network part and the host part, but we still have questions, such as why to distinguish between network address and host address. What about the distinction. Well, let's talk about it in detail.
When communicating between two computers that use the TCP/IP protocol, we can get the network number of the target host by using the subnet mask of this machine and the IP address of the receiver host, and each host set up a native IP address and subnet mask when configuring the TCP/IP protocol. So you know the network number where Ben is located.
By comparing the two network numbers, you can know whether the host hosts are on this network. If the network number is the same, indicating that the receiver is on this network, the packet can then be sent directly to the target host via the relevant protocol, and if the network number is different, indicating that the target host is on the remote network, then the packet will be sent to the router on the network, and the router will send the packet to another network until the destination is reached. As you can see in this process, the subnet mask is indispensable.
four, how to use the subnet mask to get network/host address
Since the subnet mask is so important, how does it isolate 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. The binary form of IP address and subnet mask to do ' and ' operations, the answer to decimal will be the network address;
3. "Reverse" the subnet mask in binary form;
4. Will take the ' back ' subnet mask and IP address to do ' and ' operations, will be the answer decimal to get the host address.
Here's an example to show you:
Suppose there is an I-P address: 192.168.0.1
Subnet mask is: 255.255.255.0
Into binary as: I P Address
One000000.
10
101000.00000000. 00000001
Subnet mask
One111111.
11
111111.11111111. 00000000
To do the ' and ' Operation of both:
One000000.
10
101000.00000000. 00000000
Convert it to decimal: 192.168.0.0 This is the IP network address above, the host address and so on.
Tip: Because the above subnet mask is observed as the default subnet mask for Class C addresses (that is, no subnets are divided), you can see that the network address is the first three parts of the IP address, that is, the first three bytes.
Doubts:
What the. You still don't understand. Ask me why I do ' and ' operations instead of anything else. In fact, you should be able to understand the above example carefully.
' 1 ' in doing ' and ' operations, does not affect the result, ' 0 ' in doing ' and ' operations, will get 0, using this feature of ' with ', when the administrator sets the subnet mask, the subnet mask corresponds to the network address of the bit is set to ' 1 ', the other bits are set to ' 0 ', then as ' and ', The network number in the IP address will be retained in the result, and the host number will be set to 0, so that the network number is resolved, the resolution of the host number is the same, only the first net mask to take the ' reverse ', in doing ' and '.
Five, the classification of subnet mask1) Default subnet mask:
That is, the subnet is not divided, the corresponding network number of bits are placed 1, the host number is set 0.
Class A network default subnet mask: 255.0.0.0
Class B Network default subnet mask: 255.255.0.0
Class C Network default subnet mask: 255.255.255.0
2 Custom Subnet Mask:
Divides a network into several subnets, needs each section to use the different network number or the subnet number, actually we may consider is divides the host number into two parts: the subnet number, the subnet host number. The form is as follows:
IP address without subnet partition: Network number + host number
Do subnet partition IP address: Network number + subnet number + Subnet host number
in other words, the IP address in the molecular network, the previous number of host part of the location to the subnet number, the rest is the subnet host number.
Vi. Subnet Addressing technology
Some of the previous points about the subnet mask knowledge, let's look at the subnet division, do not think subnet partition and subnet mask does not matter yo, subnet division is also by subnet mask to achieve.
A subnet is a logical network generated on an IP address that allows a network address to span multiple physical networks, where a network address represents multiple networks (obviously, this can save an IP address). Oh, it sounds strange. A network is so inexplicably divided into a number of subnets. So what's the use of doing that?
Let me give you an example: You are a school of network management, your school has four in different physical location of the Web classroom, each network classroom 25 machines, your task is to these machines configure IP address and subnet mask. You might think it's easier to apply for 4 C-class addresses, one for each classroom, and then configure at one by one. Well, that's theoretically true, but did you ever think it would be wasteful, you wasted a total of (254-25) *4=916 IP address, if all network management like you do, then the Internet IP address will be exhausted in a very short time, obviously, you can not do this, You should make a subnet division.
Subnet division Plainly is the thing: because after dividing the subnet, the IP address's network number is unchanged, so outside the LAN, there is still only one network, that is, the network number represents the network, but within the network is another scene, because we each subnet the subnet number is different, When using the IP address and subnet mask after the molecular network (note that the subnet mask referred to here is no longer the default subnet mask. Instead of customizing the subnet mask, which is calculated by the administrator to do the ' and ' operation, each subnet will get a different subnet address, thus achieving the division of the network (get a different address, Of course you can distinguish the various subnets, interesting bar.
Subnet-addressing technology, subnet partitioning, will help solve the following problems:
1 Huge network address management costs: If you are a Class A network administrator, you will certainly manage a large number of mainframe and headaches;
2 The rapid expansion of the routing table in routers: When routers switch tables with other routers, the load on the Internet is high and the amount of computation required is high;
3 IP address space is limited and will eventually dry up: this is a crucial issue, the rapid development of the Internet, so that the original address method can not adapt, and some IP addresses can not be fully utilized, resulting in waste.
Therefore, it is important and sometimes necessary to partition subnets as needed when configuring a LAN or other network. Now, subnet address technology has been used by most local area networks.
Vii. How to divide subnets and determine subnet masksBefore you divide, be sure to consider the current needs of the network and the future requirements plan.
Dividing subnets are mainly considered in the following ways:
1. Number of physical segments in the network (i.e. number of subnets to divide)
2. Number of hosts per physical segment
To determine the subnet mask:
The first step: determine the number of physical network segments and convert them to binary numbers,and determine the number of digits n。 Such as: You need 6 subnets, 6 binary value is 110,Total 3 bits, namely n=3;
Step two: Write out its default subnet mask according to your IP address type. such as Class C, the default subnet mask is 11111111.11111111.11111111.00000000;
Step three: The subnet mask with the host numberTop N bitThe corresponding position is 1, and the rest is placed at 0. If the n=3 and
C class Address: Then get the subnet mask for 11111111.11111111.11111111.11100000 to decimal to get 255.255.255.224 Class B Address: Then get the subnet mask for 11111111.11111111.11100000.00000000 to decimal to get 255.255.224.0
Class A address: Then get the subnet mask for 11111111.11100000.00000000.00000000 to decimal to get 255.224.0.0
Another: Because the network is divided into 6 subnets, occupies the first 3 of the host number, if the C class address, then the host number can only use 5 bits to represent the host number, so the number of hosts per subnet = (2 of 5) -2=30,6 subnet Total can identify the number of hosts will be less than 254, this point please note.
Doubts:
1. You may have such a question, for example, in the above example, 6 of the binary value of 110, then why the subnet mask with the host number of the first n position of the location of 1, instead of 6 binary 110 to replace the first n bit.
Well, this question is very good, the answer is this: we calculate the subnet mask what is the purpose. is to be able to parse out the network number when doing ' and '. That is to say, the location of the network number should be 1 (including, of course, the location corresponding to the subnet number), then obviously, you write 110 is not correct, if you write this, then it means the first two digits of the host number as a subnet number, Then this will divide up to 2 subnets (do not understand, there is a way to compute the number of subnets below), and we originally want to divide the 6 subnets is obviously inconsistent. This explains how you can understand horses.
2. Careful people may find that dividing 4 subnets, 5 subnets and 6 subnets are the same, and 255.255.255.224, is it wrong? " Three subnet masks should be different. Oh, yes, because the binary value of 4,5,6 is 3, so in the subnet mask these three bits are set to 1, the division is no problem, but you have a small understanding of the problem, divided into 4 subnets, in fact, can be understood as divided into 6 subnets, but you only use the 4 of them. For example, if you want to divide 8 subnets, it is the same as the subnet mask that divides 14 subnets, all of which occupy 4 bits as the subnet number.
Viii. Related Judgment method 1 How to determine whether to do the subnet division.
The problem is simple, if it uses the default subnet mask, then the subnet is not divided, otherwise it must be a subnet partition.
2 How to compute the subnet address.
Or the old way, the IP address and subnet mask binary form to do ' and ', the result is the subnet address.
3 How to compute the host address.
This also needless to say, first the subnet mask binary system to get ' reverse ', and then with the IP address to do ' and '.
4 How to calculate the number of subnets.
This question is often mentioned, or starting from 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 N times 2. (why minus 2, huh, look down)
For example, there is such a subnet mask: The 255.255.255.224 binary is: 11111111.11111111.11111111.11100000 visible n=3,2 3 times to 8, indicating that the subnet address may have
8 of the following:
000
001
010
011
100
101
110 ;
111
But it represents 000 of the network itself; 111 of the broadcast address is reserved, so subtract 2, okay.
5 How to calculate the total number of hosts, the number of hosts in the subnet.
Total Host number = Subnet Quantity x Subnet number of hosts
Another example for you to explain, such as the subnet mask for 255.255.255.224 the above discussion know that it can be divided into 6 subnets, then each subnet a maximum number of hosts. Actually, I've already given it to everyone. Because the network is divided into 6 subnets, occupies the first 3 digits of the host number, and is the C class address, then the host number can only be used to represent the host number 5 digits, so the number of hosts in the subnet = (2 of 5 times side) -2=30.
So through this subnet mask we can figure out that this network can identify 6*30=180 host (visible, after the molecular network, the entire network can identify the number of hosts will be reduced).
6) Compute IP address range
with a custom subnet mask, we can get all the possible IP address ranges for this network.
Concrete steps:
1. Write out the binary subnet address;
2. Subnet address to decimal;
3. Calculates the number of hosts the subnet can hold;
4. Get IP range (starting address: Subnet address +1; Terminate address: Subnet address + host number)
Suppose a subnet mask is: 255.255.255.224, it can be divided into 6 subnets, the subnet within the number of hosts 30, then all possible IP address and calculation flow is as follows:
Subnet--subnet address (binary)--------subnet address---real IP range