Stress Testing
hping3 is a command-line network tool for crafting, sending, and analyzing custom TCP/IP packets. Built for firewall testing, port scanning, OS fingerprinting, path MTU discovery, and authorized stress testing, it gives you control over nearly every field of the TCP, UDP, ICMP, and raw IP headers — the flags, sequence numbers, window size, TTL, fragmentation, and payload — and then shows you exactly how the target answers. Where Nmap runs predefined scan types, hping3 is the packet workbench you reach for when the question is "what does the firewall do with THIS exact packet?" It runs on raw sockets (so it needs root), supports scan and listen modes, and includes a Tcl scripting engine for automating protocol experiments in a lab.
sudo apt install hping3
hping3 [options] <target>
hping3 is a powerful command-line packet crafting tool that enables security professionals to construct and send custom TCP/IP packets. Unlike Nmap which follows predefined scanning patterns, hping3 gives full control over every packet field including flags, sequence numbers, window sizes, and payload content.
hping3 is widely used for firewall rule testing, port scanning, operating system fingerprinting, network performance measurement, and authorized stress testing. Its ability to craft arbitrary packets makes it invaluable for testing how network devices handle unusual or malformed traffic.
The tool supports TCP, UDP, ICMP, and RAW-IP protocols, with features for fragmentation, source IP spoofing, port scanning, and flood generation. It also includes a Tcl-based scripting engine for automated testing scenarios.
The mental model is simple: hping3 builds exactly one packet at a time, exactly the way you describe it, and then listens. You choose the protocol (TCP by default, UDP with -2, ICMP with -1, raw IP with -0), the flags (-S for SYN, -A for ACK, -F, -R, -P, -U, or combinations like the -X Xmas tree), the ports (-p for destination, -s for source), and the fine print most tools hide from you — TTL (-t), IP ID, fragmentation (-f, --mtu, --dontfrag), TCP window (-w), sequence and acknowledgment numbers (-M and -L), and an optional payload (-d for size, -E to load it from a file). The reply — or the silence — tells you how every device on the path treated that specific packet.
That precision is why hping3 survives in a world that already has Nmap. Nmap answers "which ports are open and what is running?" hping3 answers the follow-up questions a scanner cannot: does the firewall drop unsolicited ACK packets or pass them to the host? Does the IDS reassemble fragments before inspection? Is this port filtered, or is the service just slow to answer? Does the target's TCP stack hand out predictable sequence numbers or IP IDs? Firewall validation, anti-spoofing checks, MTU discovery, and stack fingerprinting are all hping3 home turf.
hping3 also has two personalities beyond probing. Scan mode (-8 with --scan) sweeps a port list with your crafted packet type. Listen mode (-9 with --listen and an -e signature) turns it into a patient receiver that only wakes up for packets carrying a secret string in the payload — a classic lab demonstration of covert channels and of moving a file across a network that was supposed to block it. Add the built-in Tcl scripting engine and APD (Annotated Packet Dump) descriptions, and hping3 becomes a small protocol laboratory rather than a single-purpose scanner. Treat it with respect: it needs root, it is loud on any monitored network, and its --flood mode exists for authorized stress tests only.
| Command | Purpose |
|---|---|
hping3 --version | Print the installed version. |
hping3 --help | Display locally supported flags. |
hping3 -1 -c 3 192.0.2.10 | Send three ICMP probes to TEST-NET-1. |
hping3 -S -p 443 -c 3 192.0.2.10 | Send three TCP SYN probes to port 443. |
hping3 -S -p 80 targetSYN packet to port 80 — Test port responsehping3 --flood -S -p 80 targetSYN flood — Stress testing (authorized)hping3 -1 targetICMP ping — Basic connectivityhping3 -S --scan 1-1000 targetPort scan — Find open portshping3 -S -p 80 --spoof 1.2.3.4 targetSpoofed source — Test firewall ruleshping3 -A -p 80 targetACK scan — Probe stateful firewall inspection behaviorhping3 -2 -p 53 targetUDP mode — Send UDP packets to test port 53 (DNS)hping3 -F -P -U -p 80 targetXmas scan — Set FIN, PUSH, and URG flags togetherhping3 -S -p ++1 -c 100 targetIncrementing port — Increase destination port by 1 for each packethping3 -1 -C 8 targetICMP type — Send ICMP echo requests (type 8) explicitlyhping3 -S -p 80 --tcp-timestamp targetTCP timestamp — Estimate target uptime from timestampshping3 --flood -S -p 80 --rand-source targetRandomized flood — SYN flood with random spoofed sources (authorized)hping3 -S -p 80 -f targetFragmentation — Split packets to test IDS/firewall handlinghping3 -1 -d 65495 targetLarge ICMP — Send oversized ICMP payload (ping-of-death style test)hping3 -S -p 80 -a 10.0.0.5 targetFixed spoof — Set a specific spoofed source addresshping3 --traceroute -V -1 targetTraceroute — Map the network path using ICMP with verbose outputhping3 -Q -S -p 443 targetSequence sampling — Collect the TCP sequence numbers a target returns, useful for predictability analysishping3 -2 -p 161 targetUDP probe — Send a UDP packet to port 161 (SNMP); an ICMP port-unreachable reply means the port is closedhping3 --icmp-ts targetICMP timestamp — Send an ICMP timestamp request (type 13) to learn the target's clock and check it answers ICMPhping3 -9 --listen signature -e signature targetListen mode — Wait silently for packets carrying a signature payload (covert-channel and file-transfer lab technique)hping3 -S -p 80 -t 5 targetCustom TTL — Set the IP time-to-live to 5 to test how far a packet travels before expiringhping3 -S -p 80 --dontfrag --mtu 28 targetMTU test — Force small fragments with a virtual MTU to probe path MTU and fragment reassembly behaviorhping3 -S -p 80 -d 120 -E payload.txt targetFile payload — Send a 120-byte packet whose data is loaded from a file with --filehping3 -S -p 80 -M 1000 -L 0 targetFixed seq/ack — Set exact sequence (1000) and acknowledgment (0) numbers to test stateful inspection edge casesVerify firewall rules by sending custom packets with specific flags, ports, and source addresses.
Assess open ports using SYN, ACK, FIN, or NULL scans with full control over packet headers.
Simulate denial-of-service conditions with SYN floods, ICMP floods, or custom flood patterns.
Identify target operating systems by analyzing responses to crafted TCP/IP packets.
Validate anti-spoofing firewall rules by sending packets with forged source IP addresses.
Discover maximum transmission unit along network paths using fragmented packets.
Demonstrate and detect data hidden inside allowed protocols using listen mode with signature payloads.
Measure round-trip time and packet loss over TCP, UDP, or ICMP where normal ping is blocked.
Send packets with different TCP flags to verify which are allowed or blocked. For example, hping3 -S -p 80 10.10.10.10 tests if SYN packets reach port 80, while hping3 -A -p 80 10.10.10.10 probes stateful inspection behavior with ACK packets. Compare responses across flag combinations to map the full rule set.
hping3 gives you raw packet crafting control over every TCP/IP field, while Nmap provides automated scanning with predefined scan types. Use hping3 when you need to test specific firewall rules, craft custom probes, or analyze TCP/IP stack behavior at the packet level. Use Nmap for comprehensive host discovery and service detection.
Use the --traceroute flag with a protocol mode. For example, hping3 --traceroute -V -1 10.10.10.10 performs an ICMP traceroute with verbose output. You can also use TCP traceroute with --traceroute -V -S -p 80 to trace through firewalls that block ICMP.
Yes, hping3 requires root or sudo access because it creates raw sockets to craft custom packets. Running without sudo produces permission denied errors. Always run hping3 with sudo: sudo hping3 -S -p 80 10.10.10.10.
Send fragmented packets with the -f flag and set DF (Don't Fragment) bit to discover the maximum transmission unit along a path. Use hping3 -S -p 80 -f 10.10.10.10 and observe ICMP Fragmentation Needed responses to determine the MTU limit.
hping3 can perform rudimentary OS fingerprinting by analyzing TCP/IP stack responses. Use the -O flag to enable OS detection mode, and examine differences in TTL, window size, TCP options, and response patterns to identify the target operating system.
Use ICMP mode against each host: sudo hping3 -1 -c 2 192.168.1.10 sends two echo requests and reports replies with round-trip times. For a whole subnet, testers usually script hping3 in a loop or use Nmap's -sn ping scan, then return to hping3 for the hosts that need a closer, packet-level look.
hping3 does not magically bypass firewalls — it reveals how a firewall treats unusual packets. Fragmented probes, unexpected flag combinations, and spoofed sources sometimes expose rules that were written too narrowly, which is exactly what a firewall test is meant to find so the rules can be fixed. On a correctly configured stateful firewall, crafted packets are dropped like any other unauthorized traffic.
Stress Testing
GoldenEye is an HTTP denial-of-service testing tool that utilizes KeepAlive and NoCache headers to simulate heavy concurrent traffic and test web server resilience.
Stress Testing
Slowloris is a denial-of-service tool that allows a single machine to test a web server's resilience against resource exhaustion by keeping numerous HTTP connections open with partial requests.
Information Gathering
Learn how to use Nmap, the free open-source network scanner: run your first port scan, discover live hosts, detect services and operating systems, and check for vulnerabilities with NSE scripts — a beginner tutorial for Kali Linux.
Sniffing & Spoofing
tcpdump is a powerful, lightweight command-line packet analyzer that allows users to capture, parse, and filter TCP/IP and other packets transmitted or received over a network.
Sniffing & Spoofing
Wireshark tutorial for beginners: capture packets, read the three panes, filter traffic and follow TCP streams — a hands-on guide to the world's foremost network protocol analyzer.
Maintaining Access
WireGuard is an extremely fast, modern VPN protocol that lives inside the Linux kernel and uses state-of-the-art cryptography — Curve25519 key exchange, ChaCha20Poly1305 encryption, and the Noise protocol framework — in a core codebase of only a few thousand lines. In penetration testing and red team work it creates secure, persistent tunnels for pivoting into internal networks and maintaining encrypted access, while system administrators use the same tool for site-to-site links and road-warrior VPNs. Every peer is identified by a single public key, traffic is bound to that key by cryptokey routing (AllowedIPs), and the protocol stays completely silent toward unauthenticated packets, which makes a WireGuard port nearly invisible to scanners.
Master advanced Nmap scanning techniques including NSE scripting, firewall evasion, performance tuning, and custom scan types for professional penetration testing.
Networking · IntermediateLearn firewall types, architectures, rule configuration, and best practices for network security and traffic filtering.
Networking · IntermediateAn in-depth exploration of DNS architecture, resolution process, record types, caching, security threats, and privacy protocols like DoH and DoT.
Networking · BeginnerHow to use WireGuard: install it on Kali Linux, build your first tunnel, verify it with wg show, and fix common problems — cheat sheet and 31 FAQs.
Every reply hping3 receives is printed as one line, and reading that line fluently is the core skill. A typical SYN probe looks like this: "HPING 192.168.1.10 (eth0 192.168.1.10): S set, 40 headers + 0 data bytes" announces the mode (S = SYN flag set) and packet size. Each answer then appears as "len=46 ip=192.168.1.10 ttl=64 DF id=0 sport=443 flags=SA seq=0 win=29200 rtt=0.4 ms". Break it down field by field: len is the reply size in bytes; ip is the answering host; ttl is the remaining time-to-live, a rough hint at hop count and OS family (64 is typical of Linux, 128 of Windows); DF means the Don't Fragment bit was set; id is the IP identification value (watch whether it increments predictably across replies — that is what idle-scan and fingerprinting techniques analyze); sport is the source port the reply came from, i.e. the port you probed; flags is the heart of the line — SA (SYN+ACK) means the port is open, RA (RST+ACK) means closed, and no line at all means your packet was dropped or filtered; seq is the reply counter, win is the advertised TCP window size (another OS fingerprinting clue), and rtt is the round-trip time in milliseconds. For ICMP mode the line changes shape: "len=46 ip=192.168.1.1 ttl=64 id=51234 icmp_seq=0 rtt=0.5 ms". When you stop hping3 with Ctrl+C it prints a statistics block — "--- 192.168.1.10 hping statistic --- 10 packets transmitted, 9 packets received, 10% packet loss, round-trip min/avg/max" — which is the quickest health check of the path: packet loss or a wide min/max rtt spread points at congestion or rate limiting between you and the target.
This tool is designed for authorized security testing, educational purposes, and legitimate network administration only. Unauthorized access to computer systems is illegal.