Chapter 18. Nping Reference Guide
Name
nping — Network packet generation tool / ping utility
Synopsis
nping
[
<Options>
] {
<targets>
}
Description
![]() | Note |
---|---|
This document describes the very latest version of
Nping available from |
Nping is an open-source tool for network packet generation, response analysis and response time measurement. Nping allows users to generate network packets of a wide range of protocols, letting them tune virtually any field of the protocol headers. While Nping can be used as a simple ping utility to detect active hosts, it can also be used as a raw packet generator for network stack stress tests, ARP poisoning, Denial of Service attacks, route tracing, and other purposes.
Additionally, Nping offers a special mode of operation called the "Echo Mode", that lets users see how the generated probes change in transit, revealing the differences between the transmitted packets and the packets received at the other end. See section "Echo Mode" for details.
The output from Nping is a list of the packets that are being sent and received. The level of detail depends on the options used.
A typical Nping execution is shown in Example 18.1. The only Nping arguments used in
this example are -c
, to specify the number of times to
target each host, --tcp
to specify TCP Probe Mode,
-p 80,433
to specify the target ports; and then the two
target hostnames.
# nping -c 1 --tcp -p 80,433 scanme.nmap.org google.com
Starting Nping ( https://nmap.org/nping )
SENT (0.0120s) TCP 96.16.226.135:50091 > 64.13.134.52:80 S ttl=64 id=52072 iplen=40 seq=1077657388 win=1480
RCVD (0.1810s) TCP 64.13.134.52:80 > 96.16.226.135:50091 SA ttl=53 id=0 iplen=44 seq=4158134847 win=5840 <mss 1460>
SENT (1.0140s) TCP 96.16.226.135:50091 > 74.125.45.100:80 S ttl=64 id=13932 iplen=40 seq=1077657388 win=1480
RCVD (1.1370s) TCP 74.125.45.100:80 > 96.16.226.135:50091 SA ttl=52 id=52913 iplen=44 seq=2650443864 win=5720 <mss 1430>
SENT (2.0140s) TCP 96.16.226.135:50091 > 64.13.134.52:433 S ttl=64 id=8373 iplen=40 seq=1077657388 win=1480
SENT (3.0140s) TCP 96.16.226.135:50091 > 74.125.45.100:433 S ttl=64 id=23624 iplen=40 seq=1077657388 win=1480
Statistics for host scanme.nmap.org (64.13.134.52):
| Probes Sent: 2 | Rcvd: 1 | Lost: 1 (50.00%)
|_ Max rtt: 169.720ms | Min rtt: 169.720ms | Avg rtt: 169.720ms
Statistics for host google.com (74.125.45.100):
| Probes Sent: 2 | Rcvd: 1 | Lost: 1 (50.00%)
|_ Max rtt: 122.686ms | Min rtt: 122.686ms | Avg rtt: 122.686ms
Raw packets sent: 4 (160B) | Rcvd: 2 (92B) | Lost: 2 (50.00%)
Tx time: 3.00296s | Tx bytes/s: 53.28 | Tx pkts/s: 1.33
Rx time: 3.00296s | Rx bytes/s: 30.64 | Rx pkts/s: 0.67
Nping done: 2 IP addresses pinged in 4.01 seconds
The newest version of Nping can be obtained with Nmap at https://nmap.org
. The newest version of this man page
is available at https://nmap.org/book/nping-man.html
.
Options Summary
This options summary is printed when Nping is run with no arguments. It helps people remember the most common options, but is no substitute for the in-depth documentation in the rest of this manual. Some obscure options aren't even included here.
Nping 0.7.92SVN ( https://nmap.org/nping ) Usage: nping [Probe mode] [Options] {target specification} TARGET SPECIFICATION: Targets may be specified as hostnames, IP addresses, networks, etc. Ex: scanme.nmap.org, microsoft.com/24, 192.168.0.1; 10.0.*.1-24 PROBE MODES: --tcp-connect : Unprivileged TCP connect probe mode. --tcp : TCP probe mode. --udp : UDP probe mode. --icmp : ICMP probe mode. --arp : ARP/RARP probe mode. --tr, --traceroute : Traceroute mode (can only be used with TCP/UDP/ICMP modes). TCP CONNECT MODE: -p, --dest-port <port spec> : Set destination port(s). -g, --source-port <portnumber> : Try to use a custom source port. TCP PROBE MODE: -g, --source-port <portnumber> : Set source port. -p, --dest-port <port spec> : Set destination port(s). --seq <seqnumber> : Set sequence number. --flags <flag list> : Set TCP flags (ACK,PSH,RST,SYN,FIN...) --ack <acknumber> : Set ACK number. --win <size> : Set window size. --badsum : Use a random invalid checksum. UDP PROBE MODE: -g, --source-port <portnumber> : Set source port. -p, --dest-port <port spec> : Set destination port(s). --badsum : Use a random invalid checksum. ICMP PROBE MODE: --icmp-type <type> : ICMP type. --icmp-code <code> : ICMP code. --icmp-id <id> : Set identifier. --icmp-seq <n> : Set sequence number. --icmp-redirect-addr <addr> : Set redirect address. --icmp-param-pointer <pnt> : Set parameter problem pointer. --icmp-advert-lifetime <time> : Set router advertisement lifetime. --icmp-advert-entry <IP,pref> : Add router advertisement entry. --icmp-orig-time <timestamp> : Set originate timestamp. --icmp-recv-time <timestamp> : Set receive timestamp. --icmp-trans-time <timestamp> : Set transmit timestamp. ARP/RARP PROBE MODE: --arp-type <type> : Type: ARP, ARP-reply, RARP, RARP-reply. --arp-sender-mac <mac> : Set sender MAC address. --arp-sender-ip <addr> : Set sender IP address. --arp-target-mac <mac> : Set target MAC address. --arp-target-ip <addr> : Set target IP address. IPv4 OPTIONS: -S, --source-ip : Set source IP address. --dest-ip <addr> : Set destination IP address (used as an alternative to {target specification} ). --tos <tos> : Set type of service field (8bits). --id <id> : Set identification field (16 bits). --df : Set Don't Fragment flag. --mf : Set More Fragments flag. --evil : Set Reserved / Evil flag. --ttl <hops> : Set time to live [0-255]. --badsum-ip : Use a random invalid checksum. --ip-options <S|R [route]|L [route]|T|U ...> : Set IP options --ip-options <hex string> : Set IP options --mtu <size> : Set MTU. Packets get fragmented if MTU is small enough. IPv6 OPTIONS: -6, --IPv6 : Use IP version 6. --dest-ip : Set destination IP address (used as an alternative to {target specification}). --hop-limit : Set hop limit (same as IPv4 TTL). --traffic-class <class> : : Set traffic class. --flow <label> : Set flow label. ETHERNET OPTIONS: --dest-mac <mac> : Set destination mac address. (Disables ARP resolution) --source-mac <mac> : Set source MAC address. --ether-type <type> : Set EtherType value. PAYLOAD OPTIONS: --data <hex string> : Include a custom payload. --data-string <text> : Include a custom ASCII text. --data-length <len> : Include len random bytes as payload. ECHO CLIENT/SERVER: --echo-client <passphrase> : Run Nping in client mode. --echo-server <passphrase> : Run Nping in server mode. --echo-port <port> : Use custom <port> to listen or connect. --no-crypto : Disable encryption and authentication. --once : Stop the server after one connection. --safe-payloads : Erase application data in echoed packets. TIMING AND PERFORMANCE: Options which take <time> are in seconds, or append 'ms' (milliseconds), 's' (seconds), 'm' (minutes), or 'h' (hours) to the value (e.g. 30m, 0.25h). --delay <time> : Adjust delay between probes. --rate <rate> : Send num packets per second. MISC: -h, --help : Display help information. -V, --version : Display current version number. -c, --count <n> : Stop after <n> rounds. -e, --interface <name> : Use supplied network interface. -H, --hide-sent : Do not display sent packets. -N, --no-capture : Do not try to capture replies. --privileged : Assume user is fully privileged. --unprivileged : Assume user lacks raw socket privileges. --send-eth : Send packets at the raw Ethernet layer. --send-ip : Send packets using raw IP sockets. --bpf-filter <filter spec> : Specify custom BPF filter. OUTPUT: -v : Increment verbosity level by one. -v[level] : Set verbosity level. E.g: -v4 -d : Increment debugging level by one. -d[level] : Set debugging level. E.g: -d3 -q : Decrease verbosity level by one. -q[N] : Decrease verbosity level N times --quiet : Set verbosity and debug level to minimum. --debug : Set verbosity and debug to the max level. EXAMPLES: nping scanme.nmap.org nping --tcp -p 80 --flags rst --ttl 2 192.168.1.1 nping --icmp --icmp-type time --delay 500ms 192.168.254.254 nping --echo-server "public" -e wlan0 -vvv nping --echo-client "public" echo.nmap.org --tcp -p1-1024 --flags ack SEE THE MAN PAGE FOR MANY MORE OPTIONS, DESCRIPTIONS, AND EXAMPLES
Target Specification
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.
Nping supports
CIDR-style
addressing. You can append /
to an
IPv4 address or hostname and Nping will send probes to every IP
address for which the first <numbits>
<numbits>
are the same as for the
reference IP or hostname given. For example, 192.168.10.0/24
would
send probes to the 256 hosts between 192.168.10.0
(binary: 11000000 10101000 00001010 00000000
)
and 192.168.10.255
(binary: 11000000 10101000 00001010 11111111
),
inclusive. 192.168.10.40/24
would ping exactly the same targets.
Given that the host scanme.nmap.org
is at the IP address 64.13.134.52, the specification
scanme.nmap.org/16
would send probes to the 65,536 IP addresses
between 64.13.0.0 and 64.13.255.255. The smallest allowed value is
/0
, which targets the whole Internet. The largest value is /32
,
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
example, 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 0-255
,
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 nping scanme.nmap.org 192.168.0.0/8 10.0.0,1,3-7.- does what you would expect.
Option Specification
Nping is designed to be very flexible and fit a wide variety of needs. As with most command-line tools, its behavior can be adjusted using command-line options. These general principles apply to option arguments, unless stated otherwise.
Options that take integer numbers can accept values specified in
decimal, octal or hexadecimal base. When a number starts with 0x
,
it will be treated as hexadecimal; when it simply starts with 0
, it
will be treated as octal. Otherwise, Nping will assume the number has
been specified in base 10. Virtually all numbers that can be supplied
from the command line are unsigned so, as a general rule, the minimum
value is zero. Users may also specify the word random
or rand
to
make Nping generate a random value within the expected range.
IP addresses may be given as IPv4 addresses (e.g.
192.168.1.1
), IPv6 addresses (e.g.
2001:db8:85a3::8e4c:760:7146
), or hostnames, which
will be resolved using the default DNS server configured in the host
system.
Options that take MAC addresses accept the usual colon-separated 6 hex
byte format (e.g. 00:50:56:d4:01:98
). Hyphens may also be used instead
of colons (e.g. 00-50-56-c0-00-08
). The special
word random
or rand
sets a random
address and the word broadcast
or bcast
sets ff:ff:ff:ff:ff:ff.
General Operation
Unlike other ping and packet generation tools, Nping supports multiple target host and port specifications. While this provides great flexibility, it is not obvious how Nping handles situations where there is more than one host and/or more than one port to send probes to. This section explains how Nping behaves in these cases.
When multiple target hosts are specified, Nping rotates among them in round-robin fashion. This gives slow hosts more time to send their responses before another probe is sent to them. Ports are also scheduled using round robin. So, unless only one port is specified, Nping never sends two probes to the same target host and port consecutively.
The loop around targets is the “inner loop” and the
loop around ports is the “outer loop”. All targets
will be sent a probe for a given port before moving on to the next
port. Between probes, Nping waits a configurable amount of time
called the “inter-probe delay”, which is controlled by
the --delay
option. These examples show how it
works.
-
One target, three ports, and two rounds.
#
nping --tcp -c 2 1.1.1.1 -p 100-102
Starting Nping ( https://nmap.org/nping ) SENT (0.0210s) TCP 192.168.1.77 > 1.1.1.1:100 SENT (1.0230s) TCP 192.168.1.77 > 1.1.1.1:101 SENT (2.0250s) TCP 192.168.1.77 > 1.1.1.1:102 SENT (3.0280s) TCP 192.168.1.77 > 1.1.1.1:100 SENT (4.0300s) TCP 192.168.1.77 > 1.1.1.1:101 SENT (5.0320s) TCP 192.168.1.77 > 1.1.1.1:102-
Three targets, one port, and two rounds.
#
nping --tcp -c 2 1.1.1.1 2.2.2.2 3.3.3.3 -p 8080
Starting Nping ( https://nmap.org/nping ) SENT (0.0230s) TCP 192.168.0.21 > 1.1.1.1:8080 SENT (1.0240s) TCP 192.168.0.21 > 2.2.2.2:8080 SENT (2.0260s) TCP 192.168.0.21 > 3.3.3.3:8080 SENT (3.0270s) TCP 192.168.0.21 > 1.1.1.1:8080 SENT (4.0290s) TCP 192.168.0.21 > 2.2.2.2:8080 SENT (5.0310s) TCP 192.168.0.21 > 3.3.3.3:8080-
Three hosts, three ports, one round, inter-probe delay of 500 ms.
#
nping --tcp -c 1 --delay 500ms 1.1.1.1 2.2.2.2 3.3.3.3 -p 137-139
Starting Nping ( https://nmap.org/nping ) SENT (0.0230s) TCP 192.168.0.21 > 1.1.1.1:137 SENT (0.5250s) TCP 192.168.0.21 > 2.2.2.2:137 SENT (1.0250s) TCP 192.168.0.21 > 3.3.3.3:137 SENT (1.5280s) TCP 192.168.0.21 > 1.1.1.1:138 SENT (2.0280s) TCP 192.168.0.21 > 2.2.2.2:138 SENT (2.5310s) TCP 192.168.0.21 > 3.3.3.3:138 SENT (3.0300s) TCP 192.168.0.21 > 1.1.1.1:139 SENT (3.5330s) TCP 192.168.0.21 > 2.2.2.2:139 SENT (4.0330s) TCP 192.168.0.21 > 3.3.3.3:139
Probe Modes
Nping supports a wide variety of protocols. Although in some cases Nping can automatically determine the mode from the options used, it is generally a good idea to specify it explicitly.
-
--tcp-connect
(TCP Connect mode) -
--tcp
(TCP mode) -
--udp
(UDP mode) UDP mode can have two different behaviours. Under normal circumstances, it lets users create custom IP/UDP packets. However, if Nping is run by a user without raw packet privileges and no changes to the default protocol headers are requested, then Nping enters the unprivileged UDP mode which basically sends UDP packets to the specified target hosts and ports using the
sendto
system call. Note that in this unprivileged mode it is not possible to see low-level header information of the packets on the wire but only status information about the amount of bytes that are being transmitted and received. UDP mode can be used to interact with any UDP-based server. Examples are DNS servers, streaming servers, online gaming servers, and port knocking/single-packet authorization daemons.-
--icmp
(ICMP mode) -
--arp
(ARP/RARP mode) -
--traceroute
(Traceroute mode)
TCP Connect Mode
-
-p
,<port_spec>
--dest-port
(Target ports)<port_spec>
-
-g
,<portnumber>
--source-port
(Spoof source port)<portnumber>
-
-p
,<port_spec>
--dest-port
(Target ports)<port_spec>
-
-g
,<portnumber>
--source-port
(Spoof source port)<portnumber>
-
--seq
(Sequence Number)<seqnumber>
-
--flags
(TCP Flags)<flags>
- CWR (Congestion Window Reduced)
- ECN (Explicit Congestion Notification)
During the three-way handshake it indicates that sender is capable of performing explicit congestion notification. Normally it means that a packet with the IP Congestion Experienced flag set was received during normal transmission. See RFC 3168 for more information.
- URG (Urgent)
Segment is urgent and the urgent pointer field carries valid information.
- ACK (Acknowledgement)
- PSH (Push)
The data in this segment should be immediately pushed to the application layer on arrival.
- RST (Reset)
There was some problem and the sender wants to abort the connection.
- SYN (Synchronize)
- FIN (Finish)
-
--win
(Window Size)<size>
-
--badsum
(Invalid Checksum) Asks Nping to use an invalid TCP checksum for the packets sent to target hosts. Since virtually all host IP stacks properly drop these packets, any responses received are likely coming from a firewall or an IDS that didn't bother to verify the checksum. For more details on this technique, see
https://nmap.org/p60-12.html
.
UDP Mode
-
-p
,<port_spec>
--dest-port
(Target ports)<port_spec>
-
-g
,<portnumber>
--source-port
(Spoof source port)<portnumber>
-
--badsum
(Invalid Checksum) Asks Nping to use an invalid UDP checksum for the packets sent to target hosts. Since virtually all host IP stacks properly drop these packets, any responses received are likely coming from a firewall or an IDS that didn't bother to verify the checksum. For more details on this technique, see
https://nmap.org/p60-12.html
.
ICMP Mode
-
--icmp-type
(ICMP type)<type>
This option specifies which type of ICMP messages should be generated.
<type>
can be supplied in two different ways. You can use the official type numbers assigned by IANA (e.g.--icmp-type 8
for ICMP Echo Request), or you can use any of the mnemonics listed in the section called “ICMP Types”.-
--icmp-code
(ICMP code)<code>
This option specifies which ICMP code should be included in the generated ICMP messages.
<code>
can be supplied in two different ways. You can use the official code numbers assigned by IANA (e.g.--icmp-code 1
for Fragment Reassembly Time Exceeded), or you can use any of the mnemonics listed in the section called “ICMP Codes”.-
--icmp-id
(ICMP identifier)<id>
-
--icmp-seq
(ICMP sequence)<seq>
-
--icmp-redirect-addr
(ICMP Redirect address)<addr>
-
--icmp-param-pointer
(ICMP Parameter Problem pointer)<pointer>
-
--icmp-advert-lifetime
(ICMP Router Advertisement Lifetime)<ttl>
-
--icmp-advert-entry
(ICMP Router Advertisement Entry)<addr>
,<pref>
-
--icmp-orig-time
(ICMP Originate Timestamp)<timestamp>
-
--icmp-recv-time
(ICMP Receive Timestamp)<timestamp>
-
--icmp-trans-time
(ICMP Transmit Timestamp)<timestamp>
These identifiers may be used as mnemonics for the ICMP type numbers given
to the
--icmp-type
option. In general there are three forms of each identifier: the full name
(e.g. destination-unreachable
), the short name (e.g.
dest-unr
), or the initials (e.g. du
).
In ICMP types that request something, the word "request" is omitted.
echo-reply
,echo-rep
,er
Echo Reply (type 0). This message is sent in response to an Echo Request message.
destination-unreachable
,dest-unr
,du
Destination Unreachable (type 3). This message indicates that a datagram could not be delivered to its destination.
source-quench
,sour-que
,sq
Source Quench (type 4). This message is used by a congested IP device to tell other device that is sending packets too fast and that it should slow down.
redirect
,redi
,r
Redirect (type 5). This message is normally used by routers to inform a host that there is a better route to use for sending datagrams. See also the
--icmp-redirect-addr
option.echo-request
,echo
,e
Echo Request (type 8). This message is used to test the connectivity of another device on a network.
router-advertisement
,rout-adv
,ra
Router Advertisement (type 9). This message is used by routers to let hosts know of their existence and capabilities. See also the
--icmp-advert-lifetime
option.router-solicitation
,rout-sol
,rs
Router Solicitation (type 10). This message is used by hosts to request Router Advertisement messages from any listening routers.
time-exceeded
,time-exc
,te
Time Exceeded (type 11). This message is generated by some intermediate device (normally a router) to indicate that a datagram has been discarded before reaching its destination because the IP TTL expired.
parameter-problem
,member-pro
,pp
Parameter Problem (type 12). This message is used when a device finds a problem with a parameter in an IP header and it cannot continue processing it. See also the
--icmp-param-pointer
option.timestamp
,time
,tm
Timestamp Request (type 13). This message is used to request a device to send a timestamp value for propagation time calculation and clock synchronization. See also the
--icmp-orig-time
,--icmp-recv-time
, and--icmp-trans-time
.timestamp-reply
,time-rep
,tr
Timestamp Reply (type 14). This message is sent in response to a Timestamp Request message.
information
,info
,i
Information Request (type 15). This message is now obsolete but it was originally used to request configuration information from another device.
information-reply
,info-rep
,ir
Information Reply (type 16). This message is now obsolete but it was originally sent in response to an Information Request message to provide configuration information.
mask-request
,mask
,m
Address Mask Request (type 17). This message is used to ask a device to send its subnet mask.
mask-reply
,mask-rep
,mr
Address Mask Reply (type 18). This message contains a subnet mask and is sent in response to a Address Mask Request message.
traceroute
,trace
,tc
Traceroute (type 30). This message is normally sent by an intermediate device when it receives an IP datagram with a traceroute option. ICMP Traceroute messages are still experimental, see RFC 1393 for more information.
ICMP Codes
These identifiers may be used as mnemonics for the ICMP code numbers given
to the
--icmp-code
option. They are listed by the ICMP type they correspond to.
Destination Unreachable
network-unreachable
,netw-unr
,net
Code 0. Datagram could not be delivered to its destination network (probably due to some routing problem).
host-unreachable
,host-unr
,host
Code 1. Datagram was delivered to the destination network but it was impossible to reach the specified host (probably due to some routing problem).
protocol-unreachable
,prot-unr
,proto
Code 2. The protocol specified in the Protocol field of the IP datagram is not supported by the host to which the datagram was delivered.
port-unreachable
,port-unr
,port
Code 3. The TCP/UDP destination port was invalid.
needs-fragmentation
,need-fra
,frag
Code 4. Datagram had the DF bit set but it was too large for the MTU of the next physical network so it had to be dropped.
source-route-failed
,sour-rou
,routefail
Code 5. IP datagram had a Source Route option but a router couldn't pass it to the next hop.
network-unknown
,netw-unk
,net?
Code 6. Destination network is unknown. This code is never used. Instead, Network Unreachable is used.
host-unknown
,host-unk
,host?
Code 7. Specified host is unknown. Usually generated by a router local to the destination host to inform of a bad address.
host-isolated
,host-iso
,isolated
Code 8. Source Host Isolated. Not used.
network-prohibited
,netw-pro
,!net
Code 9. Communication with destination network is administratively prohibited (source device is not allowed to send packets to the destination network).
host-prohibited
,host-pro
,!host
Code 10. Communication with destination host is administratively prohibited. (The source device is allowed to send packets to the destination network but not to the destination device.)
network-tos
,unreachable-network-tos
,netw-tos
,tosnet
Code 11. Destination network unreachable because it cannot provide the type of service specified in the IP TOS field.
host-tos
,unreachable-host-tos
,toshost
Code 12. Destination host unreachable because it cannot provide the type of service specified in the IP TOS field.
communication-prohibited
,comm-pro
,!comm
Code 13. Datagram could not be forwarded due to filtering that blocks the message based on its contents.
host-precedence-violation
,precedence-violation
,prec-vio
,violation
Code 14. Precedence value in the IP TOS field is not permitted.
precedence-cutoff
,prec-cut
,cutoff
Code 15. Precedence value in the IP TOS field is lower than the minimum allowed for the network.
Redirect
redirect-network
,redi-net
,net
Code 0. Redirect all future datagrams with the same destination network as the original datagram, to the router specified in the Address field. The use of this code is prohibited by RFC 1812.
redirect-host
,redi-host
,host
redirect-network-tos
,redi-ntos
,redir-ntos
redirect-host-tos
,redi-htos
,redir-htos
Router Advertisement
Parameter Problem
ARP Mode
-
--arp-type
(ICMP Type)<type>
This option specifies which type of ARP messages should be generated.
<type>
can be supplied in two different ways. You can use the official numbers assigned by IANA (e.g.--arp-type 1
for ARP Request), or you can use one of the mnemonics from the section called “ARP Types”.-
--arp-sender-mac
(Sender MAC address)<mac>
-
--arp-sender-ip
(Sender IP address)<addr>
-
--arp-target-mac
(target MAC address)<mac>
This option sets the Target Hardware Address field of the ARP header.
-
--arp-target-ip
(target ip address)<addr>
These identifiers may be used as mnemonics for the ARP type numbers given
to the
--arp-type
option.
arp-request
,arp
,a
ARP Request (type 1). ARP requests are used to translate network layer addresses (normally IP addresses) to link layer addresses (usually MAC addresses). Basically, and ARP request is a broadcasted message that asks the host in the same network segment that has a given IP address to provide its MAC address.
arp-reply
,arp-rep
,ar
ARP Reply (type 2). An ARP reply is a message that a host sends in response to an ARP request to provide its link layer address.
rarp-request
,rarp
,r
RARP Requests (type 3). RARP requests are used to translate a link layer address (normally a MAC address) to a network layer address (usually an IP address). Basically a RARP request is a broadcasted message sent by a host that wants to know his own IP address because it doesn't have any. It was the first protocol designed to solve the bootstrapping problem. However, RARP is now obsolete and DHCP is used instead. For more information about RARP see RFC 903.
rarp-reply
,rarp-rep
,rr
drarp-request
,drarp
,d
Dynamic RARP Request (type 5). Dynamic RARP is an extension to RARP used to obtain or assign a network layer address from a fixed link layer address. DRARP was used mainly in Sun Microsystems platforms in the late 90's but now it's no longer used. See RFC 1931 for more information.
drarp-reply
,drarp-rep
,dr
drarp-error
,drarp-err
,de
inarp-request
,inarp
,i
Inverse ARP Request (type 8). InARP requests are used to translate a link layer address to a network layer address. It is similar to RARP request but in this case, the sender of the InARP request wants to know the network layer address of another node, not its own address. InARP is mainly used in Frame Relay and ATM networks. For more information see RFC 2390.
inarp-reply
,inarp-rep
,ir
arp-nak
,an
ARP NAK (type 10). ARP NAK messages are an extension to the ATMARP protocol and they are used to improve the robustness of the ATMARP server mechanism. With ARP NAK, a client can determine the difference between a catastrophic server failure and an ATMARP table lookup failure. See RFC 1577 for more information.
IPv4 Options
-
-S
,<addr>
--source-ip
(Source IP Address)<addr>
-
--dest-ip
(Destination IP Address)<addr>
Adds a target to Nping's target list. This option is provided for consistency but its use is deprecated in favor of plain target specifications. See the section called “Target Specification”.
-
--tos
(Type of Service)<tos>
Sets the IP TOS field. The TOS field is used to carry information to provide quality of service features. It is normally used to support a technique called Differentiated Services. See RFC 2474 for more information.
<tos>
must be a number in the range [0–255].-
--id
(Identification)<id>
-
--df
(Don't Fragment) -
--mf
(More Fragments) -
--evil
(Reserved / Evil) -
--ttl
(Time To Live)<hops>
-
--badsum-ip
(Invalid IP checksum) -
--ip-options
,<R|S [route]|L [route]|T|U ...>
--ip-options
(IP Options)<hex string>
For more information and examples of using IP options with Nping, see the mailing list post at
https://seclists.org/nmap-dev/2006/q3/0052.html
.-
--mtu
(Maximum Transmission Unit)<size>
-
-6
,--ipv6
(Use IPv6) While IPv6 hasn't exactly taken the world by storm, it gets significant use in some (usually Asian) countries and most modern operating systems support it. To use Nping with IPv6, both the source and target of your packets must be configured for IPv6. If your ISP (like most of them) does not allocate IPv6 addresses to you, free tunnel brokers are widely available and work fine with Nping. You can use the free IPv6 tunnel broker service at
http://www.tunnelbroker.net
.Please note that IPv6 support is still highly experimental and many modes and options may not work with it.
-
-S
,<addr>
--source-ip
(Source IP Address)<addr>
-
--dest-ip
(Destination IP Address)<addr>
Adds a target to Nping's target list. This option is provided for consistency but its use is deprecated in favor of plain target specifications. See the section called “Target Specification”.
-
--flow
(Flow Label)<label>
Sets the IPv6 Flow Label. The Flow Label field is 20 bits long and is intended to provide certain quality-of-service properties for real-time datagram delivery. However, it has not been widely adopted, and not all routers or endpoints support it. Check RFC 2460 for more information.
<label>
must be an integer in the range [0–1048575].-
--traffic-class
(Traffic Class)<class>
Sets the IPv6 Traffic Class. This field is similar to the TOS field in IPv4, and is intended to provide the Differentiated Services method, enabling scalable service discrimination in the Internet without the need for per-flow state and signaling at every hop. Check RFC 2474 for more information.
<class>
must be an integer in the range [0–255].-
--hop-limit
(Hop Limit)<hops>
Sets the IPv6 Hop Limit field in sent packets to the given value. The Hop Limit field specifies how long the datagram is allowed to exist on the network. It represents the number of hops a packet can traverse before being dropped. As with the TTL in IPv4, IPv6 Hop Limit tries to avoid a situation in which undeliverable datagrams keep being forwarded from one router to another endlessly.
<hops>
must be a number in the range [0–255].
-
--dest-mac
(Ethernet Destination MAC Address)<mac>
-
--source-mac
(Ethernet Source MAC Address)<mac>
-
--ether-type
(Ethertype)<type>
This option sets the Ethertype field of the ethernet frame. The Ethertype is used to indicate which protocol is encapsulated in the payload.
<type>
can be supplied in two different ways. You can use the official numbers listed by the IEEE (e.g.--ether-type 0x0800
for IP version 4), or one of the mnemonics from the section called “Ethernet Types”.
Ethernet Types
These identifiers may be used as mnemonics for the Ethertype numbers given
to the
--arp-type
option.
ipv4
,ip
,4
Internet Protocol version 4 (type 0x0800).
ipv6
,6
Internet Protocol version 6 (type 0x86DD).
arp
Address Resolution Protocol (type 0x0806).
rarp
Reverse Address Resolution Protocol (type 0x8035).
frame-relay
,frelay
,fr
Frame Relay (type 0x0808).
ppp
Point-to-Point Protocol (type 0x880B).
gsmp
General Switch Management Protocol (type 0x880C).
mpls
Multiprotocol Label Switching (type 0x8847).
mps-ual
,mps
Multiprotocol Label Switching with Upstream-assigned Label (type 0x8848).
mcap
Multicast Channel Allocation Protocol (type 0x8861).
pppoe-discovery
,pppoe-d
PPP over Ethernet Discovery Stage (type 0x8863).
pppoe-session
,pppoe-s
PPP over Ethernet Session Stage (type 0x8864).
ctag
Customer VLAN Tag Type (type 0x8100).
epon
Ethernet Passive Optical Network (type 0x8808).
pbnac
Port-based network access control (type 0x888E).
stag
Service VLAN tag identifier (type 0x88A8).
ethexp1
Local Experimental Ethertype 1 (type 0x88B5).
ethexp2
Local Experimental Ethertype 2 (type 0x88B6).
ethoui
OUI Extended Ethertype (type 0x88B7).
preauth
Pre-Authentication (type 0x88C7).
lldp
Link Layer Discovery Protocol (type 0x88CC).
mac-security
,mac-sec
,macsec
Media Access Control Security (type 0x88E5).
mvrp
Multiple VLAN Registration Protocol (type 0x88F5).
mmrp
Multiple Multicast Registration Protocol (type 0x88F6).
frrr
Fast Roaming Remote Request (type 0x890D).
Payload Options
-
--data
(Append custom binary data to sent packets)<hex string>
-
--data-string
(Append custom string to sent packets)<string>
-
--data-length
(Append random data to sent packets)<len>
Internally, client and server communicate over an encrypted and
authenticated channel, using the Nping Echo Protocol (NEP), whose technical
specification can be found in
https://nmap.org/svn/nping/docs/EchoProtoRFC.txt
The following paragraphs describe the different options available in Nping's Echo mode.
-
--ec
,<passphrase>
--echo-client
(Run Echo client)<passphrase>
-
--es
,<passphrase>
--echo-server
(Run Echo server)<passphrase>
-
--ep
,<port>
--echo-port
(Set Echo TCP port number)<port>
-
--nc
,--no-crypto
(Disable encryption and authentication) -
--once
(Serve one client and quit) -
--safe-payloads
(Zero application data before echoing a packet)
# nping --echo-client "public" echo.nmap.org --udp
Starting Nping ( https://nmap.org/nping )
SENT (1.0970s) UDP 10.1.20.128:53 > 178.79.165.17:40125 ttl=64 id=32523 iplen=28
CAPT (1.1270s) UDP 80.38.10.21:45657 > 178.79.165.17:40125 ttl=54 id=32523 iplen=28
RCVD (1.1570s) ICMP 178.79.165.17 > 10.1.20.128 Port unreachable (type=3/code=3) ttl=49 id=16619 iplen=56
[...]
SENT (5.1020s) UDP 10.1.20.128:53 > 178.79.165.17:40125 ttl=64 id=32523 iplen=28
CAPT (5.1335s) UDP 80.38.10.21:45657 > 178.79.165.17:40125 ttl=54 id=32523 iplen=28
RCVD (5.1600s) ICMP 178.79.165.17 > 10.1.20.128 Port unreachable (type=3/code=3) ttl=49 id=16623 iplen=56
Max rtt: 60.628ms | Min rtt: 58.378ms | Avg rtt: 59.389ms
Raw packets sent: 5 (140B) | Rcvd: 5 (280B) | Lost: 0 (0.00%)| Echoed: 5 (140B)
Tx time: 4.00459s | Tx bytes/s: 34.96 | Tx pkts/s: 1.25
Rx time: 5.00629s | Rx bytes/s: 55.93 | Rx pkts/s: 1.00
Nping done: 1 IP address pinged in 6.18 seconds
The output clearly shows the presence of a NAT device in the client's local network. Note how the captured packet (CAPT) differs from the SENT packet: the source address for the original packets is in the reserved 10.0.0.0/8 range, while the address seen by the server is 80.38.10.21, the Internet side address of the NAT device. The source port was also modified by the device. The line starting with RCVD corresponds to the responses generated by the TCP/IP stack of the machine where the Echo server is run.
# nping --echo-client "public" echo.nmap.org --tcp -p80
Starting Nping ( https://nmap.org/nping )
SENT (1.2160s) TCP 10.0.1.77:41659 > 178.79.165.17:80 S ttl=64 id=3317 iplen=40 seq=567704200 win=1480
RCVD (1.2180s) TCP 178.79.165.17:80 > 10.0.1.77:41659 SA ttl=128 id=13177 iplen=44 seq=3647106954 win=16384 <mss 1460>
SENT (2.2150s) TCP 10.0.1.77:41659 > 178.79.165.17:80 S ttl=64 id=3317 iplen=40 seq=567704200 win=1480
SENT (3.2180s) TCP 10.0.1.77:41659 > 178.79.165.17:80 S ttl=64 id=3317 iplen=40 seq=567704200 win=1480
SENT (4.2190s) TCP 10.0.1.77:41659 > 178.79.165.17:80 S ttl=64 id=3317 iplen=40 seq=567704200 win=1480
SENT (5.2200s) TCP 10.0.1.77:41659 > 178.79.165.17:80 S ttl=64 id=3317 iplen=40 seq=567704200 win=1480
Max rtt: 2.062ms | Min rtt: 2.062ms | Avg rtt: 2.062ms
Raw packets sent: 5 (200B) | Rcvd: 1 (46B) | Lost: 4 (80.00%)| Echoed: 0 (0B)
Tx time: 4.00504s | Tx bytes/s: 49.94 | Tx pkts/s: 1.25
Rx time: 5.00618s | Rx bytes/s: 9.19 | Rx pkts/s: 0.20
Nping done: 1 IP address pinged in 6.39 seconds
In this example, the output is a bit more tricky. The absence of error messages shows that the Echo client has successfully established an Echo session with the server. However, no CAPT packets can be seen in the output. This means that none of the transmitted packets reached the server. Interestingly, a TCP SYN-ACK packet was received in response to the first TCP-SYN packet (and also, it is known that the target host does not have port 80 open). This behavior reveals the presence of a transparent web proxy cache server (which in this case is an old MS ISA server).
Timing and Performance Options
-
--delay
(Delay between probes)<time>
-
--rate
(Send probes at a given rate)<rate>
-h
,--help
(Display help)-
-V
,--version
(Display version) -
-c
,<rounds>
--count
(Stop after a given number of rounds)<rounds>
-
-e
,<name>
--interface
(Set the network interface to be used)<name>
-
--privileged
(Assume that the user is fully privileged) Tells Nping to simply assume that it is privileged enough to perform raw socket sends, packet sniffing, and similar operations that usually require special privileges. By default Nping quits if such operations are requested by a user that has no root or administrator privileges. This option may be useful on Linux, BSD or similar systems that can be configured to allow unprivileged users to perform raw-packet transmissions. The
NPING_PRIVILEGED
environment variable may be set as an alternative to using--privileged
.-
--unprivileged
(Assume that the user lacks raw socket privileges) This option is the opposite of
--privileged
. It tells Nping to treat the user as lacking network raw socket and sniffing privileges. This is useful for testing, debugging, or when the raw network functionality of your operating system is somehow broken. TheNPING_UNPRIVILEGED
environment variable may be set as an alternative to using--unprivileged
.-
--send-eth
(Use raw ethernet sending) -
--send-ip
(Send at raw IP level) -
--bpf-filter
<filter spec>
--filter
(Set custom BPF filter)<filter spec>
This option lets you use a custom BPF filter. By default Nping chooses a filter that is intended to capture most common responses to the particular probes that are sent. For example, when sending TCP packets, the filter is set to capture packets whose destination port matches the probe's source port or ICMP error messages that may be generated by the target or any intermediate device as a result of the probe. If for some reason you expect strange packets in response to sent probes or you just want to sniff a particular kind of traffic, you can specify a custom filter using the BPF syntax used by tools like tcpdump. See the documentation at
http://www.tcpdump.org/
for more information.-
-H
,--hide-sent
(Do not display sent packets) -
-N
,--no-capture
(Do not attempt to capture replies)
-
-v[
,<level>
]--verbose [
(Increase or set verbosity level)<level>
] - Level -4
No output at all. In some circumstances you may not want Nping to produce any output (like when one of your work mates is watching over your shoulder). In that case level -4 can be useful because although you won't see any response packets, probes will still be sent.
- Level -3
Like level -4 but displays fatal error messages so you can actually see if Nping is running or it failed due to some error.
- Level -2
Like level -3 but also displays warnings and recoverable errors.
- Level -1
Displays traditional run-time information (version, start time, statistics, etc.) but does not display sent or received packets.
- Level 0
This is the default verbosity level. It behaves like level -1 but also displays sent and received packets and some other important information.
- Level 1
Like level 0 but it displays detailed information about timing, flags, protocol details, etc.
- Level 2
Like level 1 but displays very detailed information about sent and received packets and other interesting information.
- Level 3
Like level 2 but also displays the raw hexadecimal dump of sent and received packets.
- Level 4 and higher
Same as level 3.
-
-q[
,<level>
]--reduce-verbosity [
(Decrease verbosity level)<level>
] Decreases the verbosity level, causing Nping to print less information during its execution.
-
-d[
(Increase or set debugging level)<level>
] Debugging output is useful when you suspect a bug in Nping, or if you are simply confused as to what Nping is doing and why. As this feature is mostly intended for developers, debug lines aren't always self-explanatory. You may get something like
NSOCK (1.0000s) Callback: TIMER SUCCESS for EID 12; tcpconnect_event_handler(): Received callback of type TIMER with status SUCCESS
- Level 0
Level 0. No debug information at all. This is the default level.
- Level 1
In this level, only very important or high-level debug information will be printed.
- Level 2
Like level 1 but also displays important or medium-level debug information
- Level 3
Like level 2 but also displays regular and low-level debug information.
- Level 4
Like level 3 but also displays messages only a real Nping freak would want to see.
- Level 5
Like level 4 but it enables basic debug information related to external libraries like Nsock.
- Level 6
Like its authors, Nping isn't perfect. But you can help make
it better by sending bug reports or even writing patches. If Nping
doesn't behave the way you expect, first upgrade to the latest
version available from https://nmap.org
. If the problem persists,
do some research to determine whether it has already been
discovered and addressed. Try searching for the problem or error message on
Google since that aggregates so many forums. If nothing comes of this, create an Issue on our tracker
(http://issues.nmap.org
) and/or mail a bug report to
<dev@nmap.org>
. If you subscribe to the nmap-dev
list before posting, your message will bypass moderation and get
through more quickly. Subscribe at https://nmap.org/mailman/listinfo/dev
. Please include everything
you have learned about the problem, as well as what version of
Nping you are using and what operating system version it is
running on. Other suggestions for improving Nping may be sent to
the Nmap dev mailing list as well.
If you are able to write a patch improving Nping or fixing a
bug, that is even better! Instructions for submitting patches or
git pull requests are available from https://github.com/nmap/nmap/blob/master/CONTRIBUTING.md
Particularly sensitive issues such as a security reports may
be sent directly to Fyodor directly at
<fyodor@nmap.org>
. All other reports and comments
should use the dev list or issue tracker instead because more
people read, follow, and respond to those.
Authors
Luis MartinGarcia <luis.mgarc@gmail.com>
(http://www.luismg.com
)
Fyodor <fyodor@nmap.org>
(https://insecure.org
)