Information Gatheringnetworksubnetmaskcidrip

whatmask

Whatmask is a subnet mask notation conversion tool that helps with network settings by converting between various netmask formats and calculating subnet details. It supports two modes: subnet mask conversion alone or full network information from an IP address and netmask.

Description

Whatmask is a small C program designed to assist with network settings, particularly subnet calculations and mask notation conversions. It supports four netmask notations: CIDR (e.g., /24), Netmask (e.g., 255.255.255.0), Netmask (Hex) (e.g., 0xffffff00), and Wildcard Bits (e.g., 0.0.0.255). In the first mode, providing only a subnet mask outputs equivalents in all four formats plus the number of usable addresses. The second mode takes an IP address followed by a slash and netmask, providing comprehensive subnet information including network address, broadcast, usable IPs, and first/last usable addresses.

Use cases include network configuration, troubleshooting subnet issues, and quick calculations for IP planning on Unix, Windows, Mac systems, and routers. It assumes the broadcast address is the highest in the subnet, which is the most common setup. No options or flags are available; usage relies on direct argument input without spaces in IP/netmask format.

How It Works

Whatmask parses input subnet masks in any of four supported notations (CIDR with or without slash, dotted decimal netmask, hex netmask, wildcard bits) and converts them to all formats while computing usable address counts based on host bits. In IP/netmask mode, it applies the mask to the given IP to derive the network address (IP AND netmask), broadcast (network OR inverted mask), usable IPs (2^hostbits - 2), first usable (network + 1), and last usable (broadcast - 1). Outputs are formatted consistently with labels for clarity.

Installation

bash
sudo apt install whatmask

Examples

Converts /26 subnet mask to CIDR, Netmask, Netmask (hex), Wildcard Bits, and shows 62 usable IP addresses.
whatmask /26
Converts 255.255.192.0 netmask to other formats including /18 CIDR and shows 16,382 usable IP addresses.
whatmask 255.255.192.0
Converts hex netmask 0xffffffe0 to /27 CIDR, decimal, wildcard bits, with 30 usable addresses.
whatmask 0xffffffe0
Shows full network info for 192.168.165.23/19: netmask formats, network 192.168.160.0, and more.
whatmask 192.168.165.23/19
Provides network details for 192.168.0.13/24: network 192.168.0.0, broadcast 192.168.0.255, 254 usable IPs.
whatmask 192.168.0.13/255.255.255.0
Calculates subnet for 192.168.0.113/27: network 192.168.0.96, broadcast 192.168.0.127, 30 usable IPs.
whatmask 192.168.0.113/0xffffffe0
Outputs info for 192.168.0.169/25 wildcard: network 192.168.0.128, first usable 192.168.0.129, 126 usable IPs.
whatmask 192.168.0.169/0.0.0.127
Updated 2026-04-16kali.org ↗