ipcalc

Calculate network masks, broadcast addresses, and IP ranges

brewmacoslinux
Try with needOr install directly
Source

About

Calculate various network masks, etc. from a given IP address

Commands

ipcalc

Examples

Calculate network information for an IP address with CIDR notation$ ipcalc 192.168.1.0/24
Get network details with netmask format$ ipcalc 10.0.0.5 255.255.255.0
Show additional details including host range and broadcast address$ ipcalc -b 172.16.0.0/12