当前位置:网站首页>Relationship between subnet number, host number and subnet mask
Relationship between subnet number, host number and subnet mask
2022-07-29 06:45:00 【hljqfl】
A few days ago, a netizen asked me some questions , How many subnets can be divided at most , How many hosts can it hold at most , How to calculate the subnet mask and so on . I told him the result without thinking , But he asked me how the result came , Detailed calculation steps , This really embarrassed me . I've been in this business for 11 Years. , Technology and pure theory have long been honed into experience in work , Some things even become instinctive and subconscious , Like a part of your body , Naturally, you can blurt out the results with ease , But how to explain it to him , I thought about it seriously for a long time . So I want to sort these things out , I hope interested friends can use it .
Be careful : This blog post is a personal experience sharing , Not knowledge popularization and skill introduction , If non professionals or friends without the theoretical basis of network technology cannot understand , Please forgive me .
Take the actual example directly , It's easy to understand .
1、 Use the number of subnets to calculate the subnet mask
hold B Class address 172.16.0.0 Divide into 30 Subnetworks , What is its subnet mask ?
① Number of subnetworks 30 Convert to binary representation 11110
② Let's count the binary numbers 5 position
③ Be careful : When there is only one binary number 1 When , The figures counted need to be subtracted 1( for example :10000 Count it as 4 position )
④ take B The subnet mask of the class address 255.255.0.0 Host address section Of front 5 position become 1
⑤ This gives you the subnet mask you want (11111111.11111111.11111000.00000000)255.255.248.0.
2、 Use the number of hosts to calculate the subnet mask
hold B Class address 172.16.0.0 Divided into subnetworks , Each subnet can hold 500 Console host , What is its subnet mask ?
① hold 500 Convert to binary representation 111110100
② Let's count the binary numbers 9 position
③ Mask the subnet 255.255.255.255 From the back forward Of 9 position become 0
④ This gives you the subnet mask you want (11111111.11111111.11111110.00000000)255.255.254.0.
3、 Use the subnet mask to calculate the maximum number of effective subnets
A class IP Address , The subnet mask is 255.224.0.0, What is the maximum number of effective subnets it can partition ?
① Convert subnet mask to binary representation 11111111.11100000.00000000.00000000
② Count its Network bit share 11 position
③A The basic number of class address network bits is 8, The difference between the two figures is 3
④ The maximum number of effective subnets is 2 Of 3 Power , That is, it can be divided into at most 8 Subnetworks .
4、 Use the subnet mask to calculate the maximum number of hosts available
A class IP Address , The subnet mask is 255.252.0.0, Divide it into subnetworks , How many hosts are available in each subnet ?
① Convert subnet mask to binary representation 11111111.11111100.00000000.00000000
② Count its Host bit share 18 position
③ The maximum number of hosts available is 2 Of 18 The power minus 2( Remove all that 0 The Internet address and all are 1 Broadcast address ), That is, each subnet has at most 262142 Hosts available .
5、 Use the subnet mask to determine the start and end address of the subnet
B class IP Address 172.16.0.0, The subnet mask is 255.255.192.0, What is the starting and ending address of the subnet that it can divide ?
① Use subnet mask to calculate , At most, it can be divided into 4 Subnetworks
② Use subnet mask to calculate , Each subnet can hold 16384 Console host ( Including network address and broadcast address )
③ use 16384 Divide 256( The total number of hosts in the network segment including network address and broadcast address ), The result is 64
④ The specific starting and ending methods of network division are as follows :
172.16.0.0~172.16.63.255
172.16.64.0~172.16.127.255
172.16.128.0~172.16.191.255
172.16.192.0~172.16.255.255
6、 The following is the relationship table of personal experience summary ,
A class IP Address segment :1.0.0.0~126.255.255.255 Private address segment :10.0.0.0~10.255.255.255

B class IP Address segment :128.0.0.0~191.255.255.255 Private address segment :172.16.0.0~172.31.255.255

C class IP Address segment :192.0.0.0~223.255.255.255 Private address segment :192.168.0.0~192.168.255.255

Calculate the number of subnets and the number of host addresses that can be used in each subnet through the subnet mask :
If you want to ***.***.***.0/m Divided into ***.***.***.0/n(m<n<32), The number of subnets obtained is 2(n-m), Get rid of all 0 And all 1, The number of available subnets is 2(n-m)-2, The available host addresses in each subnet are 2(32-n)-2.
for example : Put the Internet 117.15.32.0/23 Divided into 117.15.32.0/27, The subnet you get is 16 individual , The number of available subnets is 14 individual , The available host addresses in each subnet are 30 individual .
边栏推荐
- Hongke share | let you have a comprehensive understanding of "can bus error" (III) -- can node status and error counter
- finally 和 return 的执行顺序
- SDN拓扑发现原理
- day12_多线程
- Hog+svm for pedestrian detection
- Callable 的使用
- Use of PDO
- Conversion of fixed-point number to floating-point number of vivado IP core
- 偏向锁、轻量级锁测试工具类级相关命令
- DDoS攻击与CC攻击的区别
猜你喜欢

Thinking about MySQL taking shell through OS shell

华为交换机CE12808导入导出配置文件

day16-集合上

如何画出优秀的架构图

Scanbasepackages scanning range configuration

Floating point addition and subtraction method of vivado IP core floating point

FIR filter design (1) -- using the FDATool toolbox of MATLAB to design FIR filter parameters

MySQL 事物四种隔离级别分析

JMM 内存模型概念

LDAP简述及统一认证说明
随机推荐
8、 Network security
比较单片机3种时钟电路方案
Instant 新日期类的使用 API
How to judge whether a business is attacked by DDoS? What harm will it cause?
Hongke share | bring you a comprehensive understanding of "can bus error" (II) -- can error types
Leetcode question brushing record
如何在开发板上使用sftp命令访问sftp-server
什么是DNS放大攻击
Handwritten digit recognition using neural network
Hongke shares | how to test and verify complex FPGA designs (1) -- entity or block oriented simulation
Common server faults and their solutions
软件定义边界SDP
'function vtable for error: undefined reference to ... ' 问题的原因及解决方法
Explain the difference between FIR filter and IIR filter in detail
CNN-卷积神经网络
JMM 内存模型概念
3、 Wide area communication network
Shell脚本-全局变量、局部变量、环境变量
Hongke share | let you have a comprehensive understanding of "can bus errors" (IV) -- producing and recording can errors in practice
How to use SFTP command to access SFTP server on the development board