Subnetting subnets with subnet masks

Source: Internet
Author: User
Tags ip number

IP addresses are classified into five categories

--------------------------------------------------------------------------------------------------------------- ----------------------------------------------------


the meaning of the subnet mask and subnetting according to the subnet mask

The subnet mask is used to divide subnets.

For example, a Class A network can hold 16777214 hosts. However, in practice, it is impossible to use a class A network only for one subnet, because it is inconvenient to manage, so it needs to be divided into several smaller subnets according to the actual demand.
A Class B network can hold 65534 hosts, often also need to divide the subnet. Even within a small business, in order to function between the departments of the need to configure those computers can access each other, which can not access each other, you need to divide the subnet by the method to achieve.

as long as the number of bits of IP address, network bits, host bits, subnet mask number of bits of these concepts to be clear, it feels very simple.

number of IP address bits = number of network bits + host bits = 32 bits. The number of bits of the subnet mask is the number of network bits.

A-class network has a network of 8 bits, and the subnet mask is 11111111.00000000.00000000.00000000, converted to binary representation as 255.0.0.0.

the network number of Class B networks is 16 bits, and the subnet mask is 11111111.11111111.00000000.00000000, which is converted to decimal notation 255.255.0.0.

the network number of Class C networks is 24 bits, and the subnet mask is 11111111.11111111.11111111.00000000, which is converted to decimal as 255.255.255.0.

Class A network with the eldest son Netmask to 16 bits a Class A network is divided into 256 class B networks of the same size network, and then extended to 24 bits of each B-size subnet is divided into 256 class C network size subnets. That's the truth. A large network, through the network mask extended, so that the network bit more, that is, the number of networks, more subnets.

Of course you can also not be divided into 256 subnets, and divided into 128, 64, 32, 16, 8, 4, 2.

The default subnet mask for a Class B network is 255.255.0.0, if you want to divide it into 2 subnets, the number of network bits is set up 17 bits, that is, the subnet mask becomes 255.255.128.0; want to divide into 16 subnets, because 16 is 2 4, so the network bits plus 4 become 20 bits, which means The subnet mask is extended to 20 bits, which is 255.255.240.0. And so on

The default subnet mask for a Class C network is 24-bit, then the host bit =32-24=8 bit, 2 8 is equal to 256, so the number of IP addresses of a Class C network (including network address and broadcast address) is 256.

but you can still divide a class C subnet into more subnets by means of adding the eldest son netmask. The number of subnets divided must be 2 of the N, the number of IP per subnet must be 2 (8-N) the second party.

The subnet mask is extended 1 bits, divided into 2 subnets, 2 bits longer, 4 subnets are divided, 6 bits are added, 2 are 6, 64 subnets are divided.

The number of subnet masks 1 indicates the number of network bits.

Keep in mind the following formula, it's hard to fall back on the complicated subnetting problem.

number of IP address bits =32
Network bit + host bit =32
The subnet mask is extended by n bits, which is divided into 2 N sub-subnets based on the current subnet. Number of IP addresses per subnet =2^ (32-The number of subnet mask bits before partitioning-N)

How to compute the subnet mask according to the target of subnetting

In simple terms, the subnet mask is the number of bits of the network address.

An IP address has a total of 32 bits, where some of the preceding bits represent the network address, and some later bits represent the host bit.

Number of network bits + host bits =ip address bits =32

know this truth, the method to calculate the subnet mask is: The number of known IP in the subnet, the number of bits to find the host bit, with 32 minus the host bit is equal to the number of network bits, that is, the subnet mask.

give the simplest example. A Class C network, including 256 host locations, 256 is 2 8 times, so the host bit is 8, then the network bit is 32-8=24, that is, the subnet mask is 24 bits, The binary representation is 11111111.11111111.11111111.00000000, converted to decimal is 255.255.255.0

Another example of a Class C network partition subnet, each network host IP number is 32, and 32 is 2 5, so the host bit is 5, then the network bit is 32-5=27, that is, the subnet mask is 27 bits, The binary representation is 11111111.11111111.11111111.11100000, converted to decimal is 255.255.255.224

Another example of a Class B network partition subnet, each network host IP number is 1024, and 1024 is 2 10, so the host bit is 10, then the network bit is 32-10=22, that is, the subnet mask is 22 bits, The binary representation is 11111111.11111111.11111100.00000000, converted to decimal is 255.255.252.0

Subnetting is achieved by changing the number of bits in the subnet mask. For example, a class C IP address, the default subnet mask is 24 bits, the binary representation is 11111111.11111111.11111111.0000000, converted to 10 binary is 255.255.255.0.

If this is the subnet mask, the following 8 bits can be used to do the location of the host machine, 2 of the 8 is equal to 256, a total of 256 IP locations, because there are 2 are not available, so the availability of the hosts location is 254.

but you have to divide such an address into 2 subnets, you need to take one from the main camera as the network address, the network address becomes 25 bits. Accordingly, the host bit is 7 bits, 2 of the 7 is equal to 128, a total of 126 addresses are available.

this is from the positive, is known to divide the number of subnets, the number of hosts per subnet. But in the actual work is often the first to know each subnet host number, let you divide the subnet. It's very simple, actually.

first count the number of hosts closer to 2, then the number of hosts is a few. 32 minus the host bit is the network bit.

An example is described. If give you a class C IP address 192.168.0.0. If you want to divide 2 subnets, one has 100 computers and the other has 50 computers.

100 is greater than 2 6, less than 2 7, so the number of host bits is 7 bits. Then the number of network bits is 32-7 = 25 bits. The 25-bit subnet mask 11111111.11111111.11111111.10000000 converted to 10 binary is
255.255. 255.128, this is the subnet mask of the first subnet, network number 192.168.0.0/25, network address 192.168.0.0, host address 192.168.0.1~192.168.0.126, broadcast address 192.168.0.127

50 is greater than 2 5, less than 2 6, so the number of host bits is 6 bits. Then the number of network bits is 32-6 = 26 bits. The 26-bit subnet mask 11111111.11111111.11111111.11000000 converted to 10 binary is
255.255. 255.192, this is the subnet mask of the second subnet, the network number is 192.168.0.128/26, network address 192.168.0.128, host address 192.168.0.129~192.168.0.190, broadcast address 192.168.0.191

Subnetting subnets with subnet masks

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.