2011年4月27日水曜日

IPv6 基本設定

IPv6 の基本設定をまとめてみました。


ネットワーク構成図

[Ubuntu]----eth1[Vyatta]eth2----[CentOS]

  • Vyatta: VC6.2-2011.02.09
  • Ubuntu: Ubntu 11.04
  • CentOS: CentOS 5.6


Vyatta での IPv6 基本設定

  • eth1、eth2 にアドレスを割り当てます。
  • ルータ広告 (RA) によるステートレス アドレス 自動設定を有効にします。

$ configure
# set interfaces ethernet eth1 description "VLAN 333"
# set interfaces ethernet eth1 address fd42:737e:7cbd:1::1/64
# set interfaces ethernet eth1 ipv6 router-advert prefix fd42:737e:7cbd:1::/64
# set interfaces ethernet eth2 address fd42:737e:7cbd:2::1/64
# set interfaces ethernet eth2 description "VLAN 334"
# set interfaces ethernet eth2 ipv6 router-advert prefix fd42:737e:7cbd:2::/64
# commit
# save
# exit
$ show interfaces
(抜粋)
Interface IP Address State Link Description
eth1 fd42:737e:7cbd:1::1/64 up up VLAN 333
eth2 fd42:737e:7cbd:2::1/64 up up VLAN 334
$ show ipv6 route
(抜粋)
C>* fd42:737e:7cbd:1::/64 is directly connected, eth1
C>* fd42:737e:7cbd:2::/64 is directly connected, eth2


Ubuntu

  • eth1 にステートレス アドレス自動設定で、IPv6 アドレスを割り当てる場合 (IPv4 は無し)
$ sudo vi /etc/network/interfaces
$ cat /etc/network/interfaces
(抜粋)
auto eth1
iface eth1 inet6 manual
up /sbin/ifconfig $IFACE up
down /sbin/ifconfig $IFACE down

$ sudo ifup eth1
$ ifconfig eth1 | grep inet6
inet6アドレス: fd42:737e:7cbd:1:20c:29ff:fe0b:e54e/64 範囲:グローバル
inet6アドレス: fe80::20c:29ff:fe0b:e54e/64 範囲:リンク
$ ip -6 ro sh dev eth1
fd42:737e:7cbd:1::/64 proto kernel metric 256 expires 2591766sec
fe80::/64 proto kernel metric 256
default via fe80::20c:29ff:fe34:16c5 proto kernel metric 1024 expires 1566sec hoplimit 64

  • eth1 にステートレス アドレス自動設定で、IPv6 アドレスを割り当てる場合 (IPv4 は固定)
$ sudo vi /etc/network/interfaces
$ cat /etc/network/interfaces
(抜粋)
auto eth1
iface eth1 inet static
address 192.168.33.101
netmask 255.255.255.0

$ sudo ifup eth1
$ ifconfig eth1 | grep inet6
inet6アドレス: fd42:737e:7cbd:1:20c:29ff:fe0b:e54e/64 範囲:グローバル
inet6アドレス: fe80::20c:29ff:fe0b:e54e/64 範囲:リンク
$ ip -6 ro sh dev eth1
fd42:737e:7cbd:1::/64 proto kernel metric 256 expires 2591738sec
fe80::/64 proto kernel metric 256
default via fe80::20c:29ff:fe34:16c5 proto kernel metric 1024 expires 1538sec hoplimit 64


  • eth1 に IPv6 アドレスを固定設定する場合 (RA を受け入れない)
auto eth1
iface eth1 inet6 static
address fd42:737e:7cbd:1::100
netmask 64
gateway fd42:737e:7cbd:1::1
pre-up echo 0 > /proc/sys/net/ipv6/conf/$IFACE/accept_ra

$ sudo ifup eth1
$ ifconfig eth1 | grep inet6
inet6アドレス: fe80::20c:29ff:fe39:9af6/64 範囲:リンク
inet6アドレス: fd42:737e:7cbd:1::100/64 範囲:グローバル
$ ip -6 ro sh dev eth1
fd42:737e:7cbd:1::/64 proto kernel metric 256
fe80::/64 proto kernel metric 256
default via fd42:737e:7cbd:1::1 metric 1


(作成中...)



参考

0 件のコメント: