6to4 relay router設定
提供: Tokyo6to4
目次 |
前提環境
- Debian/Ubuntu Linux
このページの記述はDebian GNU/LinuxもしくはUbuntu環境を前提にしています。 (動作検証は Ubuntu 8.04.01 LTS 上で行いましたが、他のバージョンでも同様に動作することが期待されます) 他のOSやLinuxディストリビューションでは設定ファイルが異なります。
モジュールの設定
- /etc/modulesを編集
ipv6モジュールを追加し、利用しないlpモジュールを削除
# diff /etc/modules~ /etc/modules 7d6 < lp 8a8 > ipv6
※ここで ipv6 モジュールを追加することで、起動時に IPv6 プロトコルスタックが /etc/rcS.d/S15module-init-tools の段階で有効になるため、 /etc/rcS.d/S17procps の段階で sysctl 変数から設定できる。
一方、/etc/modules に ipv6 を明示的に記述しない場合には、ipv6 モジュールは /etc/rcS.d/S40networking の段階で読み込まれるので、 S17procps の段階では、当該変数が存在しないため sysctl の設定は行われない。
sysctl の設定
- /etc/sysctl.confを編集
net.ipv6.conf.default.forwarding = 1 net.ipv6.conf.eth0.forwarding = 1
IPv6 でのパケット転送を有効化
# Ignores RA net.ipv6.conf.default.accept_ra = 0
RAの受信を無効化
インタフェースの設定
- /etc/network/interfacesを編集
# The primary network interface
auto eth0
iface eth0 inet static
address 192.0.2.80
netmask 255.255.255.0
gateway 192.0.2.1
iface eth0 inet6 static
address 2001:db8::80
netmask 64
up ip -6 route add default via fe80::20d:56ff:feb8:1f66 dev eth0
auto eth0:0
iface eth0:0 inet static
address 192.88.99.1
netmask 255.255.255.0
auto tun6to4
iface tun6to4 inet6 v4tunnel
endpoint any local 192.88.99.1
up ip -6 route add 2002::/16 dev tun6to4
up ip -6 route add ::/96 dev tun6to4 metric 1
## Add some routes which should never appear on the wire
# Unreachable IPv4-only addresses, normally blocked by source address selection
up ip -6 route add unreach ::ffff:0.0.0.0/96
# Unreachable IPv4-mapped addresses
up ip -6 route add unreach ::0.0.0.0/96
# Unreachable 6to4: IPv4 multicast, reserved, limited broadcast
up ip -6 route add unreach 2002:e000::/19
# Unreachable 6to4: IPv4 loopback
up ip -6 route add unreach 2002:7f00::/24
# Unreachable 6to4: IPv4 private (RFC 1918)
up ip -6 route add unreach 2002:0a00::/24
up ip -6 route add unreach 2002:ac10::/28
up ip -6 route add unreach 2002:c0a8::/32
# Unreachable 6to4: IPv4 private (APIPA / DHCP link-local)
up ip -6 route add unreach 2002:a9fe::/32
# Unreachable IPv6: 6bone test addresses
up ip -6 route add unreach 3ffe:ffff::/32
down ip -6 route flush dev tun6to4
mtu 1472
ttl 128
重要なのは tun6to4 インタフェースの設定。ここで"endpoint any local 192.88.99.1"と指定することで、6to4として機能するインタフェースが作成される。
その他
- /etc/default/locale
コマンドラインで文字化けするといろいろ面倒なので、デフォルトの言語を
LANG="ja_JP.UTF-8"
から
LANG="C"
に変更