
IPv6 アドレスを持たないサーバーに cURL リクエストをいくつか送信する必要がありますが、マシンは 1) https を使用し、2) IPv6 を使用している場合にのみ接続できるようです。その他のリクエストは、DNS 解決後、接続が確立される前に無期限にハングします。
これを解決する方法についてご指導いただければ幸いです。
このマシンは、curl 7.58.0 および ufw 0.36 を搭載した Ubuntu 18.04.4 を実行しています。
これはどのドメインでも発生しますが、google.com の場合の例をいくつか示します。
me@myserver:/$ curl -I4 http://www.google.com --trace-ascii /dev/stdout --no-tcp-nodelay
== Info: Rebuilt URL to: http://www.google.com/
== Info: Trying 142.251.40.100...
*hangs*
me@myserver:/$ curl -I4 https://www.google.com --trace-ascii /dev/stdout --no-tcp-nodelay
== Info: Rebuilt URL to: https://www.google.com/
== Info: Trying 142.251.40.100...
*hangs*
me@myserver:/$ curl -I6 http://www.google.com --trace-ascii /dev/stdout --no-tcp-nodelay
== Info: Rebuilt URL to: http://www.google.com/
== Info: Trying 2607:f8b0:4006:81f::2004...
*hangs*
me@myserver:/$ curl -I6 https://www.google.com --trace-ascii /dev/stdout --no-tcp-nodelay
== Info: Rebuilt URL to: https://www.google.com/
== Info: Trying 2607:f8b0:4006:81f::2004...
== Info: Connected to www.google.com (2607:f8b0:4006:81f::2004) port 443 (#0)
*no problems*
UFW で IP ホワイトリストを試しましたが、役に立ちませんでした。
me@myserver:/$ sudo ufw status verbose
Status: active
Logging: on (low)
Default: deny (incoming), allow (outgoing), disabled (routed)
New profiles: skip
To Action From
-- ------ ----
22 ALLOW IN Anywhere
80 ALLOW IN Anywhere
443 ALLOW IN Anywhere
Anywhere ALLOW IN 142.251.40.100
22 (v6) ALLOW IN Anywhere (v6)
80 (v6) ALLOW IN Anywhere (v6)
443 (v6) ALLOW IN Anywhere (v6)
マシンはUbuntu 18.04.4を実行しています。
以下は (軽くフォーマットし直した) 出力ですcurl -V
:
curl 7.58.0 (x86_64-pc-linux-gnu)
libcurl/7.58.0
OpenSSL/1.1.1d
zlib/1.2.11
libidn2/2.3.0
libpsl/0.19.1 (+libidn2/2.0.4)
nghttp2/1.30.0
librtmp/2.3
Release-Date: 2018-01-24
Protocols:
dict file ftp ftps gopher http https
imap imaps ldap ldaps pop3 pop3s
rtmp rtsp smb smbs smtp smtps telnet tftp
Features:
AsynchDNS GSS-API HTTP2 HTTPS-proxy
IDN IPv6 Kerberos Largefile libz NTLM NTLM_WB PSL SPNEGO SSL TLS-SRP UnixSockets