例)Catalyst3550のVRF-Liteにて、ルーティングテーブルを分離して(GRT, VRF-1)、
OSPFによるルーティングを行う。このとき、VRF-1用の
VLANとして、Vlan101を使用する。これにより、GRTではインターネットが不可に、VRF-1のみインターネットが可能になる。
※注意Catalyst 3550では以下のコマンドによるsdmの切り替え及び再起動が必要:「L3TCAM-3-SIZE_CONFLICT: [chars] requires enabling extended routing.」
Switch(config)# sdm prefer extended-match
Switch(config)# exit
Switch# reload
再起動後、VRF-1を作成する。Route Distinguisher番号は適当に100:1にしてみた。
Switch(config)# ip vrf VRF-1
Switch(config-vrf)# rd 100:1
Switch(config-vrf)# exit
各種インターフェースの設定、VRF-1用のVLANとしてvlan101、対向ルーター用の物理インターフェース、PC接続用物理インターフェースを設定し、VRF-1のルーティングテーブルに所属させる。
※すでにIPが設定されているインターフェースに「ip vrf forwarding」設定をするとIPが一旦削除されるので、注意!
Switch(config)# vlan 101
Switch(config-vlan)# name VRF1-VLAN01
Switch(config-vlan)# exit
Switch(config)# interface Vlan101
Switch(config-if)# ip vrf forwarding VRF-1
Switch(config-if)# ip address 192.168.101.254 255.255.255.0
Switch(config-if)# exit
Switch(config)# interface range FastEthernet0/1 - 16
Switch(config-if-range)# switchport access vlan 101
Switch(config)# exit
Switch(config)# interface Port-channel2
Switch(config-if)# no switchport
Switch(config-if)# no cdp enable
Switch(config-if)# no vtp
Switch(config-if)# ip vrf forwarding VRF-1
Switch(config-if)# ip address 172.16.254.253 255.255.255.0
Switch(config-if)# exit
OSPFでルーティングの設定を行う。
※ここで、Type3, 5のLSAを受け取るために「capability vrf-lite」を入れることに注意みたい(Type5 AS EX1が問題なく受信できてるけれどなぜ?)
Switch(config)# router ospf 1 vrf VRF-1
Switch(config-router)# [[network]] 192.168.101.254 0.0.0.0 area 1
Switch(config-router)# network 172.16.254.254 0.0.0.0 area 1
Switch(config-router)# capability vrf-lite
Switch(config-router)# exit
また、sshのsource-interfaceも同様に指定できるが、以下のようにVRF環境のsource-interfaceまで指定できなかった・・・なぜ?