Everything on the Nping command line that isn't an option or an
option argument is treated as a target host specification. Nping
uses the same syntax for target specifications that Nmap does. The
simplest case is a single target given by IP address or hostname.
addressing. You can append
/ to an
IPv4 address or hostname and Nping will send probes to every IP
address for which the first
<numbits> are the same as for the
reference IP or hostname given. For example,
send probes to the 256 hosts between 192.168.10.0
11000000 10101000 00001010 00000000)
11000000 10101000 00001010 11111111),
192.168.10.40/24 would ping exactly the same targets.
Given that the host scanme.nmap.org
is at the IP address 22.214.171.124, the specification
scanme.nmap.org/16 would send probes to the 65,536 IP addresses
between 126.96.36.199 and 188.8.131.52. The smallest allowed value is
/0, which targets the whole Internet. The largest value is
which targets just the named host or IP address because all address
bits are fixed.
CIDR notation is short but not always flexible enough. For example,
you might want to send probes to 192.168.0.0/16 but skip any IPs
ending with .0 or .255 because they may be used as subnet network
and broadcast addresses. Nping supports this through octet range
addressing. Rather than specify a normal IP address, you can specify
a comma-separated list of numbers or ranges for each octet. For
192.168.0-255.1-254 will skip all addresses in the range
that end in .0 or .255, and
192.168.3-5,7.1 will target the four
addresses 192.168.3.1, 192.168.4.1, 192.168.5.1, and 192.168.7.1.
Either side of a range may be omitted; the default values are 0 on
the left and 255 on the right. Using
- by itself is the same as
but remember to use
0- in the first octet so the target
specification doesn't look like a command-line option. Ranges need
not be limited to the final octets: the specifier
0-.-.13.37 will send probes
to all IP addresses on the Internet ending in .13.37. This sort of
broad sampling can be useful for Internet surveys and research.
IPv6 addresses can only be specified by their fully qualified IPv6
address or hostname. CIDR and octet ranges aren't supported for
IPv6 because they are rarely useful.
Nping accepts multiple host specifications on the command line,
and they don't need to be the same type. The command
192.168.0.0/8 10.0.0,1,3-7.- does what you would expect.