What is eBPF? A Beginner’s Guide

Alejandro Salamanca | Mar 24, 2025 min read

Introduction

eBPF stands for Extended Berkeley Packet Filter. It is a Linux kernel technology that allows developers to run code in kernel space. This means that developers can modify the behavior of the Linux kernel without changing its source code.

This groundbreaking technology is driving significant changes in how developers approach security, observability, and networking. Many major tech companies, including Meta (Facebook), Microsoft, cloudflare, and others, are leveraging eBPF to build innovative products that enhance performance, improve security, and provide deeper insights into system behavior.

Let’s explore in more detail how eBPF is transforming the industry.

What is eBPF?

Given its name, you might assume that eBPF is solely for packet filtering, making networking its primary use case. However, eBPF is far more powerful and versatile than that.

The origins of this technology trace back to the 1990s when its creators focused on capturing network packets, analyzing them, and making decisions based on predefined rules. Its design prioritized efficiency and lightweight execution, ensuring that only necessary packets were allowed into user space.

Fast forward to the 2010s, developers realized that eBPF’s capabilities extended beyond packet filtering. This is where the “extended” in eBPF comes from. The technology was enhanced to support a wide range of tasks, including filtering system calls, tracing events occurring in both kernel and user space, monitoring processes, and much more. This expansion unlocked new possibilities for security, observability, and system performance optimization.

How eBPF Programs Work

eBPF programs are event-driven, meaning they execute when a specific hook in the kernel or user space is triggered. There are numerous hooks available, including system calls, networking events, kernel tracepoints, and more. These hooks allow eBPF to provide deep insights and modifications to system behavior without altering kernel code.

eBPF programs for kernel space are typically written in C or Rust, while user-space interactions can be handled with a variety of languages, including Go, C++, Elixir, and others. The workflow involves compiling the C or Rust code into eBPF bytecode, which is then loaded into a kernel hook using the eBPF system call. You can find more details about the eBPF system call in the official kernel documentation.

Before an eBPF program is loaded into the kernel, it must pass through the verifier. This step is crucial because buggy or unsafe code in the kernel can lead to severe system instability. The verifier ensures that the eBPF program is safe to execute, preventing infinite loops, memory corruption, and other potential issues that could compromise system integrity.

Key Use Cases of eBPF

Currently, there are three primary use cases where eBPF has proven to be highly effective: security, observability, and networking. Each of these areas has seen significant advancements through eBPF, with major industry projects leveraging its capabilities. Let’s explore each use case with real-world examples.

Security

One of the primary use cases of eBPF in security is real-time runtime detection and anomaly detection. eBPF enables continuous monitoring of applications and system activity, allowing security teams to identify suspicious behavior as it happens.

Falco: Runtime Security Monitoring

An example of an eBPF-powered security tool is Falco, a project that enhances system security by monitoring application behavior. According to its official description:

“Falco is a behavioral activity monitor designed to detect anomalous activity in applications. Falco audits a system at the Linux kernel layer with the help of eBPF. It enriches gathered data with other input streams such as container runtime metrics and Kubernetes metrics, allowing continuous monitoring and detection of container, application, host, and network activity.”

Another project utilizing eBPF for security is Tetragon, which offers deep system observability and real-time runtime enforcement. Its official description states:

“Tetragon provides eBPF-based transparent security observability combined with real-time runtime enforcement. The deep visibility is achieved without requiring application changes and is provided at low overhead thanks to smart Linux in-kernel filtering and aggregation logic built directly into the eBPF-based kernel-level collector. The embedded runtime enforcement layer is capable of performing access control on kernel functions, system calls, and other enforcement levels.”

Both Falco and Tetragon demonstrate how eBPF is transforming security by enabling low-overhead, kernel-level monitoring and enforcement without modifying applications.

Observability

eBPF significantly enhances observability by allowing deep, low-overhead monitoring of system and application behavior. Since eBPF programs can attach to a variety of kernel hooks, they can capture critical metrics such as network traffic, packet contents, bandwidth usage, and system resource consumption. This makes eBPF a powerful tool for gaining real-time insights into system performance and health.

Retina: Kubernetes Network Observability

One example of an eBPF-powered observability tool is Retina, an open-source project from Microsoft designed for Kubernetes network monitoring. According to its official description:

“Retina is a cloud-agnostic, eBPF-based open-source Kubernetes network observability platform providing a centralized hub for monitoring application and network health and security. Retina collects customizable telemetry, which can be exported to multiple storage options and visualized in a variety of ways.”

OpenTelemetry eBPF Profiler: System-Wide Profiling

Another powerful observability use case for eBPF is system profiling. The OpenTelemetry eBPF Profiler aims to provide continuous, whole-system profiling with minimal performance overhead. Its official description states:

“The OpenTelemetry eBPF-based continuous profiler offers comprehensive, low-overhead whole-system profiling for Linux systems. It supports a wide range of programming languages, including native code without debug symbols, and provides deep insights into application behavior. By leveraging the experimental OTel profiling signals, this project empowers developers to identify performance bottlenecks and optimize their applications efficiently.”

These projects demonstrate how eBPF allows developers to collect rich telemetry data, providing better insights into network activity, resource usage, and application performance—all with minimal system impact.

Networking

Since eBPF was originally created to enhance networking capabilities, this remains one of its most prominent use cases. eBPF can be integrated into various parts of the networking stack, leveraging XDP (eXpress Data Path), TC (Traffic Control), and sockets to enable high-performance packet processing. This allows for advanced use cases such as firewalling, DDoS mitigation, and load balancing.

Katran: Meta’s High-Performance L4 Load Balancer

One example of eBPF’s impact in networking is Katran, Meta’s eBPF-powered Layer 4 load balancer. According to its official description:

“Katran is a C++ library and eBPF program to build a high-performance Layer 4 load balancing forwarding plane. Katran leverages the XDP infrastructure from the Linux kernel to provide an in-kernel facility for fast packet processing. Its performance scales linearly with the number of NIC’s receive queues, and it uses RSS-friendly encapsulation for forwarding to L7 load balancers.”

By leveraging eBPF, Katran allows Meta to achieve scalable, efficient load balancing without the need for traditional hardware-based solutions.

Cloudflare: eBPF for Firewalling and DDoS Mitigation

Cloudflare also utilizes eBPF to enhance network security and performance. They integrate eBPF into their Magic Firewall, which provides high-speed packet filtering and DDoS mitigation. This approach allows Cloudflare to process packets efficiently within the kernel, reducing latency and improving security enforcement. You can read more about their implementation in this Cloudflare blog post.

These examples highlight how eBPF is revolutionizing networking by providing low-latency, high-performance packet processing directly within the Linux kernel, eliminating the need for complex kernel modifications or expensive hardware solutions.

eBPF in the Cloud-Native Landscape

As demonstrated by the examples above, eBPF is widely used in the cloud-native ecosystem. Projects like Retina, Tetragon, Falco, and many others are being developed by major tech companies to enhance Kubernetes and other cloud technologies. One of the most well-known eBPF-powered cloud-native projects is Cilium.

Cilium: eBPF-Powered Kubernetes Networking

Cilium is a Kubernetes CNI (Container Network Interface) that replaces traditional networking tools like kube-proxy and iptables with eBPF, offering high-performance networking, security, and observability. Additionally, it integrates with Envoy to provide Layer 7 (L7) capabilities. According to its official description:

“Cilium is an open-source project that provides eBPF-powered networking, security, and observability. It has been specifically designed from the ground up to bring the advantages of eBPF to the world of Kubernetes and to address the new scalability, security, and visibility requirements of container workloads.”

The Future of eBPF in Cloud-Native Technologies

eBPF has the potential to fundamentally change how cloud-native applications are built, deployed, and managed. By allowing deep, real-time insights into system and application behavior, eBPF removes the inefficiencies of traditional Linux tools while maintaining performance, security, and scalability.

  • Scalability: Traditional tools like iptables struggle with large-scale container environments. eBPF provides a high-performance alternative by running directly in the kernel.
  • Security: With runtime enforcement and anomaly detection (e.g., Falco and Tetragon), cloud-native security is becoming more proactive and intelligent.
  • Observability: eBPF enables detailed insights into networking, application behavior, and system performance with minimal overhead.

As more cloud-native platforms integrate eBPF, we can expect a shift away from legacy networking and security tools, leading to faster, safer, and more efficient cloud environments.

Conclusion

eBPF is a rapidly growing technology that is transforming the way developers approach security, observability, and networking. With its high-performance capabilities and ability to run safely in the kernel, eBPF opens up new possibilities for building applications that provide deeper insights into system behavior.

However, developing eBPF programs comes with a steep learning curve, as it requires a solid understanding of kernel programming. Fortunately, many powerful open-source tools—built by leading developers and companies—are available, making it easier to leverage eBPF without writing low-level code.

If you want to learn more about eBPF, visit ebpf.io, where you’ll find extensive resources and documentation about this exciting technology.