Can these special "broadcast addresses" and "network addresses" in the subnet mask be used?

Can the two IP addresses 172.16.2.0 and 172.16.2.255 be used? Torture from the depths of the soul.

First of all, under popular science, IP addresses with all 0s and all 1s are called network addresses and broadcast addresses respectively. When we say this, we always say this when we are not doing classless addressing

Class A network, a simple example, 10.0.0.0 is its network address, 10.255.255.255.255 is its broadcast address, and its subnet mask is 255.0.0.0

Class C network, short answer example, 192.168.1.0 is the network address, 192.168.1.255 is the broadcast address, and its subnet mask is 255.255.255.0

However, after dividing the subnet mask, how do we judge its network address and broadcast address?

Network address: the result of the addition of the IP address and the subnet mask, that is, when the host bits in the subnet mask are all 0.

Broadcast address: Invert the subnet mask, and then OR with the network address to get the broadcast address, that is, when the host bits in the subnet mask are all 1.

look down first;

In the large-scale network architecture of an enterprise, instances of subnet division often occur.

In fact, when it comes to subnet mask division, we always talk about dividing a large network segment into several small segments, and the sum of several small segments is the sum of the large network segments. In other words, we cannot derive from an IP address which large segment the network segment is located in, but we can derive the sum of all IP addresses in this network segment that can communicate at Layer 2.

That is, a cake is cut into eight pieces, and the eight pieces of cake are combined to form a whole cake. But you are only given one piece of cake, and you don't know that this cake is composed of multiple small cakes.

Note: Different subnets cannot communicate

Take a simple example:

We divide the network segment 172.16.0.0 /16 into subnets. We expect the number of hosts in each subnet to be 1000 IP addresses. We know that 2^N-2=number of hosts, where N refers to the subnet mask In the code, the number of bits occupied by 0.

When N=10, we conclude that the number of available hosts is 2^10-2=1022 hosts

Then, we can easily get the subnet mask of this subnet, which is 11111111.11111111.11111100.00000000 which is 255.255.252.0

So when the mask is 22, we can conclude that a total of 2^X subnets can be divided (X refers to the number of host bits occupied by the network bit). In this case, the network bit was originally 16 bits, and now it is increased When it reaches 22 bits, that is, X=6. Then 2^6=64

Then if you don't subnet again

This 172.16.0.0 /16 is divided into 64 subnets in total, and the mask is 22 bits.

172.16.00000000.00000000-----------172.16.11111100.00000000

So, 172.16.0.0/22 ​​is the first subnet and 172.16.252.0/22 ​​is the last subnet.

Taking 172.16.0.0 /22 as an example, we know that there are 1024 hosts in this network segment, which can be listed

172.16.000000 00.00000000 , the one marked in red is the host bit, we know that after the 23rd bit, since it is 2 bits 00, there will be four combinations

00 01 10 11 

When the host bits in the third segment are 00, 01, 10, and 11, the IP addresses in the following segment can communicate directly at the second layer, because they are all in the same subnet.

172.16.0.255 /22

172.16.1.255 /22

172.16.2.255 /22

172.16.3.255 /22

In fact, this very large subnet has only one network address, a broadcast address

The network address is: 172.16.0.0 The broadcast address is 172.16.3.255 

Now back to our topic, if there is an IP address of 172.16.2.255 or 172.16.2.0, can it be used? The answer is yes.

When the IP address is 172.16.2.255/22, 172.16.000000 10.11111111 , we can easily conclude that this address is not a broadcast address, because the previous host bit is not 1!

Remember what the broadcast address is? An IP address is composed of network bits + host bits. An IP address with all 0s in the host bits is a network address, and an IP address with all 1s in the host bits is a broadcast address.

There is also a second example, the IP address of 172.16.2.0 /22 is divided into binary, 172.16.000000 10.00000000, is it also easy to get, only when the red bit is all 0 is this IP What about the network address?

The summary is that 172.16.2.255 and 172.16.2.0 are just two common IP addresses in the subnet of 172.16.0.0/22~ they can also be used normally!

Do you understand?

We are thinking about issues related to the subnet mask. Don't be limited by the class-based IP. We should clearly know the definition of the network address and the definition of the broadcast address. If we are not clear, some people may even ask, the following two network segments Why can communication be possible without routing? Hahaha~

172.16.0.255 /22

172.16.1.255 /22

Great God passing by, if you find an error, you can point it out~

Guess you like

Origin blog.csdn.net/NeverGUM/article/details/104933709