计算给定范围的所有ip [英] Calculazting all ip of given range

查看:59
本文介绍了计算给定范围的所有ip的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都可以建议我如何编写一个能够为我提供给定范围的所有IP地址的程序


作为示例,如果我给出的范围是考虑到所有ip落在同一子网中,如何计算此tange内的所有Ip


  Thx


> 10.22.0.0到11.22.0.0关心Kumar Gaurav。如果帖子对您有帮助,请标记为答案,以便它对其他人有用

解决方案

IP地址只是一个长整数(IPAddress) .Address(已废弃)和IPAddress.GetBytes()将返回值),因此您只需设置开头并继续递增直到范围结束。


我怀疑您的网络正在使用"范围" 10.22.0.0 - 11.22.0.0作为一个子网,大约是16.000.000个地址,并且无视
的目的子网划分全部在一起。传统上,10.x.x.x或11.x.x.x是整个网络,并且根据本地实践在该空间内形成子网。子网大小由子网掩码给出,
无法从IP地址本身推断出来。


 


克里斯蒂安。


Can any one suggest me how to code a program that will able to give me all the IP addresses of given range

for Example if i'm given with range from 10.22.0.0 to 11.22.0.0 then how to calculate all Ip inside this tange considering all ip fall in the same subnet

 Thx


Regards Kumar Gaurav. Please Mark as an answer in case the post is helpful to you so that it became helpful to others

解决方案

An IP address is just a long integer (IPAddress.Address (obsoleted) and IPAddress.GetBytes() will return the value), so you just set the beginning and keep incrementing till the end of range.

I doubt that your network is using the "range" 10.22.0.0 - 11.22.0.0 as a subnet, that would be approx 16.000.000 addresses and defies the purpose of subnetting all together. Classically, 10.x.x.x or 11.x.x.x is the whole network and subnets are formed within that space according to local practices. The size of the subnet is given by the subnet mask, it cannot be inferred from the IP address itself.

 

Cristian.


这篇关于计算给定范围的所有ip的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆