Install hping3 on Ubuntu 20.04

Install hping3 on Ubuntu 20.04

The hping3 is a tool that allows to analyze TCP/IP packets via command line. The hping3 can be used as alternative to the ping command. The hping3 allows to send not only ICMP echo requests but also TCP, UDP, and raw IP packets. The hping3 supports traceroute feature.

This tutorial demonstrates how to install hping3 on Ubuntu 20.04.

Install hping3

Update the package lists:

sudo apt update

Next, run the following command to install hping3:

sudo apt install -y hping3

When installation is finished, we can check hping3 version:

hping3 --version

Testing hping3

Now we can test. Let's say we want to check whether port 443 is open and calculate the round-trip time (RTT). Run the following command to do that:

sudo hping3 -S -p 443 -c 3 google.com

Example output:

HPING google.com (ens33 216.58.209.14): S set, 40 headers + 0 data bytes
len=46 ip=216.58.209.14 ttl=57 id=26097 sport=443 flags=SA seq=0 win=65535 rtt=25.5 ms
len=46 ip=216.58.209.14 ttl=57 id=44262 sport=443 flags=SA seq=1 win=65535 rtt=27.6 ms
len=46 ip=216.58.209.14 ttl=57 id=14503 sport=443 flags=SA seq=2 win=65535 rtt=25.8 ms

--- google.com hping statistic ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max = 25.5/26.3/27.6 ms

The -S option allows to set SYN flag, the -p option can be used to provide the port number of destination, the -c option defines packet count.

Uninstall hping3

If you wish to completely remove hping3 and related dependencies, run the following command:

sudo apt purge --autoremove -y hping3

Leave a Comment

Cancel reply

Your email address will not be published.