Overview – hping3 commands
hping3 commands is a versatile network tool used for testing and auditing network security and performance. It can craft and send custom TCP/IP packets and analyze the responses. Below is a comprehensive guide to its commands and parameters.
Basic Command Syntax – hping3 commands
hping3 [options] [host]Commonly Used Options
1. Packet Type Options
- -1: ICMP mode (default is ping).
- -2: UDP mode.
- -3: RAW IP mode.
- -4: Use IPv4 (default).
- -6: Use IPv6.
2. TCP Specific Options
- -S: Set SYN flag.
- -A: Set ACK flag.
- -P: Set PUSH flag.
- -R: Set RST flag.
- -F: Set FIN flag.
- -U: Set URG flag.
- -X: Set XMAS flag (FIN, PSH, URG).
- -Y: Set YMAS flag (SYN, RST).
- –tcp-timestamp: Enable TCP timestamp option.
3. General Packet Options
- -p [port]: Set destination port.
- -s [port]: Set source port.
- -a [addr]: Spoof source address.
- -k: Keep the same source port (don’t increment).
- -n: Numeric output only, no resolution of hostnames.
- -d [size]: Set packet body size.
- -E [file]: Use a file as the packet payload.
- -e [signature]: Add a signature to the packet payload.
4. Advanced Options
- -c [count]: Stop after sending a specified number of packets.
- -i [interval]: Packet sending interval (e.g., u1000 for 1000 microseconds).
- –flood: Send packets as fast as possible.
- –rand-source: Use random source address.
- -q: Quiet mode, only show output on errors.
- –traceroute: Enable traceroute mode.
- –sign [signature]: Add signature to the packet.
5. Fragmentation and Other IP Options
- -f: Fragment packets.
- -x: Set the don’t fragment flag.
- -y: Set more fragments flag.
- –ttl [value]: Set time-to-live.
- -r: Record route.
Example hping3 Commands
Ping a Host with ICMP
Send ICMP echo requests to check if a host is reachable.
hping3 -1 google.com
Send TCP SYN Packets to a Specific Port
Perform a simple port scan by sending SYN packets.
hping3 -S -p 80 example.com
Perform a Traceroute
Traceroute to a host using ICMP packets to determine the route packets take.
hping3 --traceroute -V -1 google.com
Send UDP Packets to a Specific Port
Send UDP packets to test if a service is running on a specific port.
hping3 --udp -p 53 example.comFlood a Host with TCP SYN Packets
Send TCP SYN packets as fast as possible to simulate a DoS attack. Use with caution and only on networks you own or have permission to test.
hping3 -S -p 80 --flood example.comSend TCP Packets with Custom Flags
Send TCP packets with ACK, PUSH, and URG flags set to a specified host.
hping3 -A -P -U example.comMeasure Bandwidth
Measure the bandwidth between two points by sending packets at a controlled rate.
hping3 -1 -d 120 -i u10000 example.com

Test Firewall Rules
Send packets with specific characteristics to test if they pass through the firewall.
hping3 -S -p 80 -c 3 --tcp-timestamp example.comFragment Packets
Send fragmented packets to test how a network handles fragmentation.
hping3 -f -S -p 80 example.comRecord Route
Send packets and record the route they take through the network.
hping3 -r -S -p 80 example.comAdvanced Usage Scenarios – hping3 Commands
SYN Flooding
Simulate a SYN flood attack by sending a large number of SYN packets rapidly.
hping3 -S --flood -V -p 80 example.comSending Data from a File
Send the contents of a file as the payload of each packet.
hping3 -E payload.txt -d 100 -S -p 80 example.comSpoofing Source IP Address
Send packets with a spoofed source IP address to test network defenses.
hping3 -S -a 192.168.1.1 -p 80 example.comSummary – hping3 Commands
hping3 Commands is a highly versatile network tool used for security auditing, network testing, and performance measurement. It allows you to craft and send custom TCP/IP packets, providing detailed control over packet headers and options. While it offers powerful features, it requires a good understanding of networking concepts and responsible usage to avoid misuse. Mastering hping3 Commands can greatly enhance your ability to manage, secure, and optimize network infrastructure.
Useful Links
Enhance Network Security and Performance with hping3 commands: Packet Manipulation, Firewall Testing, and Intrusion Detection
This article provided insights on the topic. For latest updates and detailed guides, stay connected with Sanchit Gurukul.
Your feedback matters
Was this post helpful?
Discussion
0 approved comments
No approved comments yet. You can start the discussion below.
Leave a Comment
No login is required. Name and email are used for moderation/security. Your email is never displayed publicly. All comments require administrator approval.
Discover more from SanchitGurukul
Subscribe to get the latest posts sent to your email.