[[CISCO入門]]

#setlinebreak(on)

バージョン: &Version; &br;
オンラインユーザー数: &online;
閲覧数表示 本日/トータル: &counter(today); / &counter(total); &br;
最終更新:&lastmod();&br;



*OSPF [#kce05806]


*OSPFパケットの種類 [#o08e59e5]
,1,Hello,ネイバー関係を確立及び維持する(Mキャスト224.0.0.5を定期的に配信)
,2,DBD(DataBase Description),リンクステートDBの同期チェックを行う
,3,LSR(Link-State Request),リンクステート情報(LSA)を要求
,4,LSU(Link-State Update),リンクステート情報(LSA)を送信
,5,LSAck(LS Acknowledgment),Helloを除くパケットの応答確認


*OSPFの優先順位 [#l4dfdfaf]
OSPFプロセスを起動したルータには名前代わりのルータIDという識別子が割当てられる。
ルータIDは32ビットの値でIPアドレスと同じように4オクテットに分割して10進記載する。
ルータIDは重複してはいけない。
一度決定したルータIDが変更されるとネイバー確立のからやり直す必要があり、LSAの交換をして
LSDBを再構成しなければならない。

**1.ルータID [#p36d0d78]
明示的にルータIDが指定されている場合にはIDを参照する

R1(config-router)#router-id 1.1.1.250
R1#clear ip ospf process
Reset ALL OSPF processes? [no]: yes

**2.ループバックIFの最大IP [#o07dd874]
ループバックIFは論理的なIFで、基本的にDownする事が無く
不安定な障害によってIDが変更される事が無い/32指定も可能。
但し最低1つのIFがUPしている必要がある。

SW2(config)#interface loopback 0
SW2(config-if)#ip address 1.1.1.0 255.255.255.255

**3.アクティブなIFの中で最大のIPアドレス [#x3992c07]
ループバックIF以外のアクティブなIF中最大のIPがルータIDとして選出される。
選択されるIFはOSPFが有効であるかは関係ない。
1.2.はDef存在しないので、このプロセスでルータIDが決定される

*DR(Designated Router)/BDR(Backup DR) [#b31257ba]
OSPFではイーサネット環境下でDRとBDRを選出し、効率の良いLSDB同期を行う。

,DR(Designated Router),LSA交換を取りまとめる代表ルータ
,BDR(Backup designated Router),DRのバックアップルータ
,DROTHER,DR/BDR以外のルータ

DR/BDR選出後は各ルータはDR/BDRとだけ隣接関係を確立し、
DROTHER同士は単なるネイバー関係にありLSAは交換しない

OSPFでは下記のマルチキャストを利用する
,224.0.0.5,全OSPFルータ宛
,224.0.0.6,DR/BDR宛

**DR/BDRの選出方法 [#r4530fe8]
OSPFプライオリティ値を基にして選出する
''Defは1''でOSPFが有効な各IFに設定可能

-プライオリティ値が最大のルータがDR
-プライオリティ値が2番目のルータがBDR
-プライオリティ値が0はDROHTERに固定
-プライオリティ値が同じ場合はルータIDが最大のルータがDR、次にルータIDが大きいルータがBDR


**OSPFによって最短パスがルーティングテーブルに格納されるまで [#bf7156c5]
,1,Down状態,プロセス起動かリンクアップ直後Helloパケットを受信していない状態
,2,INIT状態,受信したHelloパケットに自身のIDが無く、双方向通信がまだ確立されていない
,3,2WAY状態,Hello交換が終わってネイバーテーブルに隣接ルータIDを追加。お互いの存在を認識した状態
,4,DR/BDR選出,マルチアクセスNWではDR/BDRの選出される。DROTHERは2WAY状態のままで以降のステップへは進まない
,5,EXSTART状態,隣接関係を持つルータ間で送信開始基準の決定。先をマスター/後をスレーブと呼びルータIDの大きい順に決定
,6,ECHANGE状態,マスターを決定した状態。DBDパケットが送信される。
,7,LOADING状態,各ルータは受信したDBDと自身のLSDBを比較して不足情報をLDR(リクエスト)するマスタはLSAckで答える
,8,FULL状態,隣接ルータとLSDBが完全に同期を取ることが出来た状態。



**コスト計算 [#lbacee23]

''コスト=IFの帯域幅(Mbps) / 100M(bps)''
※小数点以下は切り捨て、1未満は切り上げで1となるので100Mも1Gも10Gも全てコスト1となる


,R1(config-router)#auto-cost reference-bandwidth 1000,コスト計算の分子を100Mから変更
,R1(config-if)#ip ospf cost 10,IFのコストを帯域幅に関係なく強制的に指定左は10Mbps指定
,R1(config-if)#ip ospf 100 area 0,IFでのArea0 プロセス100の有効化
,R1(config-router)#passive-interface default,全ポートでOSPFのパケット停止


**OSPFの起動 [#nb76861f]

 R1(config)#router ospf 100
 R1(config-router)#network 10.1.1.0 0.0.0.255 area 0
 R1(config-router)#network 10.2.2.0 0.0.0.255 area 1


 R2(config)#router ospf 100
 R2(config-router)#network 10.1.1.0 0.0.0.255 area 0
 R2(config-router)#network 10.2.2.0 0.0.0.255 area 1




**コスト計算 [#e2ad2972]

'コスト=IFの帯域幅(Mbps) / 100M(bps)'
※小数点以下は切り捨て、1未満は切り上げで1となるので100Mも1Gも10Gも全てコスト1となる


,R1(config-router)#auto-cost reference-bandwidth 1000,コスト計算の分子を100Mから変更
,R1(config-if)#ip ospf cost 10,IFのコストを帯域幅に関係なく強制的に指定左は10Mbps指定
,R1(config-if)#ip ospf 100 area 0,IFでのArea0 プロセス100の有効化
,R1(config-router)#passive-interface default,全ポートでOSPFのパケット停止


**OSPFの起動 [#f5592e44]

 R1(config)#router ospf 100
 R1(config-router)#network 10.1.1.0 0.0.0.255 area 0
 R1(config-router)#network 10.2.2.0 0.0.0.255 area 1


 R2(config)#router ospf 100
 R2(config-router)#network 10.1.1.0 0.0.0.255 area 0
 R2(config-router)#network 10.2.2.0 0.0.0.255 area 1


**OSPFプライオリティ変更 [#r06f772f]

,R3(config-if)#ip ospf priority 0,IFのプライオリティを0に変更する(Def1)

-変更前、State DR, Priority 1に注目
    R3#show ip ospf interface fastEthernet 0/0
    FastEthernet0/0 is up, line protocol is up
      Internet Address 10.3.3.1/24, Area 1
      Process ID 100, Router ID 1.1.1.100, Network Type BROADCAST, Cost: 10
      Transmit Delay is 1 sec, State DR, Priority 1
      Designated Router (ID) 1.1.1.100, Interface address 10.3.3.1
      Backup Designated router (ID) 1.1.1.140, Interface address 10.3.3.254
      Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
        oob-resync timeout 40
        Hello due in 00:00:03
      Supports Link-local Signaling (LLS)
      Index 1/1, flood queue length 0
      Next 0x0(0)/0x0(0)
      Last flood scan length is 1, maximum is 1
      Last flood scan time is 0 msec, maximum is 0 msec
      Neighbor Count is 1, Adjacent neighbor count is 1
        Adjacent with neighbor 1.1.1.140  (Backup Designated Router)
      Suppress hello for 0 neighbor(s)
-変更後、State DROTHER, Priority 0になっている
    R3#show ip ospf interface fastEthernet 0/0
    FastEthernet0/0 is up, line protocol is up
      Internet Address 10.3.3.1/24, Area 1
      Process ID 100, Router ID 1.1.1.100, Network Type BROADCAST, Cost: 10
      Transmit Delay is 1 sec, State DROTHER, Priority 0
      Designated Router (ID) 1.1.1.140, Interface address 10.3.3.254
      No backup designated router on this network
      Old designated Router (ID) 1.1.1.100, Interface address 10.3.3.1
      Flush timer for old DR LSA due in 00:02:12
      Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
        oob-resync timeout 40
        Hello due in 00:00:03
      Supports Link-local Signaling (LLS)
      Index 1/1, flood queue length 0
      Next 0x0(0)/0x0(0)
      Last flood scan length is 1, maximum is 1
      Last flood scan time is 0 msec, maximum is 0 msec
      Neighbor Count is 1, Adjacent neighbor count is 1
        Adjacent with neighbor 1.1.1.140  (Designated Router)
      Suppress hello for 0 neighbor(s)
    R3#

**SHOWコマンドによる確認 [#e6b4a3cd]

-ネイバー情報
    SW2#show ip ospf neighbor
 
    Neighbor ID     Pri   State           Dead Time   Address         Interface
    1.1.1.100         0   FULL/DROTHER    00:00:35    10.3.3.1        Vlan300
    1.1.1.200         1   FULL/BDR        00:00:38    10.2.2.254      Vlan200
    1.1.1.250         1   FULL/DR         00:00:37    10.2.2.253      Vlan200
    ルータID     ネイバプライオリティ  状態      Deadタイマ(Down検知) ネイバIFのIP    ネイバ接続のIF(自分)

-ネイバー情報の詳細
    SW2#show ip ospf neighbor detail
     Neighbor 1.1.1.100, interface address 10.3.3.1
        In the area 1 via interface Vlan300
        Neighbor priority is 0, State is FULL, 6 state changes
        DR is 10.3.3.254 BDR is 0.0.0.0
        Options is 0x12 in Hello (E-bit L-bit )
        Options is 0x52 in DBD (E-bit L-bit O-bit)
        LLS Options is 0x1 (LR)
        Dead timer due in 00:00:31
        Neighbor is up for 00:15:53
        Index 3/3, retransmission queue length 0, number of retransmission 2
        First 0x0(0)/0x0(0) Next 0x0(0)/0x0(0)
        Last retransmission scan length is 1, maximum is 1
        Last retransmission scan time is 0 msec, maximum is 0 msec
     Neighbor 1.1.1.200, interface address 10.2.2.254
        In the area 1 via interface Vlan200
        Neighbor priority is 1, State is FULL, 6 state changes
        DR is 10.2.2.253 BDR is 10.2.2.254
        Options is 0x12 in Hello (E-bit L-bit )
        Options is 0x52 in DBD (E-bit L-bit O-bit)
        LLS Options is 0x1 (LR)
        Dead timer due in 00:00:33
        Neighbor is up for 00:15:53
        Index 2/2, retransmission queue length 0, number of retransmission 0
        First 0x0(0)/0x0(0) Next 0x0(0)/0x0(0)
        Last retransmission scan length is 0, maximum is 0
        Last retransmission scan time is 0 msec, maximum is 0 msec
     Neighbor 1.1.1.250, interface address 10.2.2.253
        In the area 1 via interface Vlan200
        Neighbor priority is 1, State is FULL, 6 state changes
        DR is 10.2.2.253 BDR is 10.2.2.254
        Options is 0x12 in Hello (E-bit L-bit )
        Options is 0x52 in DBD (E-bit L-bit O-bit)
        LLS Options is 0x1 (LR)
        Dead timer due in 00:00:36
        Neighbor is up for 00:19:10
        Index 1/1, retransmission queue length 0, number of retransmission 0
        First 0x0(0)/0x0(0) Next 0x0(0)/0x0(0)
        Last retransmission scan length is 0, maximum is 0
        Last retransmission scan time is 0 msec, maximum is 0 msec
    SW2#

-ルーティングプロセスのパラメータ確認
    R1#show ip protocols
    Routing Protocol is "ospf 100"  ←OSPFのプロセスID
      Outgoing update filter list for all interfaces is not set
      Incoming update filter list for all interfaces is not set
      Router ID 1.1.1.250       ←ルータID
      It is an area border router   ←ABR(エリア境界ルータ)であることを示す
      Number of areas in this router is 2. 2 normal 0 stub 0 nssa←ルータが所属するエリアの種類と数
      Maximum path: 4                 ←ロードバランス最大数(Def4)
      Routing for Networks:           ←networkコマンドで指定したNWエリア
        10.1.1.0 0.0.0.255 area 0
        10.2.2.0 0.0.0.255 area 1
      Routing on Interfaces Configured Explicitly (Area 0):
        FastEthernet0/0
      Routing on Interfaces Configured Explicitly (Area 1):
        FastEthernet0/1
     Reference bandwidth unit is 1000 mbps ←OSPFコスト計算の分子(Def100)
      Routing Information Sources:         ←リンクステート情報
        Gateway         Distance      Last Update
        10.3.3.1             110      01:18:59
        1.1.1.100            110      00:09:12
        1.1.1.140            110      00:06:02
        1.1.1.150            110      00:27:08
        1.1.1.200            110      00:20:35
        10.2.2.254           110      01:18:01
        Gateway         Distance      Last Update
        10.10.10.254         110      01:19:00
      Distance: (default is 110)           ←アドミニストレーティブディスタンス値

    SW2#show ip ospf interface
    Vlan300 is up, line protocol is up
      Internet Address 10.3.3.254/24, Area 1
      Process ID 100, Router ID 1.1.1.140, Network Type BROADCAST, Cost: 1
      Transmit Delay is 1 sec, State DR, Priority 1
      Designated Router (ID) 1.1.1.140, Interface address 10.3.3.254
      No backup designated router on this network
      Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
        oob-resync timeout 40
        Hello due in 00:00:00
      Supports Link-local Signaling (LLS)
      Cisco NSF helper support enabled
      IETF NSF helper support enabled
      Index 2/2, flood queue length 0
      Next 0x0(0)/0x0(0)
      Last flood scan length is 1, maximum is 3
      Last flood scan time is 0 msec, maximum is 0 msec
      Neighbor Count is 1, Adjacent neighbor count is 1
        Adjacent with neighbor 1.1.1.100
      Suppress hello for 0 neighbor(s)
    Vlan200 is up, line protocol is up
      Internet Address 10.2.2.1/24, Area 1
      Process ID 100, Router ID 1.1.1.140, Network Type BROADCAST, Cost: 1
      Transmit Delay is 1 sec, State DROTHER, Priority 1
      Designated Router (ID) 1.1.1.250, Interface address 10.2.2.253
      Backup Designated router (ID) 1.1.1.200, Interface address 10.2.2.254
      Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
        oob-resync timeout 40
        Hello due in 00:00:00
      Supports Link-local Signaling (LLS)
      Cisco NSF helper support enabled
      IETF NSF helper support enabled
      Index 1/1, flood queue length 0
      Next 0x0(0)/0x0(0)
      Last flood scan length is 0, maximum is 2
      Last flood scan time is 0 msec, maximum is 9 msec
      Neighbor Count is 2, Adjacent neighbor count is 2
        Adjacent with neighbor 1.1.1.200  (Backup Designated Router)
        Adjacent with neighbor 1.1.1.250  (Designated Router)
      Suppress hello for 0 neighbor(s)


    SW2#show ip ospf database
    
                OSPF Router with ID (1.1.1.140) (Process ID 100)
   
                    Router Link States (Area 1)      ←LSAタイプ1(エリア1)
   
    Link ID         ADV Router      Age         Seq#       Checksum Link count
    1.1.1.100       1.1.1.100       1332        0x80000007 0x0037FD 1
    1.1.1.140       1.1.1.140       1329        0x80000003 0x00B810 2
    1.1.1.200       1.1.1.200       799         0x80000002 0x00ADC9 1
    1.1.1.250       1.1.1.250       697         0x80000004 0x007899 1
   
                    Net Link States (Area 1)         ←LSAタイプ2(エリア1)
   
    Link ID         ADV Router      Age         Seq#       Checksum
    10.2.2.253      1.1.1.250       190         0x80000004 0x0013BC
    10.3.3.254      1.1.1.140       1515        0x80000001 0x00B5EE
    
                    Summary Net Link States (Area 1) ←LSAタイプ3(エリア1)
    
    Link ID         ADV Router      Age         Seq#       Checksum
    10.1.1.0        1.1.1.200       560         0x80000002 0x0085D4
    10.1.1.0        1.1.1.250       697         0x80000005 0x0052D2
    10.10.10.0      1.1.1.200       560         0x80000002 0x00BF87
    10.10.10.0      1.1.1.250       697         0x80000005 0x008C85
    SW2#



*OSPFのタイプ [#e82c943f]
OSPFで識別されるNWの種類は3つ

-ポイントツーポイント
-ブロードキャストマルチアクセス
-NBMA

更にNBMAが5種に分けられるので以下のとおり。




,NWモード,変更モード,NBMAモード,DR/BDE選出,ネイバ自動検出,Hello/Deadインターバル(秒),概要
,ポイントツーポイント,-,-,行わない,○,10/40,フレームリレーのサブIF(point-to-point)の場合Def
,ブロードキャストマルチアクセス,-,-,行う,○,10/40,Ethernetで利用される
,NBMA,NBMA,RFC2328準拠モード,行う,×,30/120,DRはサブネット上のOSPFルータと同期を取るため、全てのOSPFルータと隣接関係が必要
,NBMA,ポイントツーマルチポイント,RFC2328準拠モード,行わない,○,30/120,全ての接続をポイントツーポイントの集合体として扱う
,NBMA,ブロードキャスト,シスコ追加モード,行う,○,30/120,Ethernetと同様に扱う、VCに対しHelloパケットをMキャスト224.0.0.5で送信しネイバ自動検出する
,NBMA,ポイントツーマルチポイントノンブロードキャスト,シスコ追加モード,行わない,×,30/120,VC上でBキャストMキャストが流せない場合に使用。Helloパケットでネイバー自動検出が出来ない為手動で設定する必要がある
,NBMA,ポイントツーポイント,シスコ追加モード,行わない,○,10/40,2台1組のルータだけで接続

-ネイバー手動登録コマンド
,SW2(config-router)#neighbor 1.1.1.1,ネイバー関係を手動登録、登録相手へはユニキャストでHelloパケットを送信するコマンドは一方のDR側で構わない


***OSPFのIF種別動作 [#t920ea77]

,LAN,ブロードキャストマルチアクセス
,HDLC/PPPのシリアルIF,ポイントツーポイント
,フレームリレーのメジャーIF,NBMA
,フレームリレーのサブIF,ポイントツーポイント
,フレームリレーのサブIF,NBMA


トップ   編集 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS