Network & delivery
5 min readUpdatedLayer 3/4 vs Layer 7 protection: what is the difference?
Quick answer
Layer 3/4 protection works on packets: it sees addresses, ports and traffic volume, and can filter any protocol including UDP, but it cannot read what a request means. Layer 7 protection terminates the HTTP connection and inspects the full request, so it can identify an exploit or a bot but only works for web traffic. Which you need follows directly from what you are protecting — a website is a Layer 7 problem, a game server is a Layer 3/4 problem, and many businesses have both.
01What the layers mean
The numbers come from the OSI model, which describes networking as a stack. Layer 3 is the network layer, where IP addresses live and routing decisions are made. Layer 4 is the transport layer — TCP and UDP, ports, and the notion of a connection. Layer 7 is the application layer, where protocols like HTTP live and a request has a method, a path and headers.
The internet itself runs on the simpler TCP/IP model in RFC 1122, which has link, internet, transport and application layers, but the security industry kept the OSI numbers as shorthand.
Protection at a given layer can only reason about what that layer exposes. A Layer 3/4 filter can see that an address is sending 400,000 packets a second to port 443 and act on it. It cannot see that the request is POST /login with a stolen password, because at that layer the payload is opaque bytes.
02Side by side
| Layer 3/4 | Layer 7 | |
|---|---|---|
| Sees | Addresses, ports, packet rates | Method, path, headers, body, client |
| Protocols | Any — TCP, UDP, ICMP, custom | HTTP and HTTPS only |
| Stops | Volumetric and protocol floods | Exploits, bots, credential stuffing, scraping |
| Delivery | Routing / GRE tunnel | DNS change to a reverse proxy |
| Typical for | Game servers, mail, VPN, custom services | Websites, shops, APIs |
| Can challenge clients | No — packets cannot be asked questions | Yes — a browser can solve a check |
03Which attacks hit which layer
Record attacks show why both layers matter, and why they are quoted in different units, as bps vs pps vs rps explains. The HTTP/2 Rapid Reset attack peaked at 398 million requests per second against Google Cloud in August 2023, far above the 46 million rps record of the year before. At the network layer, Cloudflare's report for the fourth quarter of 2025 recorded a 31.4 Tbps flood, and network-layer attacks made up 78% of the attacks it mitigated in that quarter.
| Attack | Layer | What it exhausts | Stopped by |
|---|---|---|---|
| UDP and DNS amplification | 3/4 | Uplink bandwidth | Upstream capacity and filtering |
| SYN flood | 4 | Half-open connection table | SYN cookies, edge filtering |
| ACK flood | 4 | Packet processing, stateful firewalls | Stateful filtering upstream |
| Ping flood | 3 | Bandwidth and packet rate | ICMP rate limits upstream |
| HTTP flood | 7 | Application workers, database | Reverse proxy, caching, challenges |
| Slowloris | 7 | Web server connection slots | A proxy that buffers whole requests |
| HTTP/2 Rapid Reset | 7 | Server stream handling | Patched servers, HTTP-aware proxies |
| Credential stuffing | 7 | Login backend, user accounts | Bot management, rate limits |
04Which one do you need?
If the thing you are protecting is reached by a browser or an HTTP client — a website, a shop, an API — Layer 7 protection is both necessary and sufficient. You point DNS at a reverse proxy and it inspects everything.
If it is reached by anything else — a game client on a UDP port, a mail server on 25, a VPN endpoint, a custom binary protocol — Layer 7 cannot help, because there is no HTTP to inspect. You need packet-level filtering in front of the machine, usually delivered over a GRE tunnel so your server's real address never appears in public routing.
Many businesses need both, and they compose cleanly: the website runs through the HTTP proxy while the game or voice servers run through filtered transit.
05What common services need
In every case the protocol decides it. TCP and UDP behave differently under attack, and a UDP service cannot be put behind an HTTP proxy at all. For a worked TCP example, see protecting a Minecraft server from DDoS.
| Service | Protocol | Protection that fits |
|---|---|---|
| Website, shop, CMS | HTTPS (TCP 443) | Layer 7 reverse proxy, whose network also absorbs floods aimed at it |
| REST or GraphQL API | HTTPS | Layer 7, with limits per key or route |
| Minecraft Java | TCP 25565 | Layer 3/4, or a TCP proxy in front of the server |
| Bedrock, FiveM and most game servers | UDP for play; FiveM and newer Bedrock clients also use TCP | Layer 3/4 filtering that understands UDP and TCP; see DDoS protection for game servers |
| TCP 25, 587, 993 | Layer 3/4 | |
| VPN such as WireGuard | UDP | Layer 3/4 |
| Authoritative DNS | UDP and TCP 53 | Layer 3/4, plus DNS-aware rate limiting |
06How to tell which layer is under attack
During an incident, four quick measurements usually settle it: is the link full, is the connection table full, which packets dominate, and is the application busy? Replace eth0 with your interface and access.log with your web server's log in the common combined format.
# 1. Link: packet and byte counters; run twice a few seconds apart and compare
ip -s link show dev eth0
# 2. Connections: half-open sockets and SYN cookie activity
ss -Htn state syn-recv | wc -l
nstat -az TcpExtSyncookiesSent TcpExtListenOverflows
# 3. Packets: SYNs without ACK, or UDP from common reflection ports
tcpdump -nni eth0 -c 2000 'tcp[tcpflags] & (tcp-syn|tcp-ack) == tcp-syn'
tcpdump -nni eth0 -c 2000 'udp and (src port 53 or src port 123 or src port 389 or src port 1900 or src port 11211)'
# 4. Application: busiest seconds, then most requested paths without query strings
awk '{print substr($4, 2, 20)}' access.log | uniq -c | sort -rn | head
awk '{split($7, p, "?"); print p[1]}' access.log | sort | uniq -c | sort -rn | head07How Layer 3/4 protection is delivered
Because packets cannot simply be pointed somewhere with a DNS record, Layer 3/4 protection changes routing instead. The usual mechanism is a GRE tunnel: a virtual point-to-point link between the scrubbing network and your server.
Traffic for your protected addresses arrives at the provider, is filtered there, and the clean remainder is encapsulated and delivered to your machine through the tunnel. Your server replies either through the tunnel or directly, depending on the set-up. Either way, the address the world sees belongs to the provider, and your real address stays hidden. The delivery options are compared in remote DDoS protection explained.
Questions
Frequently asked questions
Sources
Sources and verification
tcpdump filters compiled with tcpdump 4.99.3 (libpcap 1.10.3) using tcpdump -d; ip, ss and nstat (iproute2 6.1.0) commands run; awk pipelines run with GNU Awk 5.2.1 against a sample access log in combined format. Debian 12, October 2026.
- 01RFC 1122: Requirements for Internet Hosts (section 1.1.3, layers) · IETF
- 02Google Cloud mitigated largest DDoS attack, peaking above 398 million rps · Google Cloud
- 03DDoS threat report for 2025 Q4 · Cloudflare
- 04RFC 4987: TCP SYN Flooding Attacks and Common Mitigations · IETF
- 05Geyser setup: ports and NetherNet (Bedrock over TCP and UDP) · GeyserMC
Last updated