IPv6サブネット(/64)からのランダムIPへのバインドが機能しない

IPv6サブネット(/64)からのランダムIPへのバインドが機能しない

/64 IPv6 サブネットを提供する scaleway.com サーバー (DEV1-S) を取得しました。このサブネットの IP を使用して HTTP リクエスト (例では wget を使用) を送信したいのですが、うまくいきません。リクエスト (wget だけでなく、他のプログラムやプログラミング言語でも) がハングします。

IPv6 アドレスは 2001:bc8:1830:1b18::1、ゲートウェイは 2001:bc8:1830:1b18::、ネットマスクは 64 です。

ip -6 addrクリーンなサーバーまたは作成したばかりのサーバーで を実行すると、次のように出力されます。

root@test:~# ip -6 addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 state UNKNOWN qlen 1000
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: ens2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 state UP qlen 1000
    inet6 2001:bc8:1830:1b18::1/64 scope global 
       valid_lft forever preferred_lft forever
    inet6 fe80::dc2e:4cff:fe57:a019/64 scope link 
       valid_lft forever preferred_lft forever

フォーラムやその他の質問/回答で読んだところ、サブネットのアドレスにバインドできるようにするには、次のコマンドを実行する必要があるとのことです。

ip add add local 2001:bc8:1830:1b18::/64 dev lo
ip route add local 2001:bc8:1830:1b18::/64 dev ens2
sysctl -w net.ipv6.ip_nonlocal_bind=1

これらのコマンドを実行すると、出力はip -6 addr次のようになります。

root@test:~# ip -6 addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 state UNKNOWN qlen 1000
    inet6 2001:bc8:1830:1b18::/64 scope global 
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: ens2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 state UP qlen 1000
    inet6 2001:bc8:1830:1b18::1/64 scope global 
       valid_lft forever preferred_lft forever
    inet6 fe80::dc2e:4cff:fe57:a019/64 scope link 
       valid_lft forever preferred_lft forever

2001:bc8:1830:1b18::9今では、 だけでなく6 などにも ping を実行できます2001:bc8:1830:1b18::1が、自分のサーバーからのみ実行できます。他のサーバー/ネットワークからは実行できません。

がない場合sysctl -w net.ipv6.ip_nonlocal_bind=1、wget は次を返します:

root@test:~# wget --bind-address=2001:bc8:1830:1b18::2 -v google.com
--2021-08-13 00:29:45--  http://google.com/
Resolving google.com (google.com)... 2a00:1450:400e:802::200e, 142.250.179.174
Connecting to google.com (google.com)|2a00:1450:400e:802::200e|:80... failed: Cannot assign requested address.
Connecting to google.com (google.com)|142.250.179.174|:80... failed: Address family not supported by protocol.

3 つのコマンドを実行した後、--bind-address フラグを 以外のサブネット内のアドレスに設定して wget を実行すると、2001:bc8:1830:1b18::1リクエストが永久にハングします。

root@test:~# wget --bind-address=2001:bc8:1830:1b18::1 google.com
--2021-08-12 23:55:48--  http://google.com/
Resolving google.com (google.com)... 2a00:1450:400e:802::200e, 142.250.179.174
Connecting to google.com (google.com)|2a00:1450:400e:802::200e|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: http://www.google.com/ [following]
--2021-08-12 23:55:48--  http://www.google.com/
Resolving www.google.com (www.google.com)... 2a00:1450:400e:80f::2004, 142.251.36.4
Connecting to www.google.com (www.google.com)|2a00:1450:400e:80f::2004|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: ‘index.html’

index.html                                                                       [ <=>                                                                                                                                                                                         ]  13.03K  --.-KB/s    in 0.009s  

2021-08-12 23:55:48 (1.44 MB/s) - ‘index.html’ saved [13342]

root@test:~# wget --bind-address=2001:bc8:1830:1b18::2 google.com
--2021-08-12 23:55:52--  http://google.com/
Resolving google.com (google.com)... 2a00:1450:400e:802::200e, 142.250.179.174
Connecting to google.com (google.com)|2a00:1450:400e:802::200e|:80... 

lsofwgetプロセスは次のように言います: wget 3413 root 3u IPv6 58660 0t0 TCP[2001:bc8:1830:1b18::2]:56623->ams15s41-in-x0e.1e100.net:http (SYN_SENT)

何が間違っているのでしょうか? よろしくお願いします!

関連情報