Price: $0 (GPL License)
Current Version: 1.2
Date Modified: Nov. 14, 2003
Overview
Whatmask is a small C program that will help you with network settings.
See an online demo here, or here.
See below for documentation on what to enter. These demo sites pipe the form input to Whatmask.
(Sites not endorsed or controlled by LAFFEY Computer Imaging)
Details
Whatmask can work in two modes. The first mode is to invoke Whatmask with only a subnet mask as the argument. In this mode Whatmask will echo back the subnet mask in four formats, plus the number of useable addresses in the range.
Netmask Notations supported:
Name Example --------------------------------- CIDR /24 Netmask 255.255.255.0 Netmask (hex) 0xffffff00 Wilcard Bits 0.0.0.255The above notations are all identical. CIDR notation commonly has a "/" in front of the number (representing the number of bits). Whatmask can accept these notations with or without a slash. This notation is used more and more recently. A lot of popular routers and software support this notation.
Netmask notation is pretty much the standard old-school way of doing it. It is supported by most systems (Un*x, Win, Mac, etc.).
Netmask (Hex) is the hexadecimal representation of the netmask. Many implementations of ifconfig use this notation.
Wilcard bits are similar to the netmask, but they are the logical not of the netmask. This notation is used by a number of popular routers (and nobody knows why... ... actually I found a great explanation from 'billf' who removed the nobody knows why line from the FreeBSD port: Netmasks are contiguous bits, wildcard masks don't need to be).
To use Whatmask in the original mode simply type "whatmask <notation>" The notation can be in any of the four formats and Whatmask will automagically figure out what it is and display all four notations.
To find out more about subnets and netmasks see the References section below.
To use Whatmask in its second mode execute Whatmask with any ip address within the subnet, followed by a slash ('/'), followed by the subnet mask in any format. (e.g. 192.168.0.23/255.255.255.224, or 192.168.0.23/27)
Whatmask will echo back the following:
- The netmask in the following formats: CIDR, Netmask, Netmask (Hex) Wildcard Bits
- The Network Address
- The Broadcast Address
- The number of Usable IP Addresses
- The First Usable IP Address
- The Last Usable IP Address
(Whatnet assumes that the Broadcast address is the highest address in the subnet. This is the most common configuration.)
Examples
myhost> whatmask /26 --------------------------------------------- TCP/IP SUBNET MASK EQUIVALENTS --------------------------------------------- CIDR = .....................: /26 Netmask = ..................: 255.255.255.192 Netmask (hex) = ............: 0xffffffc0 Wildcard Bits = ............: 0.0.0.63 Usable IP Addresses = ......: 62 myhost> whatmask 255.255.192.0 --------------------------------------------- TCP/IP SUBNET MASK EQUIVALENTS --------------------------------------------- CIDR = .....................: /18 Netmask = ..................: 255.255.192.0 Netmask (hex) = ............: 0xffffc000 Wildcard Bits = ............: 0.0.63.255 Usable IP Addresses = ......: 16,382 myhost> whatmask 0xffffffe0 --------------------------------------------- TCP/IP SUBNET MASK EQUIVALENTS --------------------------------------------- CIDR = .....................: /27 Netmask = ..................: 255.255.255.224 Netmask (hex) = ............: 0xffffffe0 Wildcard Bits = ............: 0.0.0.31 Usable IP Addresses = ......: 30 myhost> whatmask 0.0.0.31 --------------------------------------------- TCP/IP SUBNET MASK EQUIVALENTS --------------------------------------------- CIDR = .....................: /27 Netmask = ..................: 255.255.255.224 Netmask (hex) = ............: 0xffffffe0 Wildcard Bits = ............: 0.0.0.31 Usable IP Addresses = ......: 30 myhost> whatmask 192.168.165.23/19 ------------------------------------------------ TCP/IP NETWORK INFORMATION ------------------------------------------------ IP Entered = ..................: 192.168.165.23 CIDR = ........................: /19 Netmask = .....................: 255.255.224.0 Netmask (hex) = ...............: 0xffffe000 Wildcard Bits = ...............: 0.0.31.255 ------------------------------------------------ Network Address = .............: 192.168.160.0 Broadcast Address = ...........: 192.168.191.255 Usable IP Addresses = .........: 8,190 First Usable IP Address = .....: 192.168.160.1 Last Usable IP Address = ......: 192.168.191.254 myhost> whatmask 192.168.0.13/255.255.255.0 ------------------------------------------------ TCP/IP NETWORK INFORMATION ------------------------------------------------ IP Entered = ..................: 192.168.0.13 CIDR = ........................: /24 Netmask = .....................: 255.255.255.0 Netmask (hex) = ...............: 0xffffff00 Wildcard Bits = ...............: 0.0.0.255 ------------------------------------------------ Network Address = .............: 192.168.0.0 Broadcast Address = ...........: 192.168.0.255 Usable IP Addresses = .........: 254 First Usable IP Address = .....: 192.168.0.1 Last Usable IP Address = ......: 192.168.0.254 myhost> whatmask 192.168.0.113/0xffffffe0 ------------------------------------------------ TCP/IP NETWORK INFORMATION ------------------------------------------------ IP Entered = ..................: 192.168.0.113 CIDR = ........................: /27 Netmask = .....................: 255.255.255.224 Netmask (hex) = ...............: 0xffffffe0 Wildcard Bits = ...............: 0.0.0.31 ------------------------------------------------ Network Address = .............: 192.168.0.96 Broadcast Address = ...........: 192.168.0.127 Usable IP Addresses = .........: 30 First Usable IP Address = .....: 192.168.0.97 Last Usable IP Address = ......: 192.168.0.126 myhost> whatmask 192.168.0.169/0.0.0.127 ------------------------------------------------ TCP/IP NETWORK INFORMATION ------------------------------------------------ IP Entered = ..................: 192.168.0.169 CIDR = ........................: /25 Netmask = .....................: 255.255.255.128 Netmask (hex) = ...............: 0xffffff80 Wildcard Bits = ...............: 0.0.0.127 ------------------------------------------------ Network Address = .............: 192.168.0.128 Broadcast Address = ...........: 192.168.0.255 Usable IP Addresses = .........: 126 First Usable IP Address = .....: 192.168.0.129 Last Usable IP Address = ......: 192.168.0.254COMPILATION NOTE: Some users have reported problems with pre-release versions of gcc. If you get "illegal instruction" errors please try compiling with an official full release of your compiler. You may also try disabling the optimizer by removing "-O2" from the Makefile after running configure.
Support Forum
Please join us at SourceOpen.com, and don't be afraid to be one of the first people to post a comment, question, etc. !
Download
Note: We have begun signing our software with our GPG public key, available from this secure server. MD5 sums are here.
Source
- whatmask v1.2 ( gpg sig) (md5 26aeff74dbba70262ccd426e681dcf4a)
(USA-Local HTTP Server)(162K) - GZIPed TAR file (source code, Install directions, Easy to compile (uses autoconf))
(Source also includes CodeWarrior Pro 6 projects for Mac and Windows, as well as Un*x source)
- whatmask v1.2 Source RPM
(USA-Local HTTP Server)(160K) - Source RPM file
Binaries
- whatmask v1.2 i386 RPM
(USA-Local HTTP Server)(22K) - Linux intel RPM
- whatmask v1.1 ppc RPM
(USA-Local HTTP Server)(43K) - Linux PPC RPM
- whatmask v1.1 Mac OS Carbon ( gpg sig)
(USA-Local HTTP Server)(40K) - Stuffit Archive for Mac OS 9 / OS X (Carbon) (standalone window, but no GUI)
- whatmask v1.2 Mac OS X Term ( gpg sig)
(USA-Local HTTP Server)(15K) - GZIPed TAR file for Mac OS X (terminal window)
(Note the source will compile fine under OSX cc as well)
- whatmask v1.2 Win32 ( gpg sig)
(USA-Local HTTP Server)(17K) - Zip Archive file for Win 32 (Command Prompt/DOS Shell)
Revision History
References
O'Reilly and Assocaites:
TCP/IP Network Administration, 2nd Edition
By Craig Hunt
2nd Edition December 1997
1-56592-322-7
Cisco - IP Addressing and Subnetting for New Users
More info on wilcard bits and Cisco routers.
Then of course you can do a net search... I like Google