OSPF+VRRPのメモ
IPv4メモ
- デフォルトルートの設定
(config)# ip route 0.0.0.0 0.0.0.0 [ip_address]
デフォルトルートの設定例
(config)# ip route 0.0.0.0 0.0.0.0 192.168.0.254
- OSPFの設定
設定方法
(config)# router ospf [process-id] (config-router)# router-id [router-id] (なくても可) (config-router)# network [network_address/interface_address] [wild_mask] area [num] (config-router)# redistribute connected subnets (経路再配送) ospfのコストを変更する場合 (config)# ip ospf priority [value]
再配送は違うプロトコルのときにも経路を配送してくれる
例えば、RIPとOSPFが設定されているルータはお互いのネットワークの経路情報を知ることができるのでRIPのネットワークからOSPFのネットワークにpingが通る
OSPFの設定例
R1 (config)# router ospf 1 (config-router)# router-id 10.0.0.1 (config-router)# network 10.0.0.8 0.0.0.3 area 0 (config-router)# network 10.0.0.16 0.0.0.3 area 0 (config-router)# redistribute connected subnets R2 (config)# router ospf 1 (config-router)# router-id 10.0.0.2 (config-router)# network 10.0.0.8 0.0.0.3 area 0 (config-router)# network 10.0.0.12 0.0.0.3 area 0 (config-router)# redistribute connected subnets R3 (config)# router ospf 1 (config-router)# router-id 10.0.0.3 (config-router)# network 10.0.0.12 0.0.0.3 area 0 (config-router)# network 10.0.0.16 0.0.0.3 area 0 (config-router)# redistribute connected subnets
networkコマンドの設定は以下でも可能
R1の例のみ記述 (パターン1:厳密ver) (config-router)# network 10.0.0.9 0.0.0.0 area 0 (config-router)# network 10.0.0.17 0.0.0.0 area 0 (パターン2:緩いver) (config-router)# network 0.0.0.0 255.255.255.255 area 0
パターン1:インターフェースのIPアドレスを設定し、それのみ許可
パターン2:全てのネットワークを許可
あとからインターフェースに追加されたときに意図しない動作が発生する可能性あり
- VRRPの設定(R3→R1 or R2)
(config-if)# vrrp [group] ip [ip_address] ルータの優先度を設定する場合 (config-if)# vrrp [group] priority [value]
VRRPの設定例
R1 (config-if)# vrrp 10 ip 10.0.0.1 R2 (config-if)# vrrp 10 ip 10.0.0.1
同じIPアドレスのVRRPに所属させる場合はgroupも同じにする。
また、VRRPのIPアドレスとしてプライマリーとセカンダリーの2つがつけられる。その場合は、group内のVRRPには同じプライマリーとセカンダリーをつけなければならない。