Skip to content

nping Linux Command Guide

Nping is a powerful tool for network packet generation, manipulation, and analysis in Linux. It allows users to send custom packets and perform various networking tasks such as host discovery, service scanning, and network inventory. Nping supports multiple protocols and options, making it a versatile choice for network administrators and security professionals.

nping Syntax:

Terminal window
nping [options] [target]

Options:

OptionDescription
-6Use IPv6 mode
-c Number of packets to send
-p Specify port number to use
-H Specify a target hostname
-S Specify source address
-TEnable IP Timestamp option
-vIncrease verbosity level
-VPrint version information
-hList available options and information

Parameters:

ParameterDescription
targetThe target host or IP address to ping

nping Command Samples:

Ping a Specific IP Address

Terminal window
nping 192.168.1.1

Pings the specific IP address “192.168.1.1” to test network connectivity.

Perform a TCP SYN Ping

Terminal window
nping --tcp -p 80 192.168.1.1

Performs a TCP SYN ping to port 80 on the IP address “192.168.1.1”.

UDP Ping to a Specific Port

Terminal window
nping --udp -p 53 192.168.1.1

Sends a UDP ping to port 53 on the IP address “192.168.1.1”.

Continuous Ping with Interval

Terminal window
nping --icmp -c 10 -i 1 192.168.1.1

Sends 10 ICMP ping packets with an interval of 1 second to the IP address “192.168.1.1”.

Ping Sweep of a Subnet

Terminal window
nping --tcp 192.168.1.0/24

Performs a ping sweep on all IP addresses within the subnet “192.168.1.0/24”.

Ping using IPv6 Address

Terminal window
nping -6 2001:db8::1

Sends ping packets using IPv6 address “2001:db8::1”.

DNS Query with Ping

Terminal window
nping --dns 8.8.8.8

Sends a DNS query to the DNS server at IP address 8.8.8.8 using ping.

nping FAQ:

How do I use nping in Linux?

To use the nping command in Linux, execute the following command:

Terminal window
nping --tcp -p 80 example.com

What is the purpose of nping in Linux?

The nping command in Linux is used for network packet generation, response analysis, and response time measurement.

Can nping be used for port scanning in Linux?

Yes, nping can be utilized for port scanning in Linux by specifying the desired ports using the -p option.

How can I perform a ping sweep using nping in Linux?

To conduct a ping sweep using nping in Linux, you can use the following command:

Terminal window
nping --icmp -sn 192.168.1.0/24

Is it possible to specify the packet size with nping in Linux?

Yes, you can specify the packet size when using nping in Linux by adding the --data option followed by the desired size in bytes.

How do I save the results of an nping scan to a file in Linux?

To save the results of an nping scan to a file in Linux, you can use output redirection as shown below:

Terminal window
nping 192.168.1.1 > scan_results.txt

Applications of the nping command

  • Network discovery
  • Host discovery
  • Port scanning
  • Packet generation and manipulation
  • Firewalking
  • OS fingerprinting
  • Service version detection
  • Firewall testing
  • Scriptable network testing with Lua