Cisco 単一エリアは OSPFv2 を実装します

Cisco 単一エリアは OSPFv2 を実装します

Open Shortest Path First (OSPF) プロトコルはリンク ステート ルーティング プロトコルであり、通常は同じルーティング ドメインで使用されます。

  • 実装手順:
  1. インターフェイスで OSPF を有効にする
  2. ワイルドカードマスク
  3. パッシブインターフェイスの構成
  4. OSPF設定を確認する

以下はospfトポロジです。

アドレス割り当てテーブル

R1構成

R1(config)#router ospf 10                       //进程ID 
R1(config-router)#rou
R1(config-router)#router-id 1.1.1.1             //路由ID

注: ここでは、ospf 構成を入力したばかりで、有効になっていないため、network コマンドを使用して、ospfv2 エリアのルーティング プロセスにどのインターフェイスが参加しているかを決定する必要があります。

したがって、次のステップは、ルーティング テーブルを調べて、どのインターフェイスがルーティング プロセスに参加しているかを判断することです。

R1(config-router)#do show ip rou                     //在配置模式下查看路由表

Gateway of last resort is not set

     172.16.0.0/16 is variably subnetted, 4 subnets, 3 masks
C       172.16.1.0/24 is directly connected, GigabitEthernet0/0
L       172.16.1.1/32 is directly connected, GigabitEthernet0/0
C       172.16.3.0/30 is directly connected, Serial0/0/0
L       172.16.3.1/32 is directly connected, Serial0/0/0
     192.168.10.0/24 is variably subnetted, 2 subnets, 2 masks
C       192.168.10.4/30 is directly connected, Serial0/0/1
L       192.168.10.5/32 is directly connected, Serial0/0/1

ルーティング プロセスに参加したいインターフェイスは s0/0/0、s0/0/1 であることがわかっています。

ワイルドカード マスクを計算する 2 番目のステップに進みます。

  • ワイルドカード マスク ビット 0: アドレス内の対応するビットの値と一致します。
  • ワイルドカード マスク ビット 1: アドレス内の対応するビットの値を無視します。

ワイルドカード マスクではその逆が当てはまります

ワイルドカード マスクを計算する最も簡単な方法は、255.255.255.255 からネットワーク サブネット マスクを減算することです。

ルーティング テーブルの s0/0/0 インターフェイス マスクは 30 ビット、つまり 255.255.255.252 で、255.255.255.255 から 255.255.255.252 を減算した結果は 0.0.0.3 になります。

次のステップは、ネットワークに通知するための network コマンドです。

R1(config-router)#network 172.16.1.0 0.0.0.255 area 0                   //area跟接入域名
R1(config-router)#network 172.16.3.0 0.0.0.3 area 0
R1(config-router)#network 192.168.10.4 0.0.0.3 area 0

単一のドメインを構成しているため、同じドメイン (0) を構成します。ここではデフォルトで 0 に設定されています。

最後に、パッシブインターフェイスを設定します。

ospf ルーティングが有効になっています。デフォルトでは、近隣インターフェイスを検出するために、すべての直接接続されたインターフェイスに Hello パケットが送信されます。注: 現時点では、直接接続されているインターフェイスの状態は Init です。

パッシブ インターフェイスでは隣接関係を形成できないことに注意する必要があります。

PC はルーターとネイバー関係を形成する必要がないため、パッシブ インターフェイスとして構成されます。

パッシブ インターフェイスは、指定されたインターフェイスからルーティング情報が送信されるのを防ぎます。ただし、他のインターフェースから送信される経路情報は、指定されたインターフェースが属するネットワークを広告します。

R1(config)#router ospf 10
R1(config-router)#passive-interface g0/0                    //配置被动接口g0/0

show ip Protocols を使用してOSPF ルーティングを確認する

R1#show ip protocols                                                

Routing Protocol is "ospf 10"                                          //进程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.1                                                    //ospf的id
  Number of areas in this router is 1. 1 normal 0 stub 0 nssa
  Maximum path: 4
  Routing for Networks:    
    172.16.1.0 0.0.0.255 area 0                                        //通告网络
    172.16.3.0 0.0.0.3 area 0        
    192.168.10.4 0.0.0.3 area 0
  Passive Interface(s): 
    GigabitEthernet0/1                                                 //被动接口
  Routing Information Sources:  
    Gateway         Distance      Last Update 
    1.1.1.1              110      00:22:12                             //邻居信息
  Distance: (default is 110)

上記は R1 の単一構成についてのみ説明しました。R2 と R3 のスクリプトは次のとおりです。

R2!!

R2(config)#router ospf 10
R2(config-router)#router-id 2.2.2.2
R2(config-router)#do show ip rou

Gateway of last resort is not set

     172.16.0.0/16 is variably subnetted, 4 subnets, 3 masks
C       172.16.2.0/24 is directly connected, GigabitEthernet0/0
L       172.16.2.1/32 is directly connected, GigabitEthernet0/0
C       172.16.3.0/30 is directly connected, Serial0/0/0
L       172.16.3.2/32 is directly connected, Serial0/0/0
     192.168.10.0/24 is variably subnetted, 2 subnets, 2 masks
C       192.168.10.8/30 is directly connected, Serial0/0/1
L       192.168.10.9/32 is directly connected, Serial0/0/1

R2(config-router)#network 172.16.2.0 0.0.0.255 area 0
R2(config-router)#network 172.16.3.0 0.0.0.3 area 0
R2(config-router)#network 192.168.10.8 0.0.0.3 area 0
R2(config-router)#passive-interface g0/0

R3!!!

R3(config)#router ospf 10
R3(config-router)#router-id 3.3.3.3
R3(config-router)#do show ip rou

Gateway of last resort is not set

     192.168.1.0/24 is variably subnetted, 2 subnets, 2 masks
C       192.168.1.0/24 is directly connected, GigabitEthernet0/0
L       192.168.1.1/32 is directly connected, GigabitEthernet0/0
     192.168.10.0/24 is variably subnetted, 4 subnets, 2 masks
C       192.168.10.4/30 is directly connected, Serial0/0/0
L       192.168.10.6/32 is directly connected, Serial0/0/0
C       192.168.10.8/30 is directly connected, Serial0/0/1
L       192.168.10.10/32 is directly connected, Serial0/0/1

R3(config-router)#network 192.168.1.0 0.0.0.255 area 0
R3(config-router)#network 192.168.10.4 0.0.0.3 area 0
R3(config-router)#network 192.168.10.8 0.0.0.3 area 0
R3(config-router)#passive-interface g0/0

さて、今回はこれで終わりです。また次回お会いしましょう!

おすすめ

転載: blog.csdn.net/weixin_54223979/article/details/116033032