Computer network IP and Subnet masks

Source: Internet
Author: User
Tags valid


Subnet netmask{range; default-lease-time 600; Max-lease-time 7200; Said ()

Assigning networks from to
A maximum lease time of two hours
Specifies a default lease time of 10 minutes
Network Address
The meaning of the message representation: Subnet (Its subnet mask is, that is, the network number is 26 bits high, the host number is lower 6 bits), the network address of the subnet is:, its host range is 91. The IP address of the is now available within the range of the optional host number, the application default lease time is 600s, the maximum lease time is not more than 7,200 seconds as to whether the application and distribution is successful in this Don't care.

As we all know, IP is made up of four numbers, here, let's first look at the Class 3 commonly used IP

Class A IP segment to (0 and 127 segments not used)

Class B IP segment to

Class C IP segment to

The default subnet mask assigned by XP is only 255 or 0 per segment

Class A default subnet mask a subnet can hold up to more than 16.77 million computers

Default subnet mask for class B a subnet can hold up to 60,000 computers

Default subnet mask for class C a subnet can hold up to 254 computers

We must have a subnet mask because:

1) When configuring IP, all computers must fill in the subnet mask

2) We have to set some logical boundaries in our network

3) We must enter at least the default subnet mask of the IP class used

I used to think that in order to put some computers in the same network segment, as long as the first three paragraphs of the IP can be, today, I know I was wrong. If I say so, a subnet can only hold 254 computers. It's a bit of a joke. Let's take a look at it in detail.

To be in the same network segment, as long as the network identity is the same, then how to look at the network identity it. The first thing to do is to convert each segment of the IP to binary. (Some say I won't convert yes, it doesn't matter, we use Windows to bring a calculator on the line.) Open Calculator, point to view > programmer, enter decimal number, then click "Binary" This single point, you can switch to binary. )

Switch the netmask to binary, and we'll find that all the subnet masks are made up of a string of contiguous 1 and a string of contiguous 0 (altogether 4 segments, 8 bits per segment, total 32 digits). 11111111.00000000.00000000.00000000 11111111.11111111.00000000.00000000 11111111.11111111.11111111.00000000

This is the binary form of the A/B/C three default subnet masks, in fact, there are a lot of seed netmask, as long as it is a series of 1 (not less than 8) and a series of 0 consecutive (8 bits per paragraph). such as 11111111.11111111.11111000.00000000, this is also a legitimate subnet mask. The subnet mask determines the number of computers in a subnet, and the computer formula is 2 M-times, where we can see how many of the 0 are behind. such as converted to binary, that is 11111111.11111111.11111111.00000000, the back of 8 0, that M is 8, this subnet mask can accommodate 2 8 times (set) of the power Brain, that is, 256 units, but there are two IP is not available, that is the last paragraph can not be 0 and 255, minus the two, is 254 units.

Partitioning method

The division of subnets is actually the process of designing a subnet mask. The subnet mask is primarily used to differentiate between the network ID and the host ID in an IP address, which is used to mask part of an IP address and isolate the network ID and host ID from the IP address. The subnet mask is a number that consists of 4 decimal numbers "in the middle". "Separate, such as If it is written in the form of binary: 11111111.11111111.11111111.00000000, where the "1" bit to isolate the network ID, the "0" bit to separate the host ID, that is, by the IP address and the subnet mask "and" logical operation, derived Network number.

For example, assuming that the IP address is and the subnet mask is, the network ID is, and the host ID is The difference in computer network ID means that they are not in the same physical subnet and need to be forwarded by the router for data exchange.

Each type of address has a default subnet mask: For Class A is, for class B is, for class C is In addition to using the above representation, there is the use of the subnet mask "1" in the number of bits to represent, by default, class A address is 8 bits, class B address is 16 bits, class C address is 24 bits. For example, an address of Class A is, where the last "8" indicates that the subnet mask for the address is 8 bits, while indicates that the network has 28 bits of subnet mask bits.

If you want to establish a subnet in a network, add some bits to the default subnet mask, which reduces the number of bits used for the host address. The number of bits added to the mask determines which subnets can be configured. Thus, in a network that divides subnets, each address contains a network address, a subnet number, and a host address

Example This subnet mask can hold up to how many computers.

Calculation method

Convert it to a binary four-digit number (each paragraph if 8 bits, if 0, can be written as 8 0, that is, 00000000)


Then, the number behind a few 0, altogether there are 11, that is 2 11 square, equals 2048 (note: The host number of all 0 is the reserved address, all 1 is the broadcast address, so they do not count the number of available address. The network number is the same. The subnet number is available in full 0 and full 1, so this subnet mask can hold up to 2048-2 = 2046 computers.

The maximum number of computers a subnet can hold you're going to forget it, let's get a problem with the inverse algorithm.

A company has 530 computers, which make up a peer local area network, and the subnet mask sets the most appropriate.

First of all, undoubtedly, 530 computers with class B IP most suitable (class A Needless to say, too much, C class is not enough, certainly is B class), but the class B default Subnet mask is, can accommodate 60,000 computers, obviously not quite suitable, that subnet mask set how much appropriate it. Let's set out a formula first.


2 m-Time Square >=560

First of all, we determine that 2 of M-time must be greater than 2 of the 8-square, because we know that 2 8 is 256, that is, the number of class C IP maximum capacity, we from 9 times a trial, 2 9 is 512, less than 560, 2 of 10 The second side is 1024, it seems that 2 of 10 times the most suitable. The subnet mask altogether consists of 32 bits, has determined that the back 10 bits is 0, the front 22 bits is 1, the most appropriate subnet mask is: 11111111.11111111.11111100.00000000, converted to 10, that is 。

Assigning and calculating subnet masks you will, now, let's take a look at the network segment of the IP address.

Believe that a lot of people are like me, think IP as long as the first three paragraphs of the same, is in the same network segment, in fact, not so, I also put the IP of each segment into a binary number, here take ip:, subnet mask: do experiment bar.


(Here is the same as the subnet mask, 8 bits per paragraph, less than 8 bits, the front plus 0 is padded.) )

IP 11000000.10101000.00000000.00000001

Subnet Mask 11111111.11111111.11111111.00000000

Same network segment

Here, let's talk about exactly how to calculate the same network segment.

To be in the same network segment, must do the same network identity, the network identity how to calculate it. All types of IP network identification algorithms are not the same. Class A, only the first paragraph. Class B, only the first to second paragraph is counted. Class C, calculate tertiary segment.

The algorithm simply puts the IP and subnet mask on each digit and is available.

and methods: 0 and 1=0 0 and 0=0 1 and 1=1

such as: and,, convert first to binary, then and every bit

IP 11000000.10101000.00000000.00000001

Subnet Mask 11111111.11111111.11111111.00000000

Draw and result 11000000.10101000.00000000.00000000

Convert to Decimal, which is the network identifier,

The subnet mask is then reversed, which is 00000000.00000000.00000000.11111111, with the IP and

The result is 00000000.00000000.00000000.00000001, converted to 10 binary, i.e.,

This is the host identity. To be in the same network segment, you must do the same as the network identity.

Let's take a look at this. Class B IP with default subnet mask

such as ip:,, subnet mask is set to, in the same network segment.

Convert these to binary first 10111100.10111100.00000000.01101111 10111100.10111100.00000101.11011110 11111111.11111111.11111110.00000000

Separate and, get



Network ID is different (see converted to binary 1 digits, so you can see a different), that is, not the same network segment.

Judging is not in the same network segment, you will, below, we have to point to the actual.

A company has 530 computers, which make up a peer local area network, which is the most appropriate subnet mask and IP setting.

Subnet mask does not say, the previous calculation results come to 11111111.11111111.11111100.00000000, that is,

Class B Address

Choose a class B IP segment, and choose 188.188.x.x here.

Thus, the first two paragraphs of IP are determined, the key is to determine the third paragraph, as long as the network identity is the same. Let's start by determining the network number. (What do we do with the 1 in the netmask and in the IP?) Right up, 0 and * correspond, as follows:) 11111111.11111111.11111100.00000000

188.188.x.x 10111100.10111100.?????? **.********

Network identity 10111100.10111100.?????? 00.00000000

So what? Place to fill out (only with 0 and 1 fill, not necessarily all 0 and 1), we use the full fill 0, * anywhere, so, our IP is

10111100.10111100.000000**.********, a total of 530 computers, IP of the last paragraph 1 ~ 254 can be divided into 254 computers, 530/254=2.086, using the 1 method, an integer 3, so that we determined that I P in the third paragraph to be divided into three different numbers, that is, the 000000** in the * * Fill three times the number, can only fill 1 and 0, and each time the number is not the same, as for what to fill with us, such as 00000001, 00000010, 00000011, converted to decimal, divided Not 1, 2, 3, so, the third paragraph is also determined, so that the IP can be divided into 188.188.1.y, 188.188.2.y, 188.188.3.y, y anywhere, as long as within the 1 ~ 254 range, and this 530 computers each and each IP is not the same, you can.

Some people may say, since the algorithm is so troublesome, simply use Class A IP and Class A default subnet mask, I want to tell you, because the Class A IP and Class A default subnet mask host number is too large, this is undoubtedly a needle in the haystack, if at the same time the LAN access too frequent, too large, will affect efficiency, so, it is best Own IP and subnet mask ^_^

Example: For example, the company assigned to the network segment is, first I want to divide a 8 host network segment out, then this network segment of the first address is what? After that, I have to divide the address of a 16 host, then what is the first address of 16 hosts.

Partitioning instances

Class C Address example: Network address; Subnet mask (/26)

1. Number of subnets =2*2=4

2. Number of hosts = 2 of 6 square -2=62

3. Valid subnets?: Block size=256-192=64; So the first subnet is and the second one is

4. Broadcast address: Next subnet-1. So the broadcast addresses of the 2 subnets are and, respectively.

5. Valid host range is: So the first subnet is, the second is, the third is, the fourth is

Class B Address Example 1: Network address:; Subnet mask (/18)

1. Number of subnets =2*2=4

2. Number of hosts = 2 of 14 square -2=16382

3. Valid subnets?: Block size=256-192=64; So the first subnet is, the last 1 are

Related Article

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: 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.