Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

A limerick to determine the subnetting

2024-06-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > IT Information >

Share

Shulou(Shulou.com)12/24 Report--

The first three questions are critical strike:

What is the subnet mask?

What is the difference between the network address and the host address in the IP address?

How to subnetting and how many hosts can be subnetted?

If you can give a quick answer, the document will be extremely impressed!

If some friends are the same as the document, there is a trace of hesitation, then you can't miss today's article!

How big the network becomes smaller, it is necessary to divide subnets.

How to draw the subnet in the end, the document will tell you.

If you want a large number of subnets, you can't do without host support.

The size of the subnet depends on the situation, one stroke after another is just right.

Subnetting is about how to divide the network. In IP network, no matter whether the network is divided or not, packet addressing is carried out through the IP address, through the IP address, we can communicate with each other on the network. So, to make it easier for us to understand subnetting, let's briefly review the IP address.

Classification of IP addresses PART.01 our common IP addresses are mainly two versions: IPv4 and IPv6. At this stage, the main body of the network is still IPv4, so the IP address we introduce here is also IPv4.

IP addresses are usually divided into the following two parts:

Network address part: used to identify the network to which the host is connected, indicating the network to which the host belongs in the Internet.

Host address part: used to identify the individual host, indicating which host in the network the host belongs to. At the same time, you can determine the number of hosts that the network can accommodate.

Network ID divides IP addresses into five types: a, B, C, D, and E. Among them, class A, B and C can be assigned to ordinary users, class D is multicast address, and class E is reserved address.

Type maximum number of networks IP address range (excluding all zero and all 1) maximum number of hosts in a single network segment Class A 126 (2 ^ 7-2) 10.0.0.1 "127.255.255.25416777214 (2 ^ 24-2) Class B 16384 (2 ^ 14) 128.0.0.1" 191.255.255.25465534 (2 ^ 16-2) Class C 2097512 (2 ^ 21) 192.0.1 "223.255.255.254254 (2 ^ 8-2) through the understanding of IP addresses We know that a Class A network can hold 2 ^ 24-2 addresses. If only A, B, C networks are used to divide addresses, it is easy to waste IP resources and difficult to manage.

For example, if all the addresses of a Class A network are assigned, so many hosts are in the same broadcast domain, and the network can be filled up by broadcast communication alone, not to mention communicating with each other.

Therefore, for a Class A network, the number of hosts that we can actually allocate is far less than the number of hosts it can accommodate, which results in a waste of IP resources.

Why subnetting PART.02 is needed to solve this problem, subnetting makes a brilliant debut.

Subnetting is like cutting the cake to make the network from large to small, the large network is divided into multiple small networks, each small network contains a small number of hosts, so as to avoid a large number of hosts in the same broadcast domain. Each subnet after division is defined by the router and assigned a new subnet network address, which is subnetting.

Take a chestnut.

For example, the student number 230010 23 represents the grade, and 0010 indicates an individual classmate in Grade 23.

This is like a pre-partitioned IP address. 23 is the equivalent of a large network that can hold 9999 hosts. However, when we divide the student number and borrow the two digits of the individual to represent the major, we can split the large network.

For example, 230110, 23 is still a grade, 01 is a major, and 10 is a student in that major. In this way, we can divide the grade 23 (big network) into 99 majors (small network), each of which can accommodate 99 students (host computer).

By borrowing double digits, we change the structure of student numbers from "grade + individual" to "grade + major + individual", dividing a large number of 23rd students into smaller groups according to different majors.

Similarly, subnetting also changes the structure of IP address from "network address part + host address part" to "network address part + subnet part + host address part" by borrowing.

Benefits of subnetting:

Reduce the negative impact of broadcasting. As the network becomes smaller, the broadcast domain becomes smaller, which can reduce unnecessary broadcasts in the network and improve the transmission performance of the network.

Save IP address resources. There is no direct communication between the network and the network (through routers or gateways). If a Class A network is directly allocated to an enterprise for internal use, even if a lot of IP address resources are left in the network, they can no longer be allocated to other users, which results in a waste of IP address resources.

Improve network security. Addresses between different subnets cannot communicate directly and need to be communicated through a router or gateway. Therefore, the smaller the network, the fewer ways to invade, and the higher the security.

Easy to maintain and manage. When there is a problem with the network, the scope of troubleshooting of the small network is smaller than that of the large network, so it is easier to maintain.

Because the split IP address can not distinguish between the network part and the host part of the address by simply judging that the address is a Class An address or a Class B address.

So if you want to distinguish the network part of the address from the host part, you need to use a subnet mask.

What is the subnet mask, PART.03?

The subnet mask needs to be used in conjunction with the IP address, which is a 32-bit address like the IP address and can mask part of the IP address to distinguish between the network address portion and the host address portion.

The subnet mask consists of "consecutive 1 + consecutive 0":

1 corresponds to the network portion of the IP address.

0 corresponds to the host portion of the IP address.

The mask for the subnet portion is also 1.

We often use the length of 1 in the subnet mask to represent the length of the subnet mask.

For example, for a Class C network 192.168.10.0, the first 24 bits are the network address part and the last 8 bits are the host address part, then the first 24 bits of the subnet mask are 1, the last 8 bits are 0, and after binary conversion to decimal, it is 255.255.255.0.

The length calculation of the subnet mask:

Without subnetting, the length of the subnet mask is equal to the length of the network address portion.

Subnetting, the length of the subnet mask = the length of the network address portion + the length of the subnet portion.

OK, the subnet mask is easy to take down, so let's take a look at how to use the subnet mask to divide subnets.

How to divide the subnet PART.04 subnetting changes the network address of the IP by changing the length of the subnet mask. By borrowing the host address part of the IP address as the subnet part, the original network address part + host address part is changed to the network address part + subnet part + host address part, and a standard IP network is divided into multiple subnetworks.

Take a chestnut.

Suppose there is a Class B network 128.168.0.0Universe 16, and the default subnet mask length is 16 bits.

We borrow 2 bits from the host address to the subnet so that the subnet mask has 18 bits (255.255.192.0) and the relative host bits become 14 bits.

The 128.168.0.0ax 16 network can be divided into four (2 ^ x, x is the length of the subnet) through the subnet portion with a length of 2.

Four subnets can be divided according to the different values of the 2-bit subnet bits (00,01,10,11):

128.168.0.0/18

128.168.64.0/18

128.168.128.0/18

128.168.192.0/18

The number of hosts per subnet is 2 ^ 14-2.

In the above example, a network is equally divided into multiple networks, but in practical applications, the number of hosts required for each network is not the same.

For example, the company has a free network segment 192.172.1.0 Universe 24. There are 123people in department A, 60 people in department B, 30 people in department C and only 10 people in department D. if the network is allocated according to the standard of department A, a lot of IP resources will be wasted in the network assigned to department B, department C and department D.

Therefore, we can further divide the subnets (the maximum number of hosts that can be accommodated in the subnets should be greater than the number of people in the department):

Department A requires host bits: 2 ^ n-2 ≥ 123 ⇒ bits 7 (the length of n host bits), so that the host address can be divided into 1 bit to subnet bits, and the remaining 7 bits can be used as host bits.

As shown in the following figure, 192.172.1.0 IP 24 is subdivided into two subnets, 192.172.1.0 Universe 25 and 192.172.1.128 Universe 25, and the network 192.172.1.0 Universe 25 is divided for Department A use, with an address range of 192.172.1.1' 192.172.1.126 (number of hosts can be accommodated: 126).

Department B needs host bits: 2 ^ n-2 ≥ 60 ⇒ bits 6 (the length of n host bits), so that the host address can be divided into 2 bits to subnet bits, and the remaining 6 bits can be used as host bits.

As shown in the following figure, the subnet of 192.172.1.128Universe 25 is subdivided into two subnets, 192.172.1.128Compact 26 and 192.172.1.192x26, and the network 192.172.1.128Compact 26 is subdivided to Department B for use. The IP address range is 192.172.1.129mm 192.172.1.190 (number of hosts: 62).

Department C requires host bits: 2 ^ n-2 ≥ 30 ⇒ bits 5 (the length of n host bits), so that the host address can be divided into 3 bits to subnet bits, and the remaining 5 bits can be used as host bits.

As shown in the following figure, the subnet 192.172.1.192x26 is subdivided into two subnets, 192.172.1.192x27 and 192.172.1.224x27, and the network 192.172.1.192x27 is divided for use by department C, and the IP address range is 192.172.1.193 192.172.1.222 (can accommodate the number of hosts: 30).

Department D requires host bits: 2 ^ n-2 ≥ 10 ⇒ bits 4 (the length of n host bits), so that the host address can be divided into 4 bits to subnet bits, and the remaining 4 bits can be used as host bits.

As shown in the following figure, the subnet 192.172.1.224Universe 27 is subdivided into two subnets: 192.172.1.224Universe 28 and 192.172.1.240Universe 28, and the network 192.172.1.224Universe 28 is subdivided to Department D for use. The IP address range is 192.172.1.225' 192.172.1.238 (number of hosts: 14).

Try the cow knife TEST

That's all for today's introduction. I don't know if my friends have gained anything. Let's verify it.

Are the two IP addresses 128.168.224.16 IP 18 and 128.168.192.16 Universe 18 under the same subnet?

Given the network address 10.10.1.1 Universe 24, can you write down its subnet mask? assuming that the network is equally divided, how many subnets will the network be divided into? How many hosts can each subnet hold?

This article comes from the official account of Wechat: ZTE documents (ID:ztedoc)

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

IT Information

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report