如何从起始和结束IP地址生成一系列IP地址 [英] how to generate a range of IP addresses from a start and end IP address

查看:466
本文介绍了如何从起始和结束IP地址生成一系列IP地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

IPNetwork ipnetwork = IPNetwork.Parse(item);
Log.Text = "First Ip: " + ipnetwork.FirstUsable;
Log.Text = "Last Ip: " + ipnetwork.LastUsable;
string startIP = "" + ipnetwork.FirstUsable;
string lastIp = "" + ipnetwork.LastUsable;





--------------------- --------------------

如果在启动时ip = 192.168.0.0且最后一次ip = 192.168.0.255

i需要看看:

192.168.0.0

192.168.0.1

192.168.0.2

192.168。 0.3

直到

192.168.0.254



-----------------------------------------
if in start ip = 192.168.0.0 and last ip = 192.168.0.255
i need out put look like:
192.168.0.0
192.168.0.1
192.168.0.2
192.168.0.3
until
192.168.0.254

推荐答案

您可以创建几个循环来完成它甚至可以根据您的需要,在Excel中更快地完成。没有魔法库会为你做这件事。
You can create several loops to do it or you could even do it in Excel faster depending on where you need it. There is no magic library that will do this for you.


我们不做你的作业:它是有原因的。它就是为了让你思考你被告知的事情,并试着理解它。它也在那里,以便您的导师可以识别您身体虚弱的区域,并将更多的注意力集中在补救措施上。



亲自尝试,你可能会发现它不是你想的很难!

(经OriginalGriff许可使用)
We do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action.

Try it yourself, you may find it is not as difficult as you think!
(Used with permission of OriginalGriff)


这篇关于如何从起始和结束IP地址生成一系列IP地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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