Day 9 情报收集 - Information Gathering (netmask)

今天要介绍netmask,是可以让我们自由转换各种不同表示类型的网路地址以及子网遮罩,在划分子网路的时候也相当实用,另外也提供了十进位IP位址的16/8/2进位转换,在写网路程序的时候相当有帮助,先来看一下他支援的功能。

  -h, --help                    Print a summary of the options
  -v, --version                 Print the version number
  -d, --debug                   Print status/progress information
  -s, --standard                Output address/netmask pairs
  -c, --cidr                    Output CIDR format address lists
  -i, --cisco                   Output Cisco style address lists
  -r, --range                   Output ip address ranges
  -x, --hex                     Output address/netmask pairs in hex
  -o, --octal                   Output address/netmask pairs in octal
  -b, --binary                  Output address/netmask pairs in binary
  -n, --nodns                   Disable DNS lookups for addresses
  -f, --files                   Treat arguments as input files
Definitions:
  a spec can be any of:
    address
    address:address
    address:+address
    address/mask
  an address can be any of:
    N           decimal number
    0N          octal number
    0xN         hex number
    N.N.N.N     dotted quad
    hostname    dns domain name
  a mask is the number of bits set to one from the left

因为用法很简单,所以直接上范例
-s--standard 输出标准的IP与子网遮罩格式

netmask -s 192.168.0.0/24
192.168.0.0/255.255.255.0  

netmask -s 192.168.0.0/22
192.168.0.0/255.255.252.0  

-c--CIDR

netmask -c google.com    
143.142.251.42.238/32
2404:6800:4012:1::200e/128

-r--range,输出在范围内的IP地址
这个例子就表示192.168.0.0/24涵盖了192.168.0.0到192.168.0.255共256组IP

netmask -r 192.168.0.0/24
192.168.0.0-192.168.0.255   (256)

也可以用:来指定范围

  • address:address
netmask -r 192.168.0.0:192.168.0.255
192.168.0.0-192.168.0.255   (256)
  • address:+address
netmask -r 192.168.0.0:+255
192.168.0.0-192.168.0.255   (256)

<<:  [D09] still placeholder

>>:  提升会议效率的开会技巧

Day 2 AWS 是什麽?又为何企业这麽需要 AWS 人才?

今天我们来聊聊学习 AWS 的动机与价值! AWS 是什麽? AWS 是一个云端服务提供商,提供开发...

EP 8: Build a MockData and Register Page Route to Shell

Hello, 各位 iT邦帮忙 的粉丝们大家好~~~ 本篇是 Re: 从零开始用 Xamarin 技...

D-18. SQL & NoSQL、SQL injection、primary key & foreign key

SQL && NoSQL SQL Structured Query Language...

【Day15-文字】文字资料的基本处理——Token、Stem、Stopword

前一天我们谈了一些关於如何处理字串的的基本操作 同时在结尾有稍微提出一点对於文字的看待观点 那我们今...

就决定是你了 - 阵列系列I

图片来源:tooto1985/js-array-operations 内心剧场之胡言乱语 万能又好...