小工具--IPgen--根据掩码生成有效IP地址

如果你不是很熟悉网络掩码计算,每次要从一个IP和掩码中得到有效的IP地址总是很烦人,要推算好几次。

一个小工具IPgen,可以根据掩码生成有效IP地址。

项目地址:

https://github.com/royhills/ipgen

来自:

http://www.nta-monitor.com/

Man手册

The IP networks can be specified in the following ways:

a) CIDR notation IPnetwork/bits (e.g. 192.168.1.0/24)
b) Network and mask notation IPnetwork:NetMask (e.g. 192.168.1.0:255.255.255.0)
c) Range notation IPstart-IPend (e.g. 192.168.1.3-192.168.1.27)
d) Single IP Host Address (e.g. 192.168.1.1)

The CIDR and Network:mask notations generate IP host addresses excluding the
network and broadcast addresses. So 10.0.0.0/29 would generate six IP addresses
from 10.0.0.1 to 10.0.0.6 inclusive. But see the description of the --network
(-n) and --broadcast (-b) options below.

The generated IP host addresses are written to standard output, with one IP
address per line.

The IP networks may be specified either on the command line, or read from the
file specified with the --file (-f) option.

Options:


--help or -h            Display this usage message and exit.

--file=<f> or -f <f>    Read IP networks from the specified file instead of
                        from the command line. One IP network specification per
                        line. Use "-" for standard input.

--version or -V         Display program version and exit.

--network or -n         Include the IP network address.

--broadcast or -b       Include the IP broadcast address.

常用命令

我已经有一个地址192.168.10.139,需要新的地址段,扩大到8个地址,要在29位掩码范围内。

ftpuser@hwcgback:~/ipgen$ ipgen 192.168.10.139/29 -b -n 
WARNING: host part of 192.168.10.139/29 is non-zero
192.168.10.136
192.168.10.137
192.168.10.138
192.168.10.139
192.168.10.140
192.168.10.141
192.168.10.142
192.168.10.143

还可以用掩码方式

ftpuser@hwcgback:~/ipgen$ ipgen 192.168.10.139:255.255.255.248 -b -n    
WARNING: host part of 192.168.10.139:255.255.255.248 is non-zero
192.168.10.136
192.168.10.137
192.168.10.138
192.168.10.139
192.168.10.140
192.168.10.141
192.168.10.142
192.168.10.143
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 名词延伸 通俗的说,域名就相当于一个家庭的门牌号码,别人通过这个号码可以很容易的找到你。如果把IP地址比作一间房子...
    杨大虾阅读 20,622评论 2 56
  • 国际规定:把所有的IP地址划分为A,B,C,D,E。 A类地址:范围从0~127,0是保留的并且表示所有IP地址,...
    日风和阅读 21,342评论 1 8
  • 1、概念简介 子网掩码子网掩码又叫网络掩码、地址掩码,是一个32位地址,用于屏蔽IP地址的一部分以区别网络号和主机...
    黒猫阅读 7,717评论 0 23
  • IP地址的分类(记住) IP地址分为A类、B类、C类、D类、E类,规定如下: A类:网络位8位,主机位24位,网络...
    Arya鑫阅读 12,979评论 1 18
  • 高迪出生在巴塞罗那的塔拉戈纳这一美丽的乡村,这里是艺术大师的摇篮,毕加索、达利、以及三大男高音之一卡雷拉斯都诞生于...
    七年三日阅读 610评论 0 3