From point A to point B
Point A: your pods have IPs and talk to each other, but you don't know which path a packet takes. Point B: by the end of this chapter you'll be able to follow a packet within a node and between nodes, tell native routing apart from tunnels, and choose VXLAN, Geneve or native routes based on your network.
The Linux networking basics
Cilium's datapath is the set of pieces that process, route and deliver each packet. It relies on two kernel primitives:
- Network namespace: an isolated copy of the network stack, with its own interfaces, routes and rules. Each pod has its own; the host has its own too.
- veth pair: two virtual interfaces joined like a cable. Whatever goes in one end comes out the other. Inside the pod you see
eth0; on the host, its peer is calledlxc….
Two pods on the same node
Cilium attaches eBPF programs to the host end of each veth pair. That way it decides what to do with a packet the moment it leaves the pod, without going through bridges or iptables chains.
The packet leaves the pod, the host's eBPF processes it and delivers it to the other pod without a tunnel. Diagram: The House of Routing.
Check it. Create two pods on kind-worker:
for p in alpha beta; do
kubectl run $p --image=nicolaka/netshoot \
--overrides='{"spec":{"nodeName":"kind-worker"}}' -- sleep infinity
done
kubectl get pods -o wide
# Inside the pod: eth0@ifN shows the index of its peer on the host
kubectl exec alpha -- ip -br addr show eth0
kubectl exec alpha -- ip route
alpha's default gateway is an IP that lives on cilium_host, in the host namespace. Now look at the node side:
# Each pod's lxc… peers, plus Cilium's devices
docker exec kind-worker ip -br link | grep -E "lxc|cilium"
| Device | What it's for |
|---|---|
lxc… | Host end of each pod's veth pair |
cilium_host | Holds the IP pods use as their gateway |
cilium_net | Peer of cilium_host; together they form another veth pair |
cilium_vxlan / cilium_geneve | Tunnel to other nodes; not used within the same node |
Which eBPF programs are attached, and where? bpftool ships inside the agent container:
AGENT=$(kubectl -n kube-system get pods -l k8s-app=cilium \
--field-selector spec.nodeName=kind-worker -o name)
kubectl -n kube-system exec $AGENT -c cilium-agent -- bpftool net show
You'll see cil_from_container on each lxc…: it's the program that processes everything leaving a pod. Finally, watch the trip with Hubble:
kubectl exec alpha -- ping -c 2 $(kubectl get pod beta -o jsonpath='{.status.podIP}')
hubble observe -P --from-pod default/alpha --protocol icmp --last 4
The golden rule between nodes
Kubernetes requires that any pod can talk to any other by its IP and without NAT: the destination sees the source's real IP, and the source reaches the destination by its pod IP. Between nodes, that means someone has to know where each PodCIDR lives. Cilium offers two models:
Native routes versus a tunnel, with the layers of the encapsulated packet. Diagram: The House of Routing.
Native routing
The packet leaves the pod and the host routes it with its routing table, like any other traffic. For that, each node (or the physical network) has to know which PodCIDR is on which node. You turn it on with two required values:
# values-native.yaml
routingMode: native
ipv4NativeRoutingCIDR: 10.0.0.0/8 # range the network already knows how to route: no NAT
autoDirectNodeRoutes: true # Cilium installs the routes between nodes
There are three ways to distribute the routes:
| Method | How it works | When to use it |
|---|---|---|
| Automatic routes | autoDirectNodeRoutes: true: each agent adds routes to the other nodes' PodCIDRs | All nodes on the same layer 2 network |
| Static routes | You add them yourself with ip route add or with a configuration tool | Small labs whose nodes don't change |
| BGP | Each node advertises its PodCIDR to the network's routers | Production with many nodes or racks (chapter 10) |
With automatic routes, each node points the other nodes' blocks to the owning node's IP:
helm install cilium cilium/cilium --version 1.20.3 -n kube-system -f values-native.yaml
cilium status --wait
# 10.0.x.0/24 via 172.18.0.x : one route per neighbor node
docker exec kind-worker ip route | grep "^10\."
A static route does the same thing by hand, node by node:
# On kind-worker: kind-worker2's block is reached through its node IP
ip route add 10.0.2.0/24 via 172.18.0.4 dev eth0
It works, but it doesn't scale: every time a node joins or leaves, you have to touch all the others.
Encapsulation: VXLAN and Geneve
In many clouds and shared networks you can't teach the network your pod ranges. That's what encapsulation is for, and it's Cilium's default mode: the nodes form a mesh of tunnels and the pod's packet travels wrapped inside a regular node-to-node packet. The network only sees node-to-node traffic.
# Tunnel mode and protocol
cilium config view | grep -E "routing-mode|tunnel-protocol"
# Routes to remote PodCIDRs point to cilium_host; from there eBPF encapsulates
docker exec kind-worker ip route | grep cilium_host
# Which node (tunnelendpoint) each pod block goes to
kubectl -n kube-system exec ds/cilium -- cilium-dbg bpf ipcache list | grep tunnelendpoint
The encapsulated packet carries four layers:
- Outer IP: node to node.
- UDP: port
8472for VXLAN (the IANA port is 4789, but Cilium uses 8472) or6081for Geneve. - Tunnel header: Cilium uses the VNI field to carry the source pod's security identity. The destination node enforces policies without having to look it up.
- Original packet: pod to pod, untouched.
| VXLAN | Geneve | |
|---|---|---|
| UDP port in Cilium | 8472 | 6081 |
| Extra metadata | No | Yes, with TLV fields (used by DSR, chapter 8) |
| How to turn it on | Default | tunnelProtocol: geneve |
The number carried in the VNI is the same one you see in the identity resources:
kubectl get ciliumidentities
kubectl get ciliumidentity <ID> -o yaml # you'll see the pod's labels
How to choose
| Situation | Choose |
|---|---|
| You don't control the network (cloud, shared network) | Encapsulation with VXLAN |
| You need metadata in the tunnel | Geneve |
| Nodes on the same layer 2 network | Native with autoDirectNodeRoutes |
| Data center with BGP routers | Native with BGP |
| You want maximum performance and pod IPs visible on the network | Native |
Challenge
Answer before you open the solution.
1. Where does the eBPF program that processes traffic leaving a pod run?
On the host end of its veth pair (the lxc… interface), with the cil_from_container program.
2. Two pods on the same node ping each other. Does the traffic go through cilium_vxlan?
No. Traffic within a node is delivered through the host namespace, without encapsulation.
3. Which two values are required for native routing?
routingMode: native and ipv4NativeRoutingCIDR (or its IPv6 equivalent), the range the network already knows how to route.
4. What does Cilium carry in the VNI field of VXLAN and Geneve?
The source pod's security identity, so the destination node can enforce policies without looking it up.
What you take away
- Each pod connects to the host through a veth pair; Cilium puts eBPF on the host side.
- Within a node there's no tunnel: eBPF delivers the packet directly.
- Between nodes, no NAT: either the network knows the PodCIDRs (native) or they're hidden in a tunnel (encapsulation).
- VXLAN uses UDP 8472, Geneve UDP 6081; both carry the source identity.
- Native gives more performance; encapsulation works on any network.
In the next chapter: services. How Cilium replaces kube-proxy with eBPF, why it keeps working even if the agent goes down, and how to give your services external IPs.
Official resources
- Routingdocs.cilium.io
- eBPF Datapathdocs.cilium.io
- The Kubernetes network modelkubernetes.io
- RFC 7348 · VXLANietf.org
- RFC 8926 · Geneveietf.org
- pwru: Packet, where are you?github.com
Source and credits. This chapter summarizes and paraphrases the official book Cilium: Up and Running by Nico Vibert, Filip Nikolic and James Laverack (O'Reilly Media, 2026). The summary was produced with AI and reviewed, verified and approved by Jesús Espinoza. The diagrams and code examples are original work by The House of Routing and were checked against the official Cilium documentation. Cilium: Up and Running, the cover image, and related trade dress are trademarks of O'Reilly Media, Inc. This content is not affiliated with or endorsed by O'Reilly Media or Isovalent.