梅本肇 / ume@mahoroba.org
ネットワークインターフェイスの状態を見てみる。リスト2はifconfigの結果である。fxp0とfxp1がUPしているのがわかる。fxp1のほうはネットワークにつないでいないので、リンクローカルアドレス(fe80::290:27ff:fe3c:ef5)だけが割り振られている。注目していただきたいのはfxp0だ。何もしていないのに、すでにグローバルアドレス(3ffe:505:2:0:290:27ff:fe4e:f629と2001:200:301:0:290:27ff:fe4e:f629)が割り振られている。
リスト1 rootにデフォルトで設定されているPATH platpc[101]# echo $PATH /usr/local/v6/sbin:/usr/local/v6/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/bin:/usr/X11R6/bin:/root/bin
fxp0は3ffe:505:2:0::/64と2001:200:301::/64というプレフィックスを持つネットワークにつながっている。IPv6のプラグアンドプレイ機能により、自動的にグローバルアドレスが割り振られているのだ。
リスト2 起動直後のネットワークインターフェースの状態 platpc[102]# ifconfig -a fxp0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500 inet 192.168.10.51 netmask 0xffffff00 broadcast 192.168.10.255 inet6 fe80::290:27ff:fe4e:f629@fxp0 prefixlen 64 scopeid 0x1 inet6 3ffe:505:2:0:290:27ff:fe4e:f629 prefixlen 64 inet6 2001:200:301:0:290:27ff:fe4e:f629 prefixlen 64 ether 00:90:27:4e:f6:29 media: autoselect supported media: autoselect 100baseTX <full-duplex> 100baseTX 10baseT/UTP <full-duplex> 10baseT/UTP fxp1: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500 inet6 fe80::290:27ff:fe3c:ef5@fxp1 prefixlen 64 scopeid 0x2 ether 00:90:27:3c:0e:f5 media: autoselect supported media: autoselect 100baseTX <full-duplex> 100baseTX 10baseT/UTP <full-duplex> 10baseT/UTP lp0: flags=8810<POINTOPOINT,SIMPLEX,MULTICAST> mtu 1500 gif0: flags=8010<POINTOPOINT,MULTICAST> mtu 1280 inet6 fe80::290:27ff:fe4e:f629@gif0 prefixlen 64 scopeid 0x4 gif1: flags=8010<POINTOPOINT,MULTICAST> mtu 1280 inet6 fe80::290:27ff:fe4e:f629@gif1 prefixlen 64 scopeid 0x5 gif2: flags=8010<POINTOPOINT,MULTICAST> mtu 1280 inet6 fe80::290:27ff:fe4e:f629@gif2 prefixlen 64 scopeid 0x6 gif3: flags=8010<POINTOPOINT,MULTICAST> mtu 1280 inet6 fe80::290:27ff:fe4e:f629@gif3 prefixlen 64 scopeid 0x7 tun0: flags=8010<POINTOPOINT,MULTICAST> mtu 1500 lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384 inet6 fe80::1@lo0 prefixlen 64 scopeid 0x9 inet6 ::1 prefixlen 128 inet 127.0.0.1 netmask 0xff000000
すると、4台のホストが応答してくれた。応答を返してくれたホストはIPv6に対応しているので、そのアドレスでアクセスすることが期待できる。リスト4は、pianoにリンクローカルアドレスでTELNETしたところだ。
リスト3 誰か返事して platpc[103]# ping6 -w -I fxp0 ff02::1 PING6(56=40+8+8 bytes) fe80::290:27ff:fe4e:f629 --> ff02::1 27 bytes from fe80::290:27ff:fe4e:f629@lo0: platpc 39 bytes from fe80::200:f4ff:fe5e:70dc@fxp0: piano.mahoroba.org 39 bytes from fe80::220:afff:fef8:7c44@fxp0: chaos.mahoroba.org 39 bytes from fe80::220:afff:fef6:e647@fxp0: flute.mahoroba.org 39 bytes from fe80::200:f8ff:fe05:3eae@fxp0: peace.mahoroba.org 27 bytes from fe80::290:27ff:fe4e:f629@lo0: platpc ^C --- ff02::1 ping6 statistics --- 2 packets transmitted, 0 packets received, 100% packet loss
では、経路テーブルを見てみよう。デフォルトの経路も自動的に設定されていることがわかる(リスト5)。この状態で外にも出て行くことが可能である。
リスト4 リンクローカルアドレスでTELNET platpc[108]# telnet fe80::200:f4ff:fe5e:70dc@fxp0 Trying fe80::200:f4ff:fe5e:70dc... Connected to fe80::200:f4ff:fe5e:70dc@fxp0. Escape character is '^]'. FreeBSD/i386 (piano.mahoroba.org) (ttyp4) login:
さて、ここまでで、IPv6がすぐに使用できることがおわかりいただけただろう。IPv6のプラグアンドプレイって便利だよね。もちろん、似たようなことはIPv4でもDHCPを使用すれば実現できる。しかし、IPv6では標準機能として備えている点がすばらしいと思う。
リスト5 経路情報 platpc[110]# netstat -rn Routing tables Internet: Destination Gateway Flags Netif Expire 127.0.0.1 127.0.0.1 UH lo0 192.168.10 link#1 UC fxp0 192.168.10.51 0:90:27:4e:f6:29 UHLW lo0 Internet6: Destination Gateway Flags Netif Expire ::/96 ::1 UGRSc lo0 => default fe80::220:afff:fef8:7c44@fxp0 UGc fxp0 ::1 ::1 UH lo0 ::ffff:0.0.0.0/96 ::1 UGRSc lo0 2001:200:301::/64 link#1 UC fxp0 2001:200:301:0:200:f4ff:fe5e:70dc 0:0:f4:5e:70:dc UHLW fxp0 2001:200:301:0:220:afff:fef8:7c44 0:20:af:f8:7c:44 UHLW fxp0 2001:200:301:0:290:27ff:fe4e:f629 0:90:27:4e:f6:29 UHLW lo0 3ffe:505:2::/64 link#1 UC fxp0 3ffe:505:2:0:200:f4ff:fe5e:70dc 0:0:f4:5e:70:dc UHLW fxp0 3ffe:505:2:0:220:afff:fef8:7c44 0:20:af:f8:7c:44 UHLW fxp0 3ffe:505:2:0:290:27ff:fe4e:f629 0:90:27:4e:f6:29 UHLW lo0 fe80::/10 ::1 UGRSc lo0 fe80::@fxp0/64 link#1 UC fxp0 fe80::200:f4ff:fe5e:70dc@fxp0 0:0:f4:5e:70:dc UHLW fxp0 fe80::200:f8ff:fe05:3eae@fxp0 0:0:f8:5:3e:ae UHLW fxp0 fe80::220:afff:fef6:e647@fxp0 0:20:af:f6:e6:47 UHLW fxp0 fe80::220:afff:fef8:7c44@fxp0 0:20:af:f8:7c:44 UHLW fxp0 fe80::290:27ff:fe4e:f629@fxp0 0:90:27:4e:f6:29 UHLW lo0 fe80::@fxp1/64 link#2 UC fxp1 fe80::@gif0/64 fe80::290:27ff:fe4e:f629@gif0 Uc gif0 fe80::290:27ff:fe4e:f629@gif0 ::1 UH lo0 fe80::@gif1/64 fe80::290:27ff:fe4e:f629@gif1 Uc gif1 fe80::290:27ff:fe4e:f629@gif1 ::1 UH lo0 fe80::@gif2/64 fe80::290:27ff:fe4e:f629@gif2 Uc gif2 fe80::290:27ff:fe4e:f629@gif2 ::1 UH lo0 fe80::@gif3/64 fe80::290:27ff:fe4e:f629@gif3 Uc gif3 fe80::290:27ff:fe4e:f629@gif3 ::1 UH lo0 fe80::@lo0/64 fe80::1@lo0 Uc lo0 fec0::/10 ::1 UGRSc lo0 ff01::/32 ::1 U lo0 ff02::@fxp0/32 link#1 UC fxp0 ff02::@fxp1/32 link#2 UC fxp1 ff02::@gif0/32 fe80::290:27ff:fe4e:f629@gif0 UC gif0 ff02::@gif1/32 fe80::290:27ff:fe4e:f629@gif1 UC gif1 ff02::@gif2/32 fe80::290:27ff:fe4e:f629@gif2 UC gif2 ff02::@gif3/32 fe80::290:27ff:fe4e:f629@gif3 UC gif3 ff02::@lo0/32 fe80::1@lo0 UC lo0
リブートする前に、取り敢えずsendmailの確認。sendmailは勝手に立ち上がらないようになっている。よしよし。:-)
リスト6 /etc/rc.confへのIPv4設定の追加 ifconfig_fxp0="inet 202.227.26.40 netmask 255.255.255.240" defaultrouter="202.227.26.33" # Set to default gateway (or NO).
では、IPv6でクエリーできるか試してみよう(図1)。
リスト7 /etc/resolv.confの設定 domain mahoroba.org nameserver 2001:200:301:0:220:afff:fef8:7c44 nameserver 202.227.26.33
おやっ? IPv6を使ってくれない(図2)。
図1 クエリーを試す platpc[8]# nslookup Default Server: chaos.mahoroba.org Address: 202.227.26.33 >
FreeBSD標準のnslookupである。これでは無理だね。IPv6版bindを入れないといけないのかなと思って、マニュアルを見てみると、IPv6ed Packageとしてbind-8.1.2がインストールされているようだ。/usr/local/bin/にあった。
図2 IPv6を使ってくれない platpc[10]# which nslookup /usr/sbin/nslookup
では、ホスト名でTELNETしてみよう(図4)。大丈夫だね。グローバルアドレスでお話ししていることもわかるだろう。
図3 クエリーの確認ができた platpc[14]# /usr/local/bin/nslookup Default Server: chaos.mahoroba.org Address: 2001:200:301:0:220:afff:fef8:7c44 > set q=any > www.imasy.or.jp. Server: chaos.mahoroba.org Address: 2001:200:301:0:220:afff:fef8:7c44 Non-authoritative answer: www.imasy.or.jp IPv6 address = 2001:200:300:1:220:edff:fe88:788c www.imasy.or.jp IPv6 address = 3ffe:505:0:1:220:edff:fe88:788c www.imasy.or.jp internet address = 202.227.24.5 Authoritative answers can be found from: imasy.or.jp nameserver = tasogare.imasy.or.jp imasy.or.jp nameserver = light.imasy.or.jp tasogare.imasy.or.jp internet address = 202.227.24.5 light.imasy.or.jp internet address = 202.227.24.4 light.imasy.or.jp IPv6 address = 3ffe:505:0:1:2a0:c9ff:fe61:6521 light.imasy.or.jp IPv6 address = 2001:200:300:1:2a0:c9ff:fe61:6521 >
図4 ホスト名でTELNETする platpc[104]# telnet piano.mahoroba.org Trying 2001:200:301:0:200:f4ff:fe5e:70dc... Connected to piano.mahoroba.org. Escape character is '^]'. FreeBSD/i386 (piano.mahoroba.org) (ttyp4) login:
本来は、ネットワークの初期化部分とサーバー群の起動部分を分離し、/etc/rcから適宜起動されるように、rc.net6と/etc/rcを統合すべきなのだろうが、そこまではやってない。これはおそらく、KAMEの配布物にできるだけ近い状態にしておき、FreeBSDやKAMEをバージョンアップする際の便宜を計ったものだろう。
リスト8 /etc/rc.localからのrc.net6の起動部分 # put your local stuff here if [ -f /usr/local/v6/etc/rc.net6 ]; then sh /usr/local/v6/etc/rc.net6 fi echo '.'
リスト9 /etc/rc からKAME版inetdを起動 if [ "X${inetd_enable}" != X"NO" ]; then echo -n ' inetd' if [ -x /usr/local/v6/sbin/inetd ]; then /usr/local/v6/sbin/inetd ${inetd_flags} else inetd ${inetd_flags} fi fi
リスト10 IPv6 対応された/etc/inetd.confの記述(一部抜粋) ftp stream tcp nowait root /usr/local/v6/libexec/ftpd ftpd -l ftp stream tcp6 nowait root /usr/local/v6/libexec/ftpd ftpd -l telnet stream tcp nowait root /usr/local/v6/libexec/telnetd telnetd telnet stream tcp6 nowait root /usr/local/v6/libexec/telnetd telnetd
図5 /etc/sendmail.cf O DaemonPortOptions=Family=inet O DaemonPortOptions=Family=inet6
第3の方法は、IPv6 over IPv4トンネルを使う方法である(図7)。この場合、既存ネットワークにはまったく変更を加える必要がない。やはり、ネイティブにIPv6を流したいところだが、IPv6が市民権を得るまではこの方法でしのぐことになるだろう。
図6 ルータによる接続 ![]()
IPv6プリインストールマシンならば、上記のどの構成も作ることが可能である。ネットワークカードが2枚刺さっているのは、やはりルータ用途を意識したものだろう。
図7 トンネルによる接続 ![]()
図8 Mozilla6でhttp://www.v6.imasy.or.jp/を開いたところ ![]()
また、sendmailやbindなどのIPv6対応サーバー系アプリケーションが入っているし、ApacheなどもKAMEのportsからインストールできるので、サーバー用途にもすぐに使用可能だ。しかし、パーティションの切り方を見ると、/varが128Mバイトしかなく、サーバー用途で使用するにはいささか小さいかもしれない(リスト11)。
図9 Mozilla6でhttp://www.jp.freebsd.org/を開いたところ ![]()
全体的に見て、一応何にでも使えるように考えてあるようだが、その分、狙いが少しぼやけたものになっているようにも感じる。しかしながら、一通りIPv6を試してみるという向きには嬉しいマシンといえるだろう。
リスト11 初期状態のディスク情報 > df -k Filesystem 1K-blocks Used Avail Capacity Mounted on /dev/sd0s1a 127151 14915 102064 13% / /dev/sd0s1h 6145402 2 5653768 0% /home /dev/sd0s1f 1017327 452833 483108 48% /usr /dev/sd0s1g 1017327 84785 851156 9% /usr/local /dev/sd0s1e 127151 2070 114909 2% /var procfs 4 4 0 100% /proc
問い合わせ先
ぷらっとホーム株式会社
本社営業部営業課
Tel.(03)3251-2600