Calculate related address information using IP addresses and subnet masks

Source: Internet
Author: User

IP address and subnet mask used for computing

After knowing the IP address and subnet mask, you can calculate:
1. Network Address
2. broadcast address
3. Address range
4. Several hosts on this website
Example 1: the IP address in the following example is 192 · 168 · 100 · 5. The subnet mask is 255 · 255 · 255 · 0. Calculate the network address, broadcast address, address range, and number of hosts.
1) step-by-step calculation
1) convert the IP address and subnet mask to binary. The subnet mask is the network address and the host address. Network Address before dotted line, host address after dotted line

2) perform and calculate the IP address and subnet mask. The result is the network address.


3) change the network address part of the above network address to full 1, and the result is the broadcast address.

4) The address range is all hosts included in this section.
The network address + 1 is the first host address, and the broadcast address-1 is the last host address.
The address range is: network address + 1 to broadcast address-1
In this example, the Network range is 192 · 168 · 100 · 1 to 192 · 168 · 100 · 254.
That is to say, the following addresses are all in one CIDR block.
192 · 168 · 100 · 1, 192 · 168 · 2... 192 · 168 · 100 · 20... 192 · 168 · 100 · 111... 192 · 168 · 100 · 254
5) number of hosts
Number of hosts = 2 binary number of hosts-2
2 is because the host does not include the network address and broadcast address. In this example, the number of binary hosts is 8 bits.
Number of hosts = 28-2 = 254
2) overall computing




The above example is used together to calculate the process as follows:
Example 2: the IP address is 128 · 36 · 199 · 3. The subnet mask is 255 · 255 · 240 · 0. Calculate the network address, broadcast address, address range, and number of hosts.
1) convert the IP address and subnet mask to binary. The subnet mask is the network address consecutively. The host address is followed by the network address in front of the dotted line and the host address in front of the dotted line.

2) perform and calculate the IP address and subnet mask. The result is the network address.

3) change the network address in the calculation result to 1, and the result is the broadcast address.

4) The address range is all hosts included in this section.
The network address + 1 is the first host address, and the broadcast address-1 is the last host address.
The address range is: network address + 1 to broadcast address-1
In this example, the Network range is 128 · 36 · 192 · 1 to 128 · 36 · 207 · 254.
5) number of hosts
Number of hosts = 2 binary-2
Number of hosts = 212-2 = 4094
2 is because the host does not include the network address and broadcast address.
From the above two examples, we can see that no matter whether the subnet mask is standard or special, you only need to convert the address into binary when calculating the network address, broadcast address, and address count, then, the subnet mask is used to determine the network address before consecutive 1, and then the host address for calculation.
 

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.