简体   繁体   English

验证IP地址/网络掩码

[英]Validate IP Address/ Netmask

Given an IP address and Netmask. 给定IP地址和网络掩码。 I want to check if the combination is valid or not. 我想检查组合是否有效。 Example

IP Address: 23.1.1.1 Netmask: 255.0.0.0 IP地址:23.1.1.1网络掩码:255.0.0.0

Here the combination is wrong. 这里的组合是错误的。

What are the rule to validate the combination and also netmask 验证组合和网络掩码的规则是什么

Check sipcalc tool. 检查sipcalc工具。 You can install it on Debian-based distros with 您可以使用以下命令将其安装在基于Debian的发行版上

$ apt-get install sipcalc

For the proposed IP/netmask pair, you get this: 对于建议的IP /网络掩码对,您将获得:

$ sipcalc 23.1.1.1 255.0.0.0
-[ipv4 : 23.1.1.1 255.0.0.0] - 0

[CIDR]
Host address        - 23.1.1.1
Host address (decimal)  - 385941761
Host address (hex)  - 17010101
Network address     - 23.0.0.0
Network mask        - 255.0.0.0
Network mask (bits) - 8
Network mask (hex)  - FF000000
Broadcast address   - 23.255.255.255
Cisco wildcard      - 0.255.255.255
Addresses in network    - 16777216
Network range       - 23.0.0.0 - 23.255.255.255
Usable range        - 23.0.0.1 - 23.255.255.254

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM