Network & delivery

5 min readUpdated

Layer 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.

Layer 7 — applicationmethod · path · headers · body · client behaviourHTTP onlyLayer 4 — transportTCP · UDP · ports · connection stateany protocolLayer 3 — networkIP addresses · routing · packet rateany protocol
Layer 3/4 filtering sees packets; Layer 7 sees the request. Each stops attacks the other cannot.

02Side by side

Layer 3/4Layer 7
SeesAddresses, ports, packet ratesMethod, path, headers, body, client
ProtocolsAny — TCP, UDP, ICMP, customHTTP and HTTPS only
StopsVolumetric and protocol floodsExploits, bots, credential stuffing, scraping
DeliveryRouting / GRE tunnelDNS change to a reverse proxy
Typical forGame servers, mail, VPN, custom servicesWebsites, shops, APIs
Can challenge clientsNo — packets cannot be asked questionsYes — 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.

AttackLayerWhat it exhaustsStopped by
UDP and DNS amplification3/4Uplink bandwidthUpstream capacity and filtering
SYN flood4Half-open connection tableSYN cookies, edge filtering
ACK flood4Packet processing, stateful firewallsStateful filtering upstream
Ping flood3Bandwidth and packet rateICMP rate limits upstream
HTTP flood7Application workers, databaseReverse proxy, caching, challenges
Slowloris7Web server connection slotsA proxy that buffers whole requests
HTTP/2 Rapid Reset7Server stream handlingPatched servers, HTTP-aware proxies
Credential stuffing7Login backend, user accountsBot 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.

ServiceProtocolProtection that fits
Website, shop, CMSHTTPS (TCP 443)Layer 7 reverse proxy, whose network also absorbs floods aimed at it
REST or GraphQL APIHTTPSLayer 7, with limits per key or route
Minecraft JavaTCP 25565Layer 3/4, or a TCP proxy in front of the server
Bedrock, FiveM and most game serversUDP for play; FiveM and newer Bedrock clients also use TCPLayer 3/4 filtering that understands UDP and TCP; see DDoS protection for game servers
MailTCP 25, 587, 993Layer 3/4
VPN such as WireGuardUDPLayer 3/4
Authoritative DNSUDP and TCP 53Layer 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.

Read-only checks (tcpdump 4.99.3 filters compiled with tcpdump -d; ip, ss and nstat from iproute2 6.1.0; awk run against a sample log; Debian 12)
# 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 | head

07How 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

No. It will absorb volumetric floods, but application-layer attacks — expensive queries, credential stuffing, scraping — arrive as normal-looking HTTPS at ordinary rates and pass straight through a packet filter.

Not usefully. Game traffic is typically UDP and has no HTTP for the proxy to read. Game servers need packet-level filtering, generally over a GRE tunnel.

For the website it fronts, in practice yes: floods aimed at the proxy's addresses land on the provider's network, and your origin address is not published. It does nothing for other services on the same server, such as a game port, which attackers can still hit if they know the address.

Not necessarily. Using one provider for both means one panel, one bill and one set of policies, rather than two vendors pointing at each other during an incident. Check that both are actually available today, because Layer 3/4 transit is often sold separately from web protection.

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.

  1. 01RFC 1122: Requirements for Internet Hosts (section 1.1.3, layers) · IETF
  2. 02Google Cloud mitigated largest DDoS attack, peaking above 398 million rps · Google Cloud
  3. 03DDoS threat report for 2025 Q4 · Cloudflare
  4. 04RFC 4987: TCP SYN Flooding Attacks and Common Mitigations · IETF
  5. 05Geyser setup: ports and NetherNet (Bedrock over TCP and UDP) · GeyserMC

Last updated