Subnet Mask and IP address calculation network address and broadcast address conversion

Source: Internet
Author: User
Subnet Mask and IP address calculation network address and broadcast address conversion

IP Address: 202.112.14.20.

Subnet Mask: Too Many Subnet Mask
What is the network address and broadcast address of this host?
Solution:
Step 1: Determine the network bit and host bit.
First, convert the IP address (202.112.14.20.) to binary,
That is: 11001010.0112.16.20171110.10001001
Then, the subnet mask (subnet mask) is also converted to binary, that is:
11111111.111111.1111111111.11100000
Then, its network bit should be in the blue part:
11001010.0112.16.20171110.100
01001

It has a bid. Its host space should be the last five digits, that is, the red part.
At this step, we can clearly see that its network address is:
11001010.0112.16.20171110.0000000

After all the host locations (the last five digits) are cleared, the above network address is obtained.
Convert to decimal: 202.112.14.128
Its broadcast address is to change the host bit's full 0 to full 1, namely:
11001010.0112.16.20.1110.10011111

Convert to decimal: 202.112.14.159
Exercise several times more and remember the conversion rules of decimal and binary.

In 1.172.16.10.33/27,/27 indicates that the subnet mask is too large, that is, 27 All 1

2. according to the subnet mask 255.255.255.252, the network bit is 30 bits. Therefore, only the remaining two bits are used as the master bits, the network address is used for all the host bits, and the broadcast address is used for all the host bits, the remaining host numbers are in the host address range.

3. The public address is composed
Internet Information Center. These IP addresses are assigned to organizations that register and apply to inter Nic. Use it to directly access the internet.
Private
Address) is a non-registered address, used within the Organization. Private IP addresses cannot be directly used to communicate with the WAN, or frames can be used for communication (such as Fr frame relay, HDLc, and PPP) either the NAT Function of the route is required to convert the private IP address into a public IP address.
The following lists the reserved private addresses.
Class
10.0.0.0 -- 10.20.255.255
Class B 172.16.0.0 -- 172.31.255.255
Class C
192.168.0.0 -- 192.168.255.255

Next, let's give you an example based on the questions in ccna:

First, let's take a look at a common question in the exam: the IP address of a host is 202.112.14.133, And the mask is 202.112.14.133. The network address and broadcast address of the host must be calculated.

The general method is to convert the host address and subnet mask into binary numbers. The network address can be obtained after the logic and calculation of the two. As a matter of fact, you only need to think about it and you can get another method: The Mask of zookeeper contains 256-224 = 32 IP addresses (including network addresses and broadcast addresses ), the network address with this mask must be a multiple of 32. The network address is the beginning of the subnet IP address, and the broadcast address is the end. The available host address is within this range. Therefore, it is slightly smaller than 137, and only 128 is the multiple of 32, therefore, the network address is 202.112.14.128. The broadcast address is the network address of the next network minus 1. The next 32 is a multiple of 160. Therefore, the broadcast address is 202.112.14.159.

In the ccna test, you also need to plan the subnet address and calculate the subnet mask based on the number of hosts on each network. This can also be calculated based on the above principles. For example, if a subnet has 10 hosts, the IP address required for this subnet is:

10 + 1 + 1 + 1 = 13

Note: The first 1 in the addition refers to the gateway address required for the network connection, and the second two 1 in the addition refer to the network address and broadcast address respectively. Because 13 is less than 16 (16 is equal to the 4 power of 2), the host space is 4 bits. While

256-16 = 240

Therefore, the subnet mask is 255.255.255.255.255.240.

If a subnet has 14 hosts, many people often make the mistake of allocating a subnet with 16 address spaces instead of allocating addresses to the gateway. This is an error because:

14 + 1 + 1 + 1 = 17

So we can only allocate subnets with 32 addresses (32 is equal to the power of 2. In this case, the subnet mask is too large.

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 scope is 192 · 168 · 100 · 1
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 calculation

The above example is used together to calculate the process as follows:

Example 2: IP address 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 digits
-2

Number of hosts = 212
-2 = 4094

2 is because the host does not include the network address and broadcast 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.