炫意html5
最早CSS3和HTML5移动技术网站之一

Linux中如何使用Sipcalc计算IP子网

安装

在Centos8中安装sipcalc之前,需要先安装epel源。:

[root@localhost ~]# yum -y install epel-release
[root@localhost ~]# yum -y install sipcalc
sipcalc 使用方式

下面使用 sipcalc 列出一个标准 24 位的 C 类网络示例:

[root@localhost ~]# sipcalc 192.168.10.0/24
-[ipv4 : 192.168.10.0/24] - 0
[CIDR]
Host address  - 192.168.10.0
Host address (decimal) - 3232238080
Host address (hex) - C0A80A00
Network address  - 192.168.10.0
Network mask  - 255.255.255.0
Network mask (bits) - 24
Network mask (hex) - FFFFFF00
Broadcast address - 192.168.10.255
Cisco wildcard  - 0.0.0.255
Addresses in network - 256
Network range  - 192.168.10.0 - 192.168.10.255
Usable range  - 192.168.10.1 - 192.168.10.254

可以看到列出了192.168.10.0/24网段中广播地址、反掩码、网络范围和可用的IP地址范围。

下面添加-a查看一下:

[root@localhost ~]# sipcalc -a 192.168.10.0/24
-[ipv4 : 192.168.10.0/24] - 0
[Classful]
Host address  - 192.168.10.0
Host address (decimal) - 3232238080
Host address (hex) - C0A80A00
Network address  - 192.168.10.0
Network class  - C
Network mask  - 255.255.255.0
Network mask (hex) - FFFFFF00
Broadcast address - 192.168.10.255
[CIDR]
Host address  - 192.168.10.0
Host address (decimal) - 3232238080
Host address (hex) - C0A80A00
Network address  - 192.168.10.0
Network mask  - 255.255.255.0
Network mask (bits) - 24
Network mask (hex) - FFFFFF00
Broadcast address - 192.168.10.255
Cisco wildcard  - 0.0.0.255
Addresses in network - 256
Network range  - 192.168.10.0 - 192.168.10.255
Usable range  - 192.168.10.1 - 192.168.10.254
[Classful bitmaps]
Network address  - 11000000.10101000.00001010.00000000
Network mask  - 11111111.11111111.11111111.00000000
[CIDR bitmaps]
Host address  - 11000000.10101000.00001010.00000000
Network address  - 11000000.10101000.00001010.00000000
Network mask  - 11111111.11111111.11111111.00000000
Broadcast address - 11000000.10101000.00001010.11111111
Cisco wildcard  - 00000000.00000000.00000000.11111111
Network range  - 11000000.10101000.00001010.00000000 -
11000000.10101000.00001010.11111111
Usable range  - 11000000.10101000.00001010.00000001 -
11000000.10101000.00001010.11111110
[Networks]
Network   - 192.168.10.0    - 192.168.10.255 (current)

可以看到可以看到192.168.10.0网段的有类路由和无类路由的二进制形式。

下面使用一个27为掩码的网段:

[root@localhost ~]# sipcalc 192.168.10.0/27
-[ipv4 : 192.168.10.0/27] - 0
[CIDR]
Host address  - 192.168.10.0
Host address (decimal) - 3232238080
Host address (hex) - C0A80A00
Network address  - 192.168.10.0
Network mask  - 255.255.255.224
Network mask (bits) - 27
Network mask (hex) - FFFFFFE0
Broadcast address - 192.168.10.31
Cisco wildcard  - 0.0.0.31
Addresses in network - 32
Network range  - 192.168.10.0 - 192.168.10.31
Usable range  - 192.168.10.1 - 192.168.10.30

可以看到可用地址为192.168.10.1-192.168.10.30

添加-a选项,可以看到可用的网段有哪些:

[root@localhost ~]# sipcalc 192.168.10.0/27 -a
-[ipv4 : 192.168.10.0/27] - 0
[Classful]
Host address  - 192.168.10.0
Host address (decimal) - 3232238080
Host address (hex) - C0A80A00
Network address  - 192.168.10.0
Network class  - C
Network mask  - 255.255.255.0
Network mask (hex) - FFFFFF00
Broadcast address - 192.168.10.255
[CIDR]
Host address  - 192.168.10.0
Host address (decimal) - 3232238080
Host address (hex) - C0A80A00
Network address  - 192.168.10.0
Network mask  - 255.255.255.224
Network mask (bits) - 27
Network mask (hex) - FFFFFFE0
Broadcast address - 192.168.10.31
Cisco wildcard  - 0.0.0.31
Addresses in network - 32
Network range  - 192.168.10.0 - 192.168.10.31
Usable range  - 192.168.10.1 - 192.168.10.30
[Classful bitmaps]
Network address  - 11000000.10101000.00001010.00000000
Network mask  - 11111111.11111111.11111111.00000000
[CIDR bitmaps]
Host address  - 11000000.10101000.00001010.00000000
Network address  - 11000000.10101000.00001010.00000000
Network mask  - 11111111.11111111.11111111.11100000
Broadcast address - 11000000.10101000.00001010.00011111
Cisco wildcard  - 00000000.00000000.00000000.00011111
Network range  - 11000000.10101000.00001010.00000000 -
11000000.10101000.00001010.00011111
Usable range  - 11000000.10101000.00001010.00000001 -
11000000.10101000.00001010.00011110
[Networks]
Network   - 192.168.10.0    - 192.168.10.31 (current)
Network   - 192.168.10.32   - 192.168.10.63
Network   - 192.168.10.64   - 192.168.10.95
Network   - 192.168.10.96   - 192.168.10.127
Network   - 192.168.10.128  - 192.168.10.159
Network   - 192.168.10.160  - 192.168.10.191
Network   - 192.168.10.192  - 192.168.10.223
Network   - 192.168.10.224  - 192.168.10.255

总结

Sipcalc 是一个命令行 ip 子网计算器,支持 IPv4 和 IPv6,它会显示你填写 DHCP 信息或设置静态 IP 地址所需的所有 IP 相关信息。

本文原创地址:https://www.linuxprobe.com/linux-sipcalc-subnet.html编辑:逄增宝,审核员:逄增宝

为您推荐一些与本文相关的文章:

  • 用Python批量实现多Excel多Sheet合并的4种方法
  • DevOps平台支撑企业IT运营
  • 搜索挑战百度只是幌子,今日头条的最终目的是电商?
  • 7招帮你释放Ubuntu磁盘空间
  • 捷讯:黄嘉成10月31日上海顺利通过RHCE认证。
  • 数据库包括哪些技术?
  • 《C#与.NET技术平台实战演练》pdf电子书免费下载
  • 移动设备硬件指南,芯片、SoC …
  • 《NET框架设计 模式、配置、工具》pdf电子书免费下载
  • 在生产环境使用Docker部署应用

炫意HTML5 » Linux中如何使用Sipcalc计算IP子网

Java基础教程Android基础教程