NOC online · 24/7Longview, TX · +1 323 412 0665
KinetikatechServers · Security · Websites
CS

Tento podrobný průvodce je k dispozici v angličtině.

English version

Next-Gen Server Administration and Cloud Workloads

Hardening Linux Kernel Network Interfaces Against Massive Volumetric DDoS Floods via Custom XDP Drivers

Volumetric DDoS attacks overwhelm servers with millions of packets per second. Traditional iptables cannot keep up because it processes in the network stack. XDP (eXpress Data Path) drops malicious packets at the driver level, before they reach the kernel. This guide deploys XDP for DDoS mitigation.

Klíčové body

  • Understand XDP. It runs eBPF programs at the NIC driver level, before the kernel network stack.
  • Choose the XDP mode. Native mode is fastest but requires driver support; generic mode works everywhere but is slower.
  • Write drop rules. Filter by packet rate, source IP, and protocol to identify and drop attack traffic.
  • Use XDP_REDIRECT for scrubbing. Redirect suspicious traffic to a scrubbing service instead of dropping outright.
  • Monitor with metrics. Export XDP drop counts to Prometheus for visibility.
  • Handle legitimate traffic. Ensure rules do not block real users during an attack.
  • Test under load. Use traffic generators to verify XDP handles the expected packet rate.
  • Plan for escalation. XDP handles millions of pps; for larger attacks, use upstream scrubbing.

Architecture

XDP programs attach to the NIC driver and inspect each packet before it enters the kernel. Malicious packets are dropped immediately, consuming minimal CPU. Legitimate packets pass to the network stack normally. Metrics are exported for monitoring.

Production configuration

XDP drop program c
#include <linux/bpf.h>
#include <bpf/bpf_helpers.h>

SEC("xdp")
int xdp_drop(struct xdp_md *ctx) {
    void *data = (void *)(long)ctx->data;
    void *data_end = (void *)(long)ctx->data_end;
    struct ethhdr *eth = data;
    if ((void *)(eth + 1) > data_end) return XDP_PASS;
    // drop UDP floods from a single source
    if (eth->h_proto == __constant_htons(ETH_P_IP)) {
        struct iphdr *ip = data + sizeof(*eth);
        if ((void *)(ip + 1) > data_end) return XDP_PASS;
        if (ip->protocol == IPPROTO_UDP) return XDP_DROP;
    }
    return XDP_PASS;
}
char _license[] SEC("license") = "GPL";
Load and attach XDP program bash
clang -O2 -target bpf -c xdp_drop.c -o xdp_drop.o
ip link set dev eth0 xdp obj xdp_drop.o sec xdp

# verify
ip link show eth0 | grep xdp
# check drops
bpftool prog show
# unload
ip link set dev eth0 xdp off
Monitor XDP metrics bash
bpftool map show
# export to Prometheus via xdp_exporter
xdp_exporter --interface eth0 --port 9101
# check metrics
curl -s localhost:9101/metrics | grep xdp_drop

Edge cases from production

  • Native XDP requires driver support; check with ethtool before relying on it.
  • XDP programs have a 1M instruction limit; complex logic must be split.
  • Dropping all UDP breaks DNS and QUIC; filter by rate and source, not protocol alone.
  • XDP and tc can conflict; use one or the other for a given interface.

Časté dotazy

How many pps can XDP handle?

Millions per second on modern hardware, far exceeding iptables.

Does XDP work with all NICs?

Native mode requires driver support; generic mode works everywhere but is slower.

Can XDP do stateful filtering?

Limited state via eBPF maps, but complex stateful logic is better in the network stack.

How do I update rules without downtime?

Use eBPF map updates to change rules dynamically without reloading the program.

What is the main limitation?

No connection tracking; XDP is stateless by design.

Jak Kinetikatech pomáhá s next-gen server administration and cloud workloads

Upřímně, většina týmů se na nás obrací poté, co to nejdřív zkusila sama: Kernel tuning, eBPF data planes, and service meshes for fleets that cannot afford downtime. Naše služba Správa serverů a Zabezpečení linuxových serverů je tu proto, abyste next-gen server administration and cloud workloads nepoznávali na vlastní kůži; my se postaráme o zprovoznění, dohled a překvapení ve tři ráno.

Promluvte si s inženýrem

Problém se serverem? Hacknutý web? Pomalé načítání?

Kritické problémy vyřešeny do 30 minut — nepřetržitě, 7 dní v týdnu.

Požádat o pohotovostní podporu support@kinetikatech.com