ENGLISH:
So you have a IPv6 only server, and IPv4 only sites won't load, or even worse, you have a program that uses hardcoded IPv4 address in it, and it won't work using a DNS64 dns server. The following will setup CLAT on your server that will translate IPv4 address to the IPv6 prefix that is detects for the DNS64 IPv6 range.
This was don on Debian 12, but should also work for Ubuntu. After logging in to your server:
Prep for getting system working
apt update
echo "dns-nameserver 2a01:4f8:c2c:123f::1" >> /etc/network/interfaces
echo "dns-nameserver 2a00:1098:2c::1" >> /etc/network/interfaces
apt install resolvconf git build-essential tayga curl
reboot
After rebooting, we will install CLAT
mkdir ~/src
cd ~/src
git clone https://github.com/toreanderson/clatd
make -C clatd install installdeps
This configures CLAT
cat <<'EOF' > /etc/clatd.conf
clat-v6-addr=fd00::c1a7
proxynd-enable=false
script-up=nft "add table ip6 clatd" ; nft "add chain ip6 clatd POSTROUTING { type nat hook postrouting priority srcnat; }" ; nft "add rule ip6 clatd POSTROUTING masquerade"
script-down=nft 'delete table ip6 clatd'
EOF
echo "net.ipv6.conf.all.forwarding = 1" >> /etc/sysctl.d/00-ip6fwd.conf
sysctl -p
systemctrl restart clatd
Now to test if it works, just run curl 1.1.1.1
. You should then see:
root@srv[Redacted]:~/src# curl 1.1.1.1
<html>
<head><title>301 Moved Permanently</title></head>
<body>
<center><h1>301 Moved Permanently</h1></center>
<hr><center>cloudflare</center>
</body>
</html>
This uses the DNS from nat64.net. and their servers seem to block pings. So that is why I use `curl 1.1.1.1`.
Deutsch (über Google Translate):
Sie haben also einen reinen IPv6-Server und nur IPv4-Sites werden nicht geladen, oder noch schlimmer, Sie haben ein Programm, das fest codierte IPv4-Adressen verwendet, und es funktioniert nicht mit einem DNS64-DNS-Server. Im Folgenden wird CLAT auf Ihrem Server eingerichtet, das die IPv4-Adresse in das IPv6-Präfix übersetzt, das für den DNS64-IPv6-Bereich erkannt wird.
Ich habe das unter Debian 12 gemacht, sollte aber auch unter Ubuntu funktionieren. Nachdem Sie sich bei Ihrem Server angemeldet haben:
Bereiten Sie sich darauf vor, das System zum Laufen zu bringen
apt update
echo "dns-nameserver 2a01:4f8:c2c:123f::1" >> /etc/network/interfaces
echo "dns-nameserver 2a00:1098:2c::1" >> /etc/network/interfaces
apt install resolvconf git build-essential tayga curl
reboot
Nach dem Neustart installieren wir CLAT
mkdir ~/src
cd ~/src
git clone https://github.com/toreanderson/clatd
make -C clatd install installdeps
Dadurch wird CLAT konfiguriert
cat <<'EOF' > /etc/clatd.conf
clat-v6-addr=fd00::c1a7
proxynd-enable=false
script-up=nft "add table ip6 clatd" ; nft "add chain ip6 clatd POSTROUTING { type nat hook postrouting priority srcnat; }" ; nft "add rule ip6 clatd POSTROUTING masquerade"
script-down=nft 'delete table ip6 clatd'
EOF
echo "net.ipv6.conf.all.forwarding = 1" >> /etc/sysctl.d/00-ip6fwd.conf
sysctl -p
systemctrl restart clatd
Um nun zu testen, ob es funktioniert, führen Sie einfach curl 1.1.1.1
. Sie sollten dann Folgendes sehen:
root@srv[Redacted]:~/src# curl 1.1.1.1
<html>
<head><title>301 Moved Permanently</title></head>
<body>
<center><h1>301 Moved Permanently</h1></center>
<hr><center>cloudflare</center>
</body>
</html>
Dabei wird der DNS von nat64.net verwendet. und ihre Server scheinen Pings zu blockieren. Deshalb verwende ich `curl 1.1.1.1`.