[ubuntu-jp:2868] Re: Ubuntu Server 10.04 の起動順

Mitsuru Ogino ogino @ verama.net
2010年 8月 4日 (水) 03:06:18 BST


荻野です。

/etc/rc2.d/S10sleep 中に、ping -I IPv6address を挿入してエラーになるこ
とを確認しました。

どうも現状の Ubuntu 10.04.1 LTS では、/etc/rc2.d/ 以下で静的に割り振っ
た IPv6 アドレスを指定して bind するようなものを起動すると、そのままで
は bind に失敗する可能性がかなりあるようです。

ただ、これも書洩らしていましたが(すみません)、今回のホストは IPv6 ア
ドレスを二つつけて、BIND9 と unbound に紐づけしようとしています。後述し
ますが、固定 IPv6 アドレスであっても重複チェックを行うようで、これがア
ドレス分二倍になって、トラブルに会うタイミングが大きくなっている可能性
はあります。


前のメールで、unbound が起動するより前に /etc/rc2.d/S10sleep で、sleep
10 を実行すると問題を回避できると書きましたが、この sleep 10 の前後に、

{
  date '+%c %N'
  ping6 -c 1 -I 2001:****:****:200::18 2001:****:****::200::fb 2>&1
  ifconfig -a
  echo
} >> /var/tmp/sleep.log

を入れてみました。ここで

  2001:****:****:200::18 自ホスト
  2001:****:****:200::fb は同じセグメントの別サーバ

で 2001:****:****:200::fb では tcpdump でキャプチャを実行しました。

ログは後に載せておきますが、sleep 10 前では bind に失敗します。

  Wed Aug  4 09:36:34 2010 485401706
  ping: bind icmp socket: Cannot assign requested address

sleep 10 すると、

  Wed Aug  4 09:36:44 2010 511691797
  PING 2001:2f8:38:200::fb(2001:2f8:38:200::fb) from 2001:2f8:38:200::18 : 56 data bytes
  64 bytes from 2001:2f8:38:200::fb: icmp_seq=1 ttl=64 time=4.53 ms
  
  --- 2001:2f8:38:200::fb ping statistics ---
  1 packets transmitted, 1 received, 0% packet loss, time 0ms
  rtt min/avg/max/mdev = 4.533/4.533/4.533/0.000 ms

と成功するようになります。ところが、ifconfig の結果はどちらのタイミング
でも

  eth0      Link encap:Ethernet  HWaddr 00:0c:29:68:f9:ac
            inet addr:192.168.120.108  Bcast:192.168.120.255  Mask:255.255.255.0
            inet6 addr: 2001:****:****:200::18/64 Scope:Global
            (以下略)

と IPv6 アドレスが確認できます。ifconfig で IPv6 アドレスが確認できても
使用はできないというタイミングがあるということで、困ったものです。


tcpdump の結果も載せておきますが、二回目の ping(初めての成功)と、それ
に先立つ ND (v6 版 ARP)が

09:36:44.513184 IP6 2001:****:****:200::18 > ff02::1:ff00:fb: ICMP6, neighbor solicitation, who has 2001:****:****:200::fb, length 32
09:36:44.513229 IP6 2001:****:****:200::fb > 2001:****:****:200::18: ICMP6, neighbor advertisement, tgt is 2001:****:****:200::fb, length 32
09:36:44.513376 IP6 2001:****:****:200::18 > 2001:****:****:200::fb: ICMP6, echo request, seq 1, length 64
09:36:44.513392 IP6 2001:****:****:200::fb > 2001:****:****:200::18: ICMP6, echo reply, seq 1, length 64

と記録されています(b, c)。ping 直前の date コマンドは 09:36:44
511691797 なので、この二台の時計はほぼ(少なくとも 0.01秒ぐらいの誤差で)
あっていると考えることができます。

bind に失敗する最初の ping の時刻 09:36:34 485401706 あたりで何があるか
というと

09:36:34.673082 IP6 :: > ff02::1:ff00:18: ICMP6, neighbor solicitation, who has 2001:****:****:200::18, length 24

があり(a)、やはり固定 IPv6 アドレスでも重複チェックかなにかをしているよ
うです。この返事を待っているように見えます。


以上、ご報告いたします。抜本的解決法の提案は私の手には余るようですので、
申し訳ありませんがご検討いただければ嬉しいです。

以下にログ等を載せておきます。よろしくお願いいたします。



検証用コマンド

  date '+%c %N'
  ping6 -c 1 -I 2001:****:****:200::18 2001:****:****::200::fb 2>&1
  ifconfig -a

の /etc/rc2.d/S10sleep 内の sleep 10 前後での実施結果

----- ここから -----
Wed Aug  4 09:36:34 2010 485401706
ping: bind icmp socket: Cannot assign requested address
eth0      Link encap:Ethernet  HWaddr 00:0c:29:68:f9:ac
          inet addr:192.168.120.108  Bcast:192.168.120.255  Mask:255.255.255.0
          inet6 addr: 2001:****:****:200::18/64 Scope:Global
          inet6 addr: fe80::20c:29ff:fe68:f9ac/64 Scope:Link
          inet6 addr: 2001:****:****:200::d/64 Scope:Global
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:6 errors:0 dropped:0 overruns:0 frame:0
          TX packets:10 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:611 (611.0 B)  TX bytes:821 (821.0 B)

eth0:0    Link encap:Ethernet  HWaddr 00:0c:29:68:f9:ac
          inet addr:192.168.120.13  Bcast:192.168.120.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:16 errors:0 dropped:0 overruns:0 frame:0
          TX packets:16 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:978 (978.0 B)  TX bytes:978 (978.0 B)


Wed Aug  4 09:36:44 2010 511691797
PING 2001:****:****:200::fb(2001:****:****:200::fb) from 2001:****:****:200::18 : 56 data bytes
64 bytes from 2001:****:****:200::fb: icmp_seq=1 ttl=64 time=4.53 ms

--- 2001:****:****:200::fb ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 4.533/4.533/4.533/0.000 ms
eth0      Link encap:Ethernet  HWaddr 00:0c:29:68:f9:ac
          inet addr:192.168.120.108  Bcast:192.168.120.255  Mask:255.255.255.0
          inet6 addr: 2001:****:****:200::18/64 Scope:Global
          inet6 addr: fe80::20c:29ff:fe68:f9ac/64 Scope:Link
          inet6 addr: 2001:****:****:200::d/64 Scope:Global
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:20 errors:0 dropped:0 overruns:0 frame:0
          TX packets:29 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:2026 (2.0 KB)  TX bytes:2432 (2.4 KB)

eth0:0    Link encap:Ethernet  HWaddr 00:0c:29:68:f9:ac
          inet addr:192.168.120.13  Bcast:192.168.120.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:22 errors:0 dropped:0 overruns:0 frame:0
          TX packets:22 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:1456 (1.4 KB)  TX bytes:1456 (1.4 KB)
----- ここまで -----


おなじセグメントの別ホスト 2001:****:****:200::fb でのパケットキャプチャ
の結果

a) 固定 IPv6 アドレスの重複チェック? 次の固定 IPv6 アドレスのチェック
まで 0.5秒弱空いている。以下 ICMP6 が続く。

b) sleep 10 後の ping6 のための ND。はじめて 2001:****:****:200::18 が
出現する

c) sleep 10 後の ping6 の ICMP6 echo request

----- ここから -----
    09:36:19.566270 ARP, Reverse Request who-is 00:0c:29:68:f9:ac tell 00:0c:29:68:f9:ac, length 46
    09:36:33.855398 ARP, Reverse Request who-is 00:0c:29:68:f9:ac tell 00:0c:29:68:f9:ac, length 46
    09:36:33.855408 ARP, Reverse Request who-is 00:0c:29:68:f9:ac tell 00:0c:29:68:f9:ac, length 46
    09:36:33.855594 ARP, Reverse Request who-is 00:0c:29:68:f9:ac tell 00:0c:29:68:f9:ac, length 46
    09:36:33.855654 ARP, Reverse Request who-is 00:0c:29:68:f9:ac tell 00:0c:29:68:f9:ac, length 46
    09:36:33.855774 ARP, Reverse Request who-is 00:0c:29:68:f9:ac tell 00:0c:29:68:f9:ac, length 46
    09:36:33.855830 ARP, Reverse Request who-is 00:0c:29:68:f9:ac tell 00:0c:29:68:f9:ac, length 46
    09:36:33.856214 ARP, Reverse Request who-is 00:0c:29:68:f9:ac tell 00:0c:29:68:f9:ac, length 46
    09:36:33.856276 ARP, Reverse Request who-is 00:0c:29:68:f9:ac tell 00:0c:29:68:f9:ac, length 46
    09:36:33.856381 ARP, Reverse Request who-is 00:0c:29:68:f9:ac tell 00:0c:29:68:f9:ac, length 46
    09:36:33.856424 ARP, Reverse Request who-is 00:0c:29:68:f9:ac tell 00:0c:29:68:f9:ac, length 46
    09:36:33.873439 IP6 :: > ff02::16: HBH ICMP6, multicast listener report v2, 1 group record(s), length 28
    09:36:33.903077 ARP, Request who-has 192.168.120.109 tell 192.168.120.108, length 46
    09:36:33.954421 ARP, Reverse Request who-is 00:0c:29:68:f9:ac tell 00:0c:29:68:f9:ac, length 46
    09:36:33.957528 ARP, Reverse Request who-is 00:0c:29:68:f9:ac tell 00:0c:29:68:f9:ac, length 46
    09:36:33.973313 IP6 :: > ff02::16: HBH ICMP6, multicast listener report v2, 2 group record(s), length 48
    09:36:34.103060 IP6 :: > ff02::1:ff68:f9ac: ICMP6, neighbor solicitation, who has fe80::20c:29ff:fe68:f9ac, length 24
    09:36:34.148133 ARP, Reverse Request who-is 00:0c:29:68:f9:ac tell 00:0c:29:68:f9:ac, length 46
    09:36:34.163324 IP6 :: > ff02::16: HBH ICMP6, multicast listener report v2, 3 group record(s), length 68
    09:36:34.233080 ARP, Request who-has 192.168.120.1 tell 192.168.120.108, length 46
(a) 09:36:34.673082 IP6 :: > ff02::1:ff00:18: ICMP6, neighbor solicitation, who has 2001:****:****:200::18, length 24
    09:36:34.856201 ARP, Reverse Request who-is 00:0c:29:68:f9:ac tell 00:0c:29:68:f9:ac, length 46
    09:36:35.053064 IP6 :: > ff02::1:ff00:d: ICMP6, neighbor solicitation, who has 2001:****:****:200::d, length 24
    09:36:35.103070 IP6 fe80::20c:29ff:fe68:f9ac > ff02::2: ICMP6, router solicitation, length 16
    09:36:35.856206 ARP, Reverse Request who-is 00:0c:29:68:f9:ac tell 00:0c:29:68:f9:ac, length 46
    09:36:36.856220 ARP, Reverse Request who-is 00:0c:29:68:f9:ac tell 00:0c:29:68:f9:ac, length 46
    09:36:38.856252 ARP, Reverse Request who-is 00:0c:29:68:f9:ac tell 00:0c:29:68:f9:ac, length 46
    09:36:39.103111 IP6 fe80::20c:29ff:fe68:f9ac > ff02::2: ICMP6, router solicitation, length 16
    09:36:39.903456 IP6 fe80::20c:29ff:fe68:f9ac > ff02::16: HBH ICMP6, multicast listener report v2, 3 group record(s), length 68
    09:36:41.856285 ARP, Reverse Request who-is 00:0c:29:68:f9:ac tell 00:0c:29:68:f9:ac, length 46
    09:36:43.103165 IP6 fe80::20c:29ff:fe68:f9ac > ff02::2: ICMP6, router solicitation, length 16
(b) 09:36:44.513184 IP6 2001:****:****:200::18 > ff02::1:ff00:fb: ICMP6, neighbor solicitation, who has 2001:****:****:200::fb, length 32
    09:36:44.513229 IP6 2001:****:****:200::fb > 2001:****:****:200::18: ICMP6, neighbor advertisement, tgt is 2001:****:****:200::fb, length 32
(c) 09:36:44.513376 IP6 2001:****:****:200::18 > 2001:****:****:200::fb: ICMP6, echo request, seq 1, length 64
    09:36:44.513392 IP6 2001:****:****:200::fb > 2001:****:****:200::18: ICMP6, echo reply, seq 1, length 64
    09:36:44.833213 ARP, Request who-has 192.168.120.14 tell 192.168.120.13, length 46
    09:36:44.973180 IP6 2001:****:****:200::d > ff02::1:ff00:1: ICMP6, neighbor solicitation, who has 2001:****:****:200::1, length 32
    09:36:45.833190 IP6 2001:****:****:200::d > ff02::1:ff00:e: ICMP6, neighbor solicitation, who has 2001:****:****:200::e, length 32
    09:36:46.856326 ARP, Reverse Request who-is 00:0c:29:68:f9:ac tell 00:0c:29:68:f9:ac, length 46
    09:36:49.504586 IP6 fe80::224:81ff:fee7:1974 > 2001:****:****:200::18: ICMP6, neighbor solicitation, who has 2001:****:****:200::18, length 32
    09:36:49.504741 IP6 2001:****:****:200::18 > fe80::224:81ff:fee7:1974: ICMP6, neighbor advertisement, tgt is 2001:****:****:200::18, length 24
    09:36:54.503280 IP6 fe80::20c:29ff:fe68:f9ac > fe80::224:81ff:fee7:1974: ICMP6, neighbor solicitation, who has fe80::224:81ff:fee7:1974, length 32
    09:36:54.503327 IP6 fe80::224:81ff:fee7:1974 > fe80::20c:29ff:fe68:f9ac: ICMP6, neighbor advertisement, tgt is fe80::224:81ff:fee7:1974, length 24
    09:36:54.856411 ARP, Reverse Request who-is 00:0c:29:68:f9:ac tell 00:0c:29:68:f9:ac, length 46
    09:36:59.504577 IP6 fe80::224:81ff:fee7:1974 > fe80::20c:29ff:fe68:f9ac: ICMP6, neighbor solicitation, who has fe80::20c:29ff:fe68:f9ac, length 32
    09:36:59.504745 IP6 fe80::20c:29ff:fe68:f9ac > fe80::224:81ff:fee7:1974: ICMP6, neighbor advertisement, tgt is fe80::20c:29ff:fe68:f9ac, length 24
    09:37:07.856539 ARP, Reverse Request who-is 00:0c:29:68:f9:ac tell 00:0c:29:68:f9:ac, length 46
    09:37:28.856751 ARP, Reverse Request who-is 00:0c:29:68:f9:ac tell 00:0c:29:68:f9:ac, length 46
    09:39:55.214706 ARP, Reply 192.168.120.13 is-at 00:0c:29:68:f9:ac, length 46
----- ここまで -----


問題を観察したホストの /etc/network/interfaces

二つ目の address 2001:****:****:200::d を iface eth0:0 とするのが正しい
指定方法かどうかはわかりません。こう指定しても、ifconfig の結果では
IPv6 アドレス自体は両方とも正しく eth0 に表示されます。

----- ここから -----
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet static
        address 192.168.120.108
        netmask 255.255.255.0
        network 192.168.120.0
        broadcast 192.168.120.255
        gateway 192.168.120.1
auto eth0:0
iface eth0:0 inet static
        address 192.168.120.13
        netmask 255.255.255.0
iface eth0 inet6 static
        address 2001:****:****:200::18
        netmask 64
        gateway 2001:****:****:200::1
iface eth0:0 inet6 static
        address 2001:****:****:200::d
        netmask 64
----- ここまで -----


-- 
荻野 充 (おぎの みつる) ... 「萩(はぎ)」にあらず
Key fingerprint = 7F26 5414 1805 F31B 1617  10B7 C117 07AE 1691 9BD1



ubuntu-jp メーリングリストの案内