Open3

さくらのvpsでIPv6を有効にしてみる

catatsuycatatsuy

OSはDebian9

% sysctl -a --pattern disable_ipv6
net.ipv6.conf.all.disable_ipv6 = 0
net.ipv6.conf.default.disable_ipv6 = 0
net.ipv6.conf.eth0.disable_ipv6 = 0
net.ipv6.conf.eth1.disable_ipv6 = 0
net.ipv6.conf.eth2.disable_ipv6 = 0
net.ipv6.conf.lo.disable_ipv6 = 0

/etc/network/interfacesにIPv6の設定を足す。

iface eth0 inet6 static
        address deadbeaf
        netmask 64
        gateway fe80::1

ping6を使う
ip6tablesを使う
ip routeip -6 route

curlでIPv6を渡すときは [] を使うのと、resolveの時はportを2回書く必要があるっぽい

curl --resolve 'www.catatsuy.org:443:[2001:e42:102:1520:160:16:89:201]:443' https://www.catatsuy.org
catatsuycatatsuy

nginxの設定はIPv6とIPv4で明確に分かれている。すべてのlistenを増やす必要がある。

listen [::]:443 ssl http2;

ipv6only=off を追加する手もあるが、すべての設定をそうする必要がある。nginx -tをしてもエラーにならないので注意。

catatsuycatatsuy

curl --resolveでポート番号を2回渡す必要があったのはバグ?だったようで、今のバージョンだと逆に動かなくなっていた。

curl --resolve 'www.catatsuy.org:443:[2001:e42:102:1520:160:16:89:201]' https://www.catatsuy.org

で今なら動く