Skip to content

Commit 8786407

Browse files
committed
cilium nat464 post refactor
1 parent 876a01c commit 8786407

File tree

3 files changed

+37
-10
lines changed

3 files changed

+37
-10
lines changed

config/_default/markup.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
[goldmark.renderer]
66
unsafe = true
77

8+
[goldmark.parser.attribute]
9+
block = true
10+
811
[highlight]
912
noClasses = false
1013
wrapperClass = 'highlight'

content/posts/cilium-nat64.md

Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,27 @@ docker run --name cilium-lb -itd \
5757
"quay.io/cilium/cilium:stable" cilium-agent --enable-ipv4=true --enable-ipv6=true --devices=eth0 --datapath-mode=lb-only --enable-k8s=false --bpf-lb-mode=snat --enable-nat46x64-gateway=true
5858
```
5959

60-
## Test
60+
To check the status of our standalone cilium install with NAT64 enabled
6161

62-
Let's create another Ubuntu VM as a test host with an IPv6 only address that points to our NAT46x64Gateway. Few noteworthy points in the netplan config shared below.
62+
```sh
63+
root@nat64gw:~# docker exec -it cilium-lb cilium status --verbose | awk "/NAT46\/64/ {found=1} found"
64+
NAT46/64 Support:
65+
- Services: Enabled
66+
- Gateway: Enabled
67+
Prefixes: 64:ff9b::/96
68+
XDP Acceleration: Disabled
69+
Services:
70+
- ClusterIP: Enabled
71+
- NodePort: Enabled (Range: 30000-32767)
72+
- LoadBalancer: Enabled
73+
- externalIPs: Enabled
74+
- HostPort: Disabled
75+
... snipped ...
76+
```
6377

64-
- The two nameservers are DNS64 servers from dns64.cloudflare-dns.com and dns64.dns.google respectively. You can use any dns server which has dns64 capability.When a client queries a DNS64 server for a hostname which only has an A record setup, the dns64 server sends a response containing the corresponding IPv4 address as well as a translated IPv6 address.
78+
## Test
6579

66-
- static route to `64::ff9b/96` which is a special prefix that is used by IPv4/IPv6 translators as defined in [RFC6502](https://datatracker.ietf.org/doc/html/rfc6052). When the DNS64 server responds with the translated IPv6 address, our VM will forward the packet to our NAT46x64Gateway i.e `2001:db8:abcd::2`
80+
A good test to check if our NAT46x64Gateway is performing the 4to6 translation correctly, we can try connecting to an application that is accessible only via IPv4. So let's provision another Ubuntu VM on our IPv6 only network with the following netplan config as shown below.
6781

6882
```yaml
6983
root@controller:/home/kagraw# cat /etc/netplan/00-installer-config.yaml
@@ -89,28 +103,38 @@ network:
89103
via: 2001:db8:abcd::2
90104
```
91105

106+
Few noteworthy points:
107+
108+
- The two nameservers are DNS64 servers from dns64.cloudflare-dns.com and dns64.dns.google respectively. You can use any dns server which has dns64 capability. When a client queries a DNS64 server for a hostname which only has an A record setup, the dns64 server sends a response containing the corresponding IPv4 address as well as a translated IPv6 address.
109+
92110
Example:
93111

94112
google.com has both an A record and a AAAA record.
95113

96114
```sh
97-
root@controller:/home/kagraw# host google.com
115+
root@testvm:/home/kagraw# host google.com
98116
google.com has address 142.250.190.78
99117
google.com has IPv6 address 2607:f8b0:4009:803::200e
100118
```
101119

102120
github.com only has an A record but since we're using a DNS64 server we receive a (translated) AAAA record as well.
103121

104122
```sh
105-
root@controller:/home/kagraw# host github.com
123+
root@testvm:/home/kagraw# host github.com
106124
github.com has address 140.82.113.4
107125
github.com has IPv6 address 64:ff9b::8c52:7104
108126
```
109127

110-
But since we have a static route to 64:ff9b::/96, any traffic going to github (64:ff9b::8c52:7203) will be forwarded via `2001:db8:abcd::2` i.e our Cilium based NAT46x64Gateway.
128+
- Static route to `64::ff9b/96` which is a special prefix that is used by IPv4/IPv6 translators as defined in [RFC6502](https://datatracker.ietf.org/doc/html/rfc6052). When the DNS64 server responds with the translated IPv6 address, our ipv6 only test host looks up it's routing table and forwards the packet directly to our NAT46x64Gateway i.e `2001:db8:abcd::2`
129+
130+
{{< alert >}}
131+
**Note!** Using a static route is not a hard requirement. The bottom line is that your router needs to know where to forward IPv6 packets going to `64:ff9b::/96` i.e what the next hop is.
132+
{{< /alert >}}
133+
134+
Our moment of truth has finally arrived ⏳
111135

112136
```sh
113-
root@controller:/home/kagraw# curl -6 -v github.com
137+
root@testvm:/home/kagraw# curl -6 -v github.com
114138
* Trying 64:ff9b::8c52:7104:80...
115139
* Connected to github.com (64:ff9b::8c52:7104) port 80 (#0)
116140
> GET / HTTP/1.1
@@ -126,4 +150,4 @@ root@controller:/home/kagraw# curl -6 -v github.com
126150
* Connection #0 to host github.com left intact
127151
```
128152

129-
and Voila!🍾 our Cilium based NAT46x64Gateway is up and running!
153+
Voila!🍾 our Cilium based NAT46x64Gateway is up and running!

0 commit comments

Comments
 (0)