SlideShare a Scribd company logo
CILIUM: NETWORK AND
APPLICATION SECURITY
WITH BPF AND XDP
Thomas Graf
Co-founder & CTO
Covalent
Who is this guy?
Helped build the
biggest monolith
ever …
Who is this guy?
Helped build the
biggest monolith
ever …
Who is this guy?
Time to rethink the kernel
syscalls syscalls
Net IOBlock IO
Time to rethink the kernel
Time to rethink the kernel
From monolith to “microkernel” with BPF
syscalls syscalls
BPF
BPF
BPF
BPF
Net IOBlock IO
Time to rethink the kernel
From monolith to “microkernel” with BPF
syscalls syscalls
BPF
BPF
BPF
BPF
BPF
BPF
Security
Networking
Net IOBlock IO
BPF is revolutionizing…
• Tracing / Profiling
BPF is revolutionizing…
• Tracing / Profiling
Container	Performance	
Analysis
Brendan	Gregg
Wed	1:30pm	“Black	Belt”
BPF is revolutionizing…
• Tracing / Profiling
• Networking
Container	Performance	
Analysis
Brendan	Gregg
Wed	1:30pm	“Black	Belt”
BPF is revolutionizing…
• Tracing / Profiling
• Networking
• Security
Container	Performance	
Analysis
Brendan	Gregg
Wed	1:30pm	“Black	Belt”
Application
Architectures
Delivery Frequency
Operational
Complexity
Single Server
App
Yearly
Low
Delivery Frequency
Application
Architectures
Delivery Frequency
Operational
Complexity
Single Server
App
Yearly
Low
3-Tier App
Monthly
Moderate
Delivery Frequency
Application
Architectures
Delivery Frequency
Operational
Complexity
Single Server
App
Yearly
Low
Distributed
Microservices
10-100 x’s / day
Extreme
3-Tier App
Monthly
Moderate
Delivery Frequency
Network Security
has not evolved
$ iptables -A INPUT -p tcp 
-s 15.15.15.3 --dport 80 
-m conntrack --ctstate NEW 
-j ACCEPT
The world still runs on iptables
matching IPs and ports:
Your HTTP ports be like …
Network Security
for Microservices
Example
Gordon is
looking for
a job…
Gordon Job Postings
Example: Security for Microservices
GET /healthz
GET /jobs/{id}
PUT /jobs/{id}
POST /jobs
API
Gordon Job Postings
Example: Security for Microservices
GET /healthz
GET /jobs/{id}
PUT /jobs/{id}
POST /jobs
API
GET /jobs/331
Gordon Job Postings
Example: Security for Microservices
L3/L4
GET /healthz
GET /jobs/{id}
PUT /jobs/{id}
POST /jobs
API
iptables -s 10.1.1.1
-p tcp --dport 80
-j ACCEPT
GET /jobs/331
Gordon Job Postings
Example: Security for Microservices
L3/L4
GET /healthz
GET /jobs/{id}
PUT /jobs/{id}
POST /jobs
API
exposed
exposed
exposed
GET /jobs/331
Gordon Job Postings
Example: Security for Microservices
iptables -s 10.1.1.1
-p tcp --dport 80
-j ACCEPT
Not exactly
least privilege
Security team is
not amused
GET /healthz
GET /jobs/{id}
PUT /jobs/{id}
POST /jobs
API
GET /jobs/331
Gordon Job Postings
Example: Security for Microservices
L3/L4
GET /healthz
GET /jobs/{id}
PUT /jobs/{id}
POST /jobs
API
FROM Gordon
ALLOW GET /jobs/.*
GET /jobs/331
Gordon Job Postings
Example: Security for Microservices
We demand
a demo
BPF - The
Superpowers
inside Linux
SANDBOX
BPF
GET /foo
BPF: Transparent redirection into proxy
SANDBOX
BPF
Proxy
GET /foo
redirect
rules
sk
BPF: Transparent redirection into proxy
SANDBOX
BPF
Proxy
GET /foo
redirect
rules
sk
Shared State
• Orig Dest IP
• Identity
BPF: Transparent redirection into proxy
SANDBOX
BPF
Proxy
GET /foo
redirect
reinject
rules
sk sk
Shared State
• Orig Dest IP
• Identity
BPF: Transparent redirection into proxy
SANDBOX
BPF
Proxy
GET /foo
rules
BPF: Transparent redirection into proxy
sk sk
403
Access
Denied
So what is BPF exactly?
.insns = {
BPF_MOV64_REG(BPF_REG_2, BPF_REG_10),
BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, -8),
BPF_ST_MEM(BPF_DW, BPF_REG_2, 0, 0),
BPF_LD_MAP_FD(BPF_REG_1, 0),
BPF_EMIT_CALL(BPF_FUNC_map_lookup_elem),
BPF_MOV64_REG(BPF_REG_1, BPF_REG_10),
BPF_ALU64_IMM(BPF_ADD, BPF_REG_1, -152),
BPF_STX_MEM(BPF_DW, BPF_REG_1, BPF_REG_0, 0),
BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, 0, 2),
BPF_LDX_MEM(BPF_DW, BPF_REG_3, BPF_REG_1, 0),
BPF_ST_MEM(BPF_DW, BPF_REG_3, 0, 42),
BPF_EXIT_INSN(),
}
What is
BPF?
Learn more about BPF: docs.cilium.io
BPF: Toolchain – from user to kernel
USER SPACE
SOURCE CODE [C]
</>
BPF: LLVM compiles program code to bytecode
USER SPACE
SOURCE CODE [C]
</>
BYTE CODE [BPF]
</>
BPF: Bytecode is loaded and verified into kernel
USER SPACE
KERNELVERIFIER +
JIT
SOURCE CODE [C]
</>
BYTE CODE [BPF]
</>
BPF: Bytecode runs inside safe kernel sandbox
USER SPACE
KERNELVERIFIER +
JIT
SOURCE CODE [C]
</>
BYTE CODE [BPF]
</>
SANDBOX
BPF
BPF: Program is attached to event (packet-in)
USER SPACE
KERNELVERIFIER +
JIT
SOURCE CODE [C]
</>
BYTE CODE [BPF]
</>
SANDBOX
BPF
BPF: Program can redirect to netns & sockets
USER SPACE
KERNELVERIFIER +
JIT
SOURCE CODE [C]
</>
BYTE CODE [BPF]
</>
SANDBOX
BPF
BPF – An opportunity
to rethink security
policy enforcement
Status Quo: Policy Enforcement
connect()
Status Quo: Policy Enforcement
connect()
TCP
Status Quo: Policy Enforcement
connect()
TCP
Network
packets
Status Quo: Policy Enforcement
connect()
TCP
Network
packets
veth
veth
namespace boundary
Status Quo: Policy Enforcement
connect()
TCP
Network
packets
iptables
veth
veth
namespace boundary
Status Quo: Policy Enforcement
connect()
drop
TCP
Network
packets
iptables
veth
veth
namespace boundary
Status Quo: Policy Enforcement
connect()
drop
TCP
Network
packets
ETIMEDOUT
iptables
veth
veth
namespace boundary
Status Quo: Policy Enforcement
connect()
drop
TCP
Network
packets
ETIMEDOUT/
ECONNREFUSED
iptables
RST
veth
veth
namespace boundary
Can we do better?
connect()
BPF: Leverage user space tool chain
USER SPACE
KERNEL
connect()
VERIFIER +
JIT
SOURCE CODE [C]
</>
BYTE CODE [BPF]
</>
BPF: Attach program to connect() syscall (LSM)
USER SPACE
KERNEL
connect()
VERIFIER +
JIT
SOURCE CODE [C]
</>
BYTE CODE [BPF]
</>
BPF
LSM Hook
BPF: Return EACCESS – No packets created at all
USER SPACE
KERNEL
connect()
EACCESS
VERIFIER +
JIT
SOURCE CODE [C]
</>
BYTE CODE [BPF]
</>
BPF
LSM Hook
XDP/BPF – The
software loadbalancer
of the future
WHAT IF I TOLD YOU
XDP allows for 10x
IPVS performance
Source: https://www.netdevconf.org/2.1/slides/apr6/zhou-netdev-xdp-2017.pdf
FB moves from IPVS to BPF/XDP for L3/L4 LB
XDP	throughput
IPVS	throughput
Source:
Regular BPF mode
BPF
Driver Software Stack
XDP [Express Data Path] mode
BPF
Driver
Run BPF Program inside network
driver with access to DMA buffer
Software Stack
XDP [Express Data Path] mode
BPF
Driver
Can drop millions of packets per
Second while under DDoS
Software Stack
drop
XDP [Express Data Path] mode
BPF
Driver
Can pass packets to network stack
Software Stack
drop
Stack
XDP [Express Data Path] mode
BPF
Driver
Can perform loadbalancing and
transmit out the wire again
Software Stack
drop
LB & TX
Stack
How can I use BPF
with Docker?
DockerCon 2017 - Cilium - Network and Application Security with BPF and XDP
Cilium Architecture
Cilium
Agent
Cilium Architecture
Cilium
Agent
Plugins
Cilium Architecture
BPF
Cilium
Agent
Plugins
Cilium Architecture
BPF
BPF
Cilium
Agent
Plugins
Cilium Architecture
BPF
BPF
Cilium
Agent
Plugins
Cilium Architecture
BPF
BPF
BPF
Cilium
Agent
Plugins
Cilium Architecture
BPF
BPF
BPF
Cilium
Agent
Plugins
Cilium Architecture
BPF
BPF
BPF
Cilium
Agent
CLI Monitor Policy
Plugins
Project Status
• Initial	release	two	weeks	ago	
• Docker	&	Kubernetes	integration
• Looking	for	feedback	and	
contributions
Getting Started
• Play	with	our	vagrant	box:
$ git clone	https://github.com/cilium/cilium
$ cd	cilium/examples/getting-started
$ vagrant	up
Summary
Summary
• Never	underestimate	the	
Jedi
Summary
• Never	underestimate	the	
Jedi
• Traditional	L3/L4	network	
policies	are	insufficient	for	
microservices.	Least	
privilege	requires	HTTP	/	
API	/	Function	awareness.
Summary
• BPF/XDP	will	drive	the	
future	of	software	based	
networking	on	Linux.
• Never	underestimate	the	
Jedi
• Traditional	L3/L4	network	
policies	are	insufficient	for	
microservices.	Least	
privilege	requires	HTTP	/	
API	/	Function	awareness.
Summary
• Never	underestimate	the	
Jedi
• Traditional	L3/L4	network	
policies	are	insufficient	for	
microservices.	Least	
privilege	requires	HTTP	/	
API	/	Function	awareness.
• BPF/XDP	will	drive	the	
future	of	software	based	
networking	on	Linux.
• Cilium	brings	BPF/XDP	
and	L7	policies	to	
containers	and	
microservices.
Thank You!
github.com/cilium/cilium
http://cilium.io/
@ciliumproject
Want to chat? DM me! @tgraf__
Don’t	forget	
to	vote	and
grab	a	shirt	
on	the	way	
out!
75
140
205
240
325
365 370 365
410 412 425
445 450 460 460
490 495 505 515 525
545
565
0
100
200
300
400
500
600
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
BPF redirect() performance
[GBit per core]
Intel Xeon 3.5Ghz Sandy Bridge, 24 Cores,
(1 TCP GSO flow per core, netperf -t TCP_SENDFILE, 10K policies)

More Related Content

PDF
Introduction to eBPF and XDP
PDF
Introduction to eBPF
PDF
eBPF - Rethinking the Linux Kernel
PDF
High-Performance Networking Using eBPF, XDP, and io_uring
PDF
LinuxCon 2015 Linux Kernel Networking Walkthrough
PDF
BPF & Cilium - Turning Linux into a Microservices-aware Operating System
PDF
Linux Networking Explained
PDF
BPF - in-kernel virtual machine
Introduction to eBPF and XDP
Introduction to eBPF
eBPF - Rethinking the Linux Kernel
High-Performance Networking Using eBPF, XDP, and io_uring
LinuxCon 2015 Linux Kernel Networking Walkthrough
BPF & Cilium - Turning Linux into a Microservices-aware Operating System
Linux Networking Explained
BPF - in-kernel virtual machine

What's hot (20)

PDF
BPF: Tracing and more
PDF
Kernel Recipes 2019 - XDP closer integration with network stack
PPTX
Linux Network Stack
PDF
Scale Kubernetes to support 50000 services
PDF
UM2019 Extended BPF: A New Type of Software
PDF
Linux KVM環境におけるGPGPU活用最新動向
PDF
Cilium - Bringing the BPF Revolution to Kubernetes Networking and Security
PDF
OSv Unikernel — Optimizing Guest OS to Run Stateless and Serverless Apps in t...
PDF
OVS VXLAN Network Accelaration on OpenStack (VXLAN offload and DPDK) - OpenSt...
PDF
Cilium - overview and recent updates
PPTX
Understanding eBPF in a Hurry!
ODP
Linux Internals - Kernel/Core
PDF
Cilium - API-aware Networking and Security for Containers based on BPF
PDF
How VXLAN works on Linux
PPTX
The TCP/IP Stack in the Linux Kernel
PPTX
eBPF Basics
PDF
Introduction to yocto
PDF
I/O仮想化最前線〜ネットワークI/Oを中心に〜
PDF
Browsing Linux Kernel Source
PDF
Using eBPF for High-Performance Networking in Cilium
BPF: Tracing and more
Kernel Recipes 2019 - XDP closer integration with network stack
Linux Network Stack
Scale Kubernetes to support 50000 services
UM2019 Extended BPF: A New Type of Software
Linux KVM環境におけるGPGPU活用最新動向
Cilium - Bringing the BPF Revolution to Kubernetes Networking and Security
OSv Unikernel — Optimizing Guest OS to Run Stateless and Serverless Apps in t...
OVS VXLAN Network Accelaration on OpenStack (VXLAN offload and DPDK) - OpenSt...
Cilium - overview and recent updates
Understanding eBPF in a Hurry!
Linux Internals - Kernel/Core
Cilium - API-aware Networking and Security for Containers based on BPF
How VXLAN works on Linux
The TCP/IP Stack in the Linux Kernel
eBPF Basics
Introduction to yocto
I/O仮想化最前線〜ネットワークI/Oを中心に〜
Browsing Linux Kernel Source
Using eBPF for High-Performance Networking in Cilium
Ad

Similar to DockerCon 2017 - Cilium - Network and Application Security with BPF and XDP (20)

PDF
Cilium – Kernel Native Security & DDOS Mitigation for Microservices with BPF
PDF
Cilium: Kernel Native Security & DDOS Mitigation for Microservices with BPF
PDF
Cilium - Network security for microservices
PDF
Linux Native, HTTP Aware Network Security
PPTX
Cfgmgmtcamp 2023 — eBPF Superpowers
PDF
Cilium:: Application-Aware Microservices via BPF
PDF
Transparent eBPF Offload: Playing Nice with the Linux Kernel
PDF
ebpf and IO Visor: The What, how, and what next!
PDF
eBPF/XDP
PDF
eBPF — Divulging The Hidden Super Power.pdf
PPTX
Dataplane programming with eBPF: architecture and tools
PDF
Replacing iptables with eBPF in Kubernetes with Cilium
PDF
eBPF — Divulging The Hidden Super Power.pdf
PDF
Cilium - BPF & XDP for containers
PDF
SRE NL MeetUp - eBPF.pdf
PDF
Cilium - Fast IPv6 Container Networking with BPF and XDP
PDF
Accelerating Envoy and Istio with Cilium and the Linux Kernel
PDF
The Open Source Ecosystem for eBPF in Kubernetes
PPTX
eBPF Workshop
PDF
Introduction of eBPF - 時下最夯的Linux Technology
Cilium – Kernel Native Security & DDOS Mitigation for Microservices with BPF
Cilium: Kernel Native Security & DDOS Mitigation for Microservices with BPF
Cilium - Network security for microservices
Linux Native, HTTP Aware Network Security
Cfgmgmtcamp 2023 — eBPF Superpowers
Cilium:: Application-Aware Microservices via BPF
Transparent eBPF Offload: Playing Nice with the Linux Kernel
ebpf and IO Visor: The What, how, and what next!
eBPF/XDP
eBPF — Divulging The Hidden Super Power.pdf
Dataplane programming with eBPF: architecture and tools
Replacing iptables with eBPF in Kubernetes with Cilium
eBPF — Divulging The Hidden Super Power.pdf
Cilium - BPF & XDP for containers
SRE NL MeetUp - eBPF.pdf
Cilium - Fast IPv6 Container Networking with BPF and XDP
Accelerating Envoy and Istio with Cilium and the Linux Kernel
The Open Source Ecosystem for eBPF in Kubernetes
eBPF Workshop
Introduction of eBPF - 時下最夯的Linux Technology
Ad

More from Thomas Graf (10)

PDF
BPF: Next Generation of Programmable Datapath
PDF
Cilium - Container Networking with BPF & XDP
PDF
Cilium - BPF & XDP for containers
PDF
LinuxCon 2015 Stateful NAT with OVS
PDF
Taking Security Groups to Ludicrous Speed with OVS (OpenStack Summit 2015)
PDF
2015 FOSDEM - OVS Stateful Services
PDF
Open vSwitch - Stateful Connection Tracking & Stateful NAT
PDF
The Next Generation Firewall for Red Hat Enterprise Linux 7 RC
PDF
SDN & NFV Introduction - Open Source Data Center Networking
PDF
DevConf 2014 Kernel Networking Walkthrough
BPF: Next Generation of Programmable Datapath
Cilium - Container Networking with BPF & XDP
Cilium - BPF & XDP for containers
LinuxCon 2015 Stateful NAT with OVS
Taking Security Groups to Ludicrous Speed with OVS (OpenStack Summit 2015)
2015 FOSDEM - OVS Stateful Services
Open vSwitch - Stateful Connection Tracking & Stateful NAT
The Next Generation Firewall for Red Hat Enterprise Linux 7 RC
SDN & NFV Introduction - Open Source Data Center Networking
DevConf 2014 Kernel Networking Walkthrough

Recently uploaded (20)

PPTX
Essential Infomation Tech presentation.pptx
PDF
AI in Product Development-omnex systems
PDF
How Creative Agencies Leverage Project Management Software.pdf
PPTX
Odoo POS Development Services by CandidRoot Solutions
PDF
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PPTX
Materi-Enum-and-Record-Data-Type (1).pptx
PDF
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
PPTX
L1 - Introduction to python Backend.pptx
PPTX
ai tools demonstartion for schools and inter college
PPTX
Operating system designcfffgfgggggggvggggggggg
PDF
Digital Strategies for Manufacturing Companies
PPTX
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
PDF
medical staffing services at VALiNTRY
PPTX
Online Work Permit System for Fast Permit Processing
PPTX
Introduction to Artificial Intelligence
PPTX
history of c programming in notes for students .pptx
DOCX
The Five Best AI Cover Tools in 2025.docx
PPT
Introduction Database Management System for Course Database
PDF
Design an Analysis of Algorithms II-SECS-1021-03
Essential Infomation Tech presentation.pptx
AI in Product Development-omnex systems
How Creative Agencies Leverage Project Management Software.pdf
Odoo POS Development Services by CandidRoot Solutions
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
Materi-Enum-and-Record-Data-Type (1).pptx
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
L1 - Introduction to python Backend.pptx
ai tools demonstartion for schools and inter college
Operating system designcfffgfgggggggvggggggggg
Digital Strategies for Manufacturing Companies
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
medical staffing services at VALiNTRY
Online Work Permit System for Fast Permit Processing
Introduction to Artificial Intelligence
history of c programming in notes for students .pptx
The Five Best AI Cover Tools in 2025.docx
Introduction Database Management System for Course Database
Design an Analysis of Algorithms II-SECS-1021-03

DockerCon 2017 - Cilium - Network and Application Security with BPF and XDP