netmask
netmask helps determine network masks and convert between common IP netmask and address formats. It is a tiny program handy for firewalls, routers, or shell scripts to specify ranges of hosts with the smallest set of network masks.
Description
netmask is a utility designed to assist users working with firewalls or routers, particularly in scenarios requiring precise network mask calculations. It determines the smallest set of network masks needed to specify a range of hosts, making it useful as a helper in shell scripts.
The tool supports conversion between various IP netmask and address formats, enhancing its utility in network configuration tasks. It accepts specifications like single addresses, address ranges (address:address or address:+address), or address/mask notations, where addresses can be decimal or octal numbers.
With output options for standard, CIDR, Cisco style, ranges, and hex formats, netmask streamlines network-related scripting and configuration.
How It Works
netmask processes input specifications such as addresses, address ranges (address:address or address:+address), or address/mask formats, where addresses are interpreted as decimal (N) or octal (0N) numbers. It generates the smallest set of network masks covering the specified host range and outputs in selected formats like standard address/netmask pairs, CIDR, Cisco style lists, IP ranges, or hexadecimal, using debug mode for status information.
Installation
sudo apt install netmaskFlags
Examples
netmask -hnetmask 192.168.1.1netmask 192.168.1.1:192.168.1.10netmask 192.168.1.1:+5netmask 192.168.1.0/24netmask -s 192.168.1.0/24netmask -c 192.168.1.1:192.168.1.10