Install hping3 on Raspberry Pi

Install hping3 on Raspberry Pi

The hping3 is a command line tool that enables to analyze TCP/IP packets. The hping3 might 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 also provides traceroute feature.

This tutorial explains how to install hping3 on Raspberry Pi.

Connect to Raspberry Pi via SSH. Update the package lists and install hping3 with commands:

sudo apt update
sudo apt install -y hping3

When installation is complete, we can check version of hping3:

hping3 --version

Now we can test. For example, if we need to check whether port 443 is open and calculate the round-trip time (RTT), run the following command:

sudo hping3 -S -p 443 -c 3

The output will be similar to the following:

HPING (wlan0 S set, 40 headers + 0 data bytes
len=44 ip= ttl=53 id=39805 sport=443 flags=SA seq=0 win=65535 rtt=28.7 ms
len=44 ip= ttl=53 id=40136 sport=443 flags=SA seq=1 win=65535 rtt=48.6 ms
len=44 ip= ttl=50 id=2701 sport=443 flags=SA seq=2 win=65535 rtt=28.4 ms

--- hping statistic ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max = 28.4/35.2/48.6 ms

The -S option sets SYN flag, the -p option is used to set the port number of destination, the -c option defines packet count.

If you want to completely remove hping3 and related dependencies, execute this command:

sudo apt purge --autoremove -y hping3

Leave a Comment

Cancel reply

Your email address will not be published.