そういうや最近、jwhoisでjpドメインのwhoisが失敗するなー
$ jwhois --version jwhois version 4.0, Copyright (C) 1999-2007 Free Software Foundation, Inc. This program is free software with ABSOLUTELY NO WARRANTY; you may redistribute it under the terms of the GNU General Public License. $ jwhois -df -hwhois.jprs.jp kek.jp [Querying whois.jprs.jp] [Unable to connect to remote host]
と思ったのでちょっと見てみましたというお話です。
2012-02-01 追記
id:clicklog さんに教えていただいた
がビンゴでした!
Ubuntu 10.04用のアップデートはなかったのですが、
からjwhois_4.0-2_{i386,amd64}.debを持ってきて、dpkg -iでインストールして無事、解決しましたー
# tcpdump -nlxX -i any -s 1600 port 43
で見つつjwhoisしてみると、「
次にstraceでみてみると、
$ strace jwhois -df -hwhois.jprs.jp kek.jp ... socket(PF_INET, SOCK_DGRAM|SOCK_NONBLOCK, IPPROTO_IP) = 4 connect(4, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("10.6.25.2")}, 16) = 0 gettimeofday({1328028532, 663221}, NULL) = 0 poll([{fd=4, events=POLLOUT}], 1, 0) = 1 ([{fd=4, revents=POLLOUT}]) send(4, "\274\350\1\0\0\1\0\0\0\0\0\0\5whois\4jprs\2jp\0\0\34\0\1", 31, MSG_NOSIGNAL) = 31 poll([{fd=4, events=POLLIN}], 1, 5000) = 1 ([{fd=4, revents=POLLIN}]) ioctl(4, FIONREAD, [59]) = 0 recvfrom(4, "\274\350\201\200\0\1\0\1\0\0\0\0\5whois\4jprs\2jp\0\0\34\0\1\300"..., 1024, 0, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("10.6.25.2")}, [16]) = 59 close(4) = 0 stat64("/etc/resolv.conf", {st_mode=S_IFREG|0644, st_size=77, ...}) = 0 socket(PF_INET, SOCK_DGRAM|SOCK_NONBLOCK, IPPROTO_IP) = 4 connect(4, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("10.6.25.2")}, 16) = 0 gettimeofday({1328028532, 665655}, NULL) = 0 poll([{fd=4, events=POLLOUT}], 1, 0) = 1 ([{fd=4, revents=POLLOUT}]) send(4, "\210P\1\0\0\1\0\0\0\0\0\0\5whois\4jprs\2jp\0\0\1\0\1", 31, MSG_NOSIGNAL) = 31 poll([{fd=4, events=POLLIN}], 1, 5000) = 1 ([{fd=4, revents=POLLIN}]) ioctl(4, FIONREAD, [47]) = 0 recvfrom(4, "\210P\201\200\0\1\0\1\0\0\0\0\5whois\4jprs\2jp\0\0\1\0\1\300"..., 1024, 0, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("10.6.25.2")}, [16]) = 47 close(4) = 0 open("/etc/gai.conf", O_RDONLY) = 4 fstat64(4, {st_mode=S_IFREG|0644, st_size=2980, ...}) = 0 fstat64(4, {st_mode=S_IFREG|0644, st_size=2980, ...}) = 0 mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb76b1000 read(4, "# Configuration for getaddrinfo("..., 4096) = 2980 read(4, "", 4096) = 0 close(4) = 0 munmap(0xb76b1000, 4096) = 0 socket(PF_INET6, SOCK_DGRAM, IPPROTO_IP) = 4 connect(4, {sa_family=AF_INET6, sin6_port=htons(43), inet_pton(AF_INET6, "2001:df0:8:7::70", &sin6_addr), sin6_flowinfo=0, sin6_scope_id=0}, 28) = -1 ENETUNREACH (Network is unreachable) connect(4, {sa_family=AF_UNSPEC, sa_data="\0\0\0\0\0\0\0\0\0\0\0\0\0\0"}, 16) = 0 connect(4, {sa_family=AF_INET, sin_port=htons(43), sin_addr=inet_addr("202.11.16.169")}, 16) = 0 getsockname(4, {sa_family=AF_INET6, sin6_port=htons(37715), inet_pton(AF_INET6, "::ffff:10.6.25.39", &sin6_addr), sin6_flowinfo=0, sin6_scope_id=0}, [28]) = 0 close(4) = 0 socket(PF_INET, SOCK_STREAM, IPPROTO_TCP) = 4 fcntl64(4, F_GETFL) = 0x2 (flags O_RDWR) fcntl64(4, F_SETFL, O_RDWR|O_NONBLOCK) = 0 connect(4, {sa_family=AF_INET, sin_port=htons(43), sin_addr=inet_addr("202.11.16.169")}, 16) = -1 EINPROGRESS (Operation now in progress) ★怪しげポイント select(1024, NULL, [4], NULL, {75, 0}) = 1 (out [4], left {74, 995234}) getsockopt(4, SOL_SOCKET, SO_ERROR, [0], [4]) = 0 socket(PF_INET6, SOCK_STREAM, IPPROTO_TCP) = 5 fcntl64(5, F_GETFL) = 0x2 (flags O_RDWR) fcntl64(5, F_SETFL, O_RDWR|O_NONBLOCK) = 0 connect(5, {sa_family=AF_INET6, sin6_port=htons(43), inet_pton(AF_INET6, "2001:df0:8:7::70", &sin6_addr), sin6_flowinfo=0, sin6_scope_id=0}, 28) = -1 ENETUNREACH (Network is unreachable) write(1, "[Querying whois.jprs.jp]\n[Unable"..., 60[Querying whois.jprs.jp] [Unable to connect to remote host] ) = 60 exit_group(1) = ?
次に、うまく引けるjwhois 3.2.2のstrace(の後半のみ):
... socket(PF_INET6, SOCK_DGRAM, IPPROTO_IP) = 4 connect(4, {sa_family=AF_INET6, sin6_port=htons(43), inet_pton(AF_INET6, "2001:df0:8:7::70", &sin6_addr), sin6_flowinfo=0, sin6_scope_id=0}, 28) = -1 ENETUNREACH (Network is unreachable) connect(4, {sa_family=AF_UNSPEC, sa_data="\0\0\0\0\0\0\0\0\0\0\0\0\0\0"}, 16) = 0 connect(4, {sa_family=AF_INET, sin_port=htons(43), sin_addr=inet_addr("202.11.16.169")}, 16) = 0 getsockname(4, {sa_family=AF_INET6, sin6_port=htons(62221), inet_pton(AF_INET6, "::ffff:10.6.25.39", &sin6_addr), sin6_flowinfo=0, sin6_scope_id=0}, [28]) = 0 close(4) = 0 socket(PF_INET, SOCK_STREAM, IPPROTO_TCP) = 4 connect(4, {sa_family=AF_INET, sin_port=htons(43), sin_addr=inet_addr("202.11.16.169")}, 16) = 0 write(4, "kek.jp\r\n", 8) = 8 read(4, "[ JPRS database provides informa"..., 1023) = 1023 read(4, " \33$BJ8I"..., 1023) = 612 read(4, "", 1023) = 0 write(1, "[Querying whois.jprs.jp]\n[whois."..., 1676[Querying whois.jprs.jp] [whois.jprs.jp] [ JPRS database provides information on network administration. Its use is ] ...
比べた感じだと、うまくいかない方は
connect(4, {sa_family=AF_INET, sin_port=htons(43), sin_addr=inet_addr("202.11.16.169")}, 16) = -1 EINPROGRESS (Operation now in progress)
というのが出てて、その後にIPv6で接続しようとして(IPv6では到達経路がないので)コネクションに失敗して、それをもってjwhoisさんは「[Unable to connect to remote host]」とエラー終了しているように見えます。
このマシンはこんな感じ。
- Ubuntu 10.04
- IPv6が有効になってる
- kernelはこれ: unaem -r → 2.6.35-23-generic
- glibcはこれ: GNU C Library (Ubuntu EGLIBC 2.11.1-0ubuntu7.8) stable release version 2.11.1
straceをみると、/etc/gai.confを読んでるんで、RFC 3484がらみかなーと思い、
$ grep -v ^# /etc/gai.conf scopev4 ::ffff:169.254.0.0/112 2 scopev4 ::ffff:127.0.0.0/104 2 scopev4 ::ffff:10.0.0.0/104 5 scopev4 ::ffff:172.16.0.0/108 5 scopev4 ::ffff:192.168.0.0/112 5 scopev4 ::ffff:0.0.0.0/96 14
としてみたものの、結果は変わらず。
IPv6を完全にオフればwhoisは引けるようになりそうな気がするけど、なんかちょっとそれはアレだなぁ。。と思ってるところです。
なにか情報お持ちの方は教えてください><