内部からのアクセスもIPv6化

6to4によるトンネル接続とはいえ、IPv6でのアクセスも出来るようになったので、内部にあるクライアントからのアクセスもIPv6で行けるように設定をしてみたので、メモ的エントリー。

radvdでv6アドレスを自動的に割り当てる

まずは、LinuxサーバをIPv6ルータ化するために、radvdをインストール。

# aptitude install radvd
The following NEW packages will be installed:
radvd
0 packages upgraded, 1 newly installed, 0 to remove and 1 not upgraded.
Need to get 0 B/76.8 kB of archives. After unpacking 193 kB will be used.
Selecting previously unselected package radvd.
(Reading database ... 82898 files and directories currently installed.)
Unpacking radvd (from .../radvd_1%3a1.8-1.2_amd64.deb) ...
Processing triggers for man-db ...
Setting up radvd (1:1.8-1.2) ...
dpkg-statoverride: warning: --update given but /var/run/radvd does not exist
Starting radvd:
* /etc/radvd.conf does not exist or is empty.
* See /usr/share/doc/radvd/README.Debian
* radvd will *not* be started.

#

出ているメッセージを見ると分かる通り、インストール直後は設定ファイルである"/etc/radvd.conf"が無いので、radvdは起動しません。
あと、"See /usr/share/doc/radvd/README.Debian"というメッセージがあるので、読んでみると

Furthermore, radvd needs IPv6 forwarding enabled; this can be set by
uncommenting the following line to /etc/sysctl.conf:

,----
| net.ipv6.conf.default.forwarding=1
`----

と書いてあるので、"/etc/sysctl.conf"を変更する必要があるのだけど、ウチの場合は

  diff -u /usr/share/doc/procps/examples/sysctl.conf /etc/sysctl.conf
--- /usr/share/doc/procps/examples/sysctl.conf 2010-02-25 08:20:09.000000000 +0900
+++ /etc/sysctl.conf 2011-11-20 21:05:20.102711448 +0900
@@ -25,12 +25,12 @@
#net.ipv4.tcp_syncookies=1

# Uncomment the next line to enable packet forwarding for IPv4
-#net.ipv4.ip_forward=1
+net.ipv4.ip_forward=1

# Uncomment the next line to enable packet forwarding for IPv6
# Enabling this option disables Stateless Address Autoconfiguration
# based on Router Advertisements for this host
-#net.ipv6.conf.all.forwarding=1
+net.ipv6.conf.all.forwarding=1


###################################################################
@@ -42,7 +42,7 @@
#
# Do not accept ICMP redirects (prevent MITM attacks)
#net.ipv4.conf.all.accept_redirects = 0
-#net.ipv6.conf.all.accept_redirects = 0
+net.ipv6.conf.all.accept_redirects = 0
# _or_
# Accept ICMP redirects only for gateways listed in our default
# gateway list (enabled by default)
@@ -58,3 +58,6 @@
# Log Martian Packets
#net.ipv4.conf.all.log_martians = 1
#
+
+net.ipv6.conf.all.accept_ra = 0
+net.ipv6.conf.all.autoconf = 0

のように変更したあとに、sysctlコマンドで変更した内容を反映。

# sysctl -p /etc/sysctl.conf
net.ipv4.ip_forward = 1
net.ipv6.conf.all.forwarding = 1
net.ipv6.conf.all.accept_redirects = 0
net.ipv6.conf.all.accept_ra = 0
net.ipv6.conf.all.autoconf = 0

"/etc/radvd.conf"を、次のように書いたら、"/etc/init.d/radvd start"。

interface eth1
{
AdvSendAdvert on;
prefix 2002:dadb:95ea:1000::/64
{
AdvOnLink on;
AdvAutonomous on;
};
};

クライアント側の確認

あとは、クライアント側のMac OS Xで"IPv6の構成"を自動にして、IPv6アドレスが割り当てられれば、OK。

システム環境設定 - ネットワーク

この状態でhttp://test-ipv6.jpにアクセスして、下のように見えれば、外向きのアクセスでもIPv6アドレスが使われるはずなのだけど、

http://test-ipv6.jp/ でテスト

どうもLionでのDNSの名前解決の順序がA→AAAAになっているらしく、

注意: あなたのブラウザは IPv6 よりも IPv4 を優先的するようになっています。将来、これは、あなたの場所を推測するサイトの正確性に影響するかもしれません。

という記述が...。
VirtualBoxの方に入れてあるWindows Web Server 2008R2でも同じ結果になるから、どっかで根本的に設定を変える必要があるみたいだなぁ...。

ということで、今のところここまで。
まぁ、IPv6アドレス直接指定や、IPv6オンリーのサイト(ipv6.sony.jpとか)が見れているので、問題はなさそうなんだけど、もう少し色々と調べてみましょうかね。

トラックバック(2)

6to4による接続とはいえ、IPv6ネットワークに繋がったのだから、いろろと試した見たのだけど まぁ、IPv6アドレス直接指定や、IPv6オンリーのサイト... 続きを読む

IPv6 ネタを連発してますが、 El Capitan から IPv4/IPv6... 続きを読む

コメントする