このページで解説している内容は、以下の YouTube 動画の解説で見ることができます。

スイッチのIPv6設定(sdm prefer)

スイッチのIPv6設定(準備)」の続きです。ネットワークの構成は、下図のとおりです。

S1スイッチの設定

Packet Tracer で使用するスイッチは、Catalyst 2960を使用します。

まず、下のコマンドを実行しておきます。

Switch#configure terminal
Switch(config)#hostname S1
S1(config)#end
S1#copy run start

IPv6アドレスの設定

S1#configure terminal
S1(config)#int vlan1
S1(config-if)#ipv6 address 2001:db8:cc1e:1::2/64
        ^
% Invalid input detected at ‘^’ marker.

IPv6アドレスを適用するコマンドでエラーが出ます。

 Catalyst 2960のデフォルトの スイッチデータベースマネージャ(SDM)テンプレートは、「default」となっており、IPv6 がサポートされていないからです。

 IPv6アドレスを VLAN1の SVI に適用する前に、SDMテンプレートを「dual-ipv4-and-ipv6」に切り替えておく必要があります。

S1スイッチに搭載されているIOSを調べます。

S1#show flash

Switch#show flash
Directory of flash:/

    1  -rw-     4670455          <no date>  2960-lanbasek9-mz.150-2.SE4.bin

64016384 bytes total (59345929 bytes free)

IOSが「c2960-lanbase-mz.122-25.FX.bin」となっています。

 スイッチをIPv6 に対応させるには、Cisco IOS Release 15.2(2) 以上のIOSにする必要があります。そこで、IOSをアップグレードさせます。

スイッチIOSのインストール

 S1スイッチにIOSをインストールします。以下のコマンドを実行します。TFTP Serverと通信を行うためにIPv4アドレスを割り当てておきます。

S1#conf t
S1(config)#int vlan1
S1(config-if)#ip adress 192.168.1.1 255.255.255.0
S1(config-if)#no shutdown
S1(config-if)#end
S1#copy run start
S1#copy tftp flash

S1#copy tftp flash
Address or name of remote host []? 192.168.1.10
Source filename []? c2960-lanbasek9-mz.150-2.SE4.bin
Destination filename [c2960-lanbasek9-mz.150-2.SE4.bin]? 

Accessing tftp://192.168.1.10/c2960-lanbasek9-mz.150-2.SE4.bin....
Loading c2960-lanbasek9-mz.150-2.SE4.bin from 192.168.1.10: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
[OK - 4670455 bytes]

4670455 bytes copied in 3.083 secs (121792 bytes/sec)
S1#

S1スイッチで「show flash」コマンドを実行します。

S1#sh flash: 
Directory of flash:/

    1  -rw-     4414921          <no date>  c2960-lanbase-mz.122-25.FX.bin
    8  -rw-     4670455          <no date>  c2960-lanbasek9-mz.150-2.SE4.bin
    7  -rw-        1089          <no date>  config.text

64016384 bytes total (54929919 bytes free)

flash に保存されているスイッチIOSが表示されます。

 スイッチIOS「c2960-lanbase-mz.122-25.FX.bin」を削除して、S1スイッチを再起動させます。再起動させないと、スイッチIOS「c2960-lanbasek9-mz.150-2.SE4.bin」に切り替わりません。

以下のコマンドを実行します。IOSを削除したら「reload」コマンドで再起動させます。

S1#delete c2960-lanbase-mz.122-25.FX.bin

S1#delete c2960-lanbase-mz.122-25.FX.bin
Delete filename [c2960-lanbase-mz.122-25.FX.bin]?
Delete flash:/c2960-lanbase-mz.122-25.FX.bin? [confirm]

S1#reload

再起動させると。IOS「c2960-lanbasek9-mz.150-2.SE4.bin」に切り替わります。

切り替えは「sdm prefer dual-ipv4-and-ipv6 default」コマンドで指定します。

 IPv6機能を使用する場合、SDM を「dual-IPv4-and-ipv6」テンプレート、または「lanbase-routing」テンプレートのいずれかを使用する必要があります。

show sdm prefer

現在使用中のSDMを確認するには、「show sdm prefer」コマンドを実行します。

●S1スイッチの「show sdm prefer」の出力

S1#sh sdm prefer 
 The current template is "default" template.
 The selected template optimizes the resources in
 the switch to support this level of features for
 0 routed interfaces and 1024 VLANs.

  number of unicast mac addresses:                  8K
  number of IPv4 IGMP groups + multicast routes:    0.25K
  number of IPv4 unicast routes:                    0
  number of IPv6 multicast groups:                  0
  number of directly-connected IPv6 addresses:      0
  number of indirect IPv6 unicast routes:           0
  number of IPv4 policy based routing aces:         0
  number of IPv4/MAC qos aces:                      0.125k
  number of IPv4/MAC security aces:                 0.375k
  number of IPv6 policy based routing aces:         0
  number of IPv6 qos aces:                          20
  number of IPv6 security aces:                     25

SDMテンプレートが、デフォルトの「default」になっていることが確認できます。

SDMの切り替え

 SDMテンプレートを「dual-ipv4-and-ipv6」に切り替えます。SDMテンプレートを切り替えるには、コマンドでSDMテンプレートを指定した後に、スイッチを再起動する必要があります。

どのSDMテンプレートがサポートされているのかを確認します。

S1(config)#sdm prefer ?

●「sdm prefer ?」の出力

S1(config)#sdm prefer ?
  default             Default bias
  dual-ipv4-and-ipv6  Support both IPv4 and IPv6
  lanbase-routing     Lanbase routing
  qos                 Qos bias

下記コマンドを実行します。「reload」コマンドで

Switch#configure terminal
S1(config)#sdm prefer dual-ipv4-and-ipv6 default
Changes to the running SDM preferences have been stored, but cannot take effect until the next reload.
Use ‘show sdm prefer’ to see what SDM preference is currently active.
S1(config)#end
S1#copy run start
S1#reload

IPv6 アドレスの適用

S1スイッチに IPv6 アドレスを割り当てます。以下のコマンドを実行します。

S1#configure terminal
S1(config)#int vlan 1
S1(config-if)#ipv6 enable
S1(config-if)#ipv6 address 2001:db8:cc1e:1::2/64
S1(config-if)#no shutdown
S1(config-if)#exit
S1(config)#

IPv6スタティックルートの設定

S1スイッチに スタティックルートを設定します。以下のコマンドを実行します。

S1(config)#ipv6 unicast-routing
S1(config)#ipv6 route 2001:db8:cc1e:a::/64 2001:db8:cc1e:1::1
S1(config)#end
S1#copy run start

疎通確認

PC2へpingします。

S1#ping 2001:db8:cc1e:a::3

S1#ping 2001:db8:cc1e:a::3

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2001:db8:cc1e:a::3, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 0/0/0 ms

S1#

まとめ

 Cataryst 2960スイッチを IPv6 に対応させるには、Cisco IOS Release 15.2(2) 以上のIOSにする必要があります。IOSをアップグレードを行ってから、IPv6コマンドでIPv6の設定を行うようになります。

関連コンテンツ