IP address and Subnet mask address

Source: Internet
Author: User
Tags bitwise

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

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 this, 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 > scientific type, 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 [red] continuous [/red] 1 and a string of [red] continuous [/red] 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 A/B/C three types of default subnet mask binary form, in fact, there are a lot of seed netmask, as long as a series of 1 consecutive and a string of 0 can be (each segment is 8 bits). such as 11111111.11111111.11111000.00000000, this is also a legitimate subnet mask.Subnet mask determines the number of computers in a subnetThe computer formula is 2 m-Time Square, where we can see how many of the 0 are behind the M. such as converted to binary, that is 11111111.11111111.11111111.00000000, followed by 8 0, that M is 8, this subnet mask can accommodate 2 of the 8 (Taiwan) computer, that is 256 units, but there are two I P is not available, that is, the last paragraph can not be 0 and 255, minus the two, is 254 units. Let's do one more. How many computers can this subnet mask hold?
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, after counting a few 0, altogether there are 11, that is 2 11 square, equals 2048, this subnet mask can accommodate up to 2048 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, the formation of a peer LAN, the subnet mask to set how much 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? Let's set out a formula first.
2 m-Time Square =560
First, we determine that 2 must be greater than 8 square, because we know that 2 of 8 is 256, that is, the number of Class C IP maximum capacity of the computer, we from 9 times a trial 2 9 is 512, less than 560, 2 10 is 1024, it seems 2 of the most suitable. The subnet mask consists of a total of 32 bits, has determined that the next 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

Network Address

Computational formula : The IP address and subnet mask are converted to binary, followed by the operation, and the result is the network address.

Broadcast Address
1, wherein the subnet mask 2 binary in the "1" corresponding to the IP address portion of the network address, "0" corresponding to the part of the host address, the calculation of an IP address network address, host address, broadcast address is based on the subnet mask to determine;   
2, after the molecular network is bound to use a special subnet mask, so the IP address of the network address, host address, The broadcast address cannot be computed according to the default subnet mask (for example, the Class C address default subnet mask is, but the special subnet mask should be computed according to the new subnet mask, such as
Example 1): IP address, subnet mask is, which requires computing its network address, host address, and broadcast address.  Analysis: The mesh mask conversion into 2, 1 corresponds to the portion of the network address, 0 corresponds to the host address, the host address all of you into 1 is the broadcast address. So first convert the into 2, that is, 11111111.11111111.11111111.11100000, and then convert the IP address into 2, which is 11000000.10101000.00000001.11001000, so you can To get the network address is 11000000.10101000.00000001.11000000, that is,; the host address is 00001000, or 8, and the broadcast address is 11000000.10101000.00000001.11011111. That is

First use 2 of the 8 is 256-224 (subnet mask the last one to obtain the IP address accommodated in the subnet) =32 then we now have to find a multiple of less than 200 and 32 to be 192. So the network address to get the broadcast address, the network address of the next network minus 1 is both the 224-1=223 to obtain the broadcast address

Computational Formula : Network Address | (~ Subnet mask) to derive broadcast address

|: bitwise OR ARITHMETIC; ~: Bitwise negation

IP address and Subnet mask address

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.