You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/posts/cilium-nat64.md
+53-11Lines changed: 53 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,7 +18,7 @@ In this blog post I cover how I am running [Cilium](https://cilium.io) as a stan
18
18
19
19
Before we get to the real meat and potatoes we need to do some prep work.
20
20
21
-
- Create a VM for the NAT46x64Gateway - I am using Ubuntu 22.04LTS with kernel version 5.15.0-138-generic in my setup.
21
+
- Create a VM for the NAT46x64Gateway - I am using Ubuntu 24.04.03 LTS with kernel version 6.8.0-83-generic
22
22
-[Install Docker](https://docs.docker.com/engine/install/ubuntu/#install-using-the-repository) on the VM
23
23
- Configure networking - A `NAT46x64Gateway` must be dual stacked as it acts as a bridge between IPv4 and IPv6 networks. Here's an example netplan config I am using.
24
24
@@ -33,8 +33,8 @@ network:
33
33
macaddress: "bc:24:11:ee:19:90"
34
34
accept-ra: false
35
35
addresses:
36
-
- "192.168.2.10/24"
37
-
- "2001:db8:abcd::2/64"
36
+
- "192.168.64.2/24"
37
+
- "2001:db8:46:64::2/64"
38
38
nameservers:
39
39
addresses:
40
40
- "1.1.1.1"
@@ -43,25 +43,59 @@ network:
43
43
- to: default
44
44
via: "192.168.2.1"
45
45
- to: default
46
-
via: "2001:db8:abcd::1/64"
46
+
via: "2001:db8:46:64::1"
47
47
```
48
48
49
49
To get Cilium up and running as a NAT46x64Gateway simply run the Cilium container image with the following options. Notice that we're running cilium with `enabled-k8s=false`. Also pay special attention to `--devices` flag as it must match the interface name (eth0) from our netplan config above. Traffic entering/leaving this interface will be subject to translation.
50
50
51
51
```sh
52
-
docker run --name cilium-lb -itd \
52
+
docker run --name cilium-nat64 -itd \
53
+
-v /sys/fs/bpf:/sys/fs/bpf \
54
+
-v /lib/modules:/lib/modules \
55
+
--privileged=true \
56
+
--restart=always \
57
+
--network=host \
58
+
"quay.io/cilium/cilium:v.17.7" cilium-agent \
59
+
--enable-ipv4=true \
60
+
--enable-ipv6=true \
61
+
--devices=eth0 \
62
+
--datapath-mode=lb-only \
63
+
--enable-k8s=false \
64
+
--bpf-lb-mode=snat \
65
+
--enable-nat46x64-gateway=true
66
+
```
67
+
68
+
{{< alert >}}
69
+
There was a [breaking change](https://github.com/cilium/cilium/commit/feaf96b4a4804b320c06e498822b777e94ccc9c3) introduced in Cilium v1.18.0 which deprecates the use of `datapath-mode=lb-only` so I reached out to the good folks in #dev-lb on Cilium community slack and the man, the myth, the legend [Daniel Borkman](http://borkmann.ch) was very kind to point me in the right direction. To be honest I wasn't expecting to get my question directly answered by the guy who co-created eBPF amongst many other things in linux networking stack (such as netkit) so it was quite a humbling feeling to say the least 😅
70
+
{{< /alert >}}
71
+
72
+

73
+
74
+
To run **Cilium v1.18.0 or above as a standalone NAT46x64Gateway**, use the following command
0 commit comments