OSPF無法建立鄰居關係的幾個案例

        OSPF是一個鏈路狀態路由協議。路由器之間用Hello包來發現並建立完全的鄰接關係之後,方能傳遞各自的鏈路狀態信息,並依靠自己得到的這些信息來創建Database,用SPF算法來計算出最佳路由。所以,OSPF路由器之間的鄰接關係,是最基礎的。下面就自己對OSPF實驗中的一些無法建立鄰接關係的案例,作出一些解釋和討論,希望各位老師同學指正。

 

    一、被動接口:Passive-Interface:(注:passive-interface在各種路由協議中的區別)
     
     

     
    實驗準備:
    1,R1和R2運行OSPF
    2,在R2上將S0/0配置爲被動接口
     
    實驗配置:
    R1:
    interface Loopback0
     ip address 1.1.1.1 255.255.255.0
    interface Serial0/0
     ip address 12.12.12.1 255.255.255.0
    router ospf 1
     log-adjacency-changes
     network 1.1.1.0 0.0.0.255 area 0
     network 12.12.12.0 0.0.0.255 area 0
     
    R2:
    interface Loopback0
     ip address 2.2.2.2 255.255.255.0
    interface Serial0/0
     ip address 12.12.12.2 255.255.255.0
     clockrate 128000
    router ospf 1
     log-adjacency-changes
     passive-interface Serial0/0    //配置被動接口
     network 2.2.2.0 0.0.0.255 area 0
     network 12.12.12.0 0.0.0.255 area 0
     
    實驗結果:(clear ip ospf process)
    1,在R1上合R2上sh ip ospf database分別查看OSPF Databse:
    R1#sh ip ospf da
     
                OSPF Router with ID (1.1.1.1) (Process ID 100)
     
                    Router Link States (Area 0)
     
    Link ID         ADV Router      Age         Seq#       Checksum Link count
    1.1.1.1         1.1.1.1         2           0x80000001 0x00228F 2
     
    R2#sh ip ospf da
     
                OSPF Router with ID (2.2.2.2) (Process ID 100)
     
                    Router Link States (Area 0)
     
    Link ID         ADV Router      Age         Seq#       Checksum Link count
    2.2.2.2         2.2.2.2         12          0x80000001 0x00287D 2
     
     
    2,在R2上查看OSPF端口狀態:
    R2#sh ip ospf interface
    Serial0/0 is up, line protocol is up ************************* *****************************No Hellos (Passive interface) //不發送Hello包(被動接口)
     
    3,在R2上debug:
    R2#debug ip packet
    *Mar 1 00:04:18.627: IP: s=12.12.12.1 (Serial0/0), d=224.0.0.5, len 80, rcvd 0
    R2可以收到R1發往組播224.0.0.5的信息,但是並不接受,被動接口既不發送任何信息,也不會接受。
     
     
    實驗說明:
    R2的S0/0被配置爲被動接口(passive-interface),不發送和接收任何信息。
    Cisco 命令手冊:
    For the Open Shortest Path First (OSPF) protocol, OSPF routing information is neither sent nor received through the specified router interface. The specified interface address appears as a stub network in the OSPF domain
     
     
    *********************************************************************************************************
    二,廣播鏈路上接口IP掩碼不匹配
     
     

     
    實驗配置:
    1,R1和R2運行OSPF
    2,兩邊接口掩碼不匹配
    在R1的F0/0接口配置IP:
    R1(config-if)#int f0/0
    R1(config-if)#ip add 12.12.12.1 255.255.255.0          //掩碼24位
    R1(config-if)#no sh
    在R2的F0/0接口配置IP:
    R2(config)#int f0/0
    R2(config-if)#ip add 12.12.12.2 255.255.255.252    //掩碼30位
     
    實驗結果:
    1,R1與R2無法建立OSPF鄰居關係
    2,在R1上debug ip ospf hello
    R1#debug ip os hello
    *Mar 1 00:07:57.431: OSPF: Rcv hello from 2.2.2.2 area 0 from FastEthernet0/0 12.12.12.2
    *Mar 1 00:07:57.431: OSPF: Mismatched hello parameters from 12.12.12.2
    *Mar 1 00:07:57.431: OSPF: Dead R 40 C 40, Hello R 10 C 10 Mask R 255.255.255.252 C 255.255.255.0
     
    可以發現:R1在收到R2發送來的Hello包後,由於掩碼不匹配,所以無法建立鄰接關係。
     
    ********************************************************************************************************
    三,Helo時間不匹配
     
     

     
    實驗準備:
    1,R1與R2運行OSPF
    2,R2上修改Hello時間
     
    實驗配置:
    R1:
    R1(config)#int lo 0
    R1(config-if)#ip add 1.1.1.1 255.255.255.0
    R1(config-if)#int f0/0
    R1(config-if)#ip add 12.12.12.1 255.255.255.0
    R1(config-if)#no sh
    R1(config)#router ospf 10
    R1(config-router)#router-id 1.1.1.1
    R1(config-router)#log
    R1(config-router)#net 1.1.1.0 0.0.0.255 area 0
    R1(config-router)#net 12.12.12.0 0.0.0.255 area 0
    R1(config-router)#exit
     
    R2:
    R2(config)#int lo0 
    R2(config-if)#ip add 2.2.2.2 255.255.255.0
    R2(config-if)#int f0/0
    R2(config-if)#ip add 12.12.12.2 255.255.255.0
    R2(config-if)#ip ospf hello-interval 20                  //修改R2的F0/0的OSPF的Hello包間隔時間爲20秒
    R2(config-if)#no sh
    R2(config-if)#exit
    R2(config)#router ospf 10
    R2(config-router)#router-id 2.2.2.2
    R2(config-router)#log
    R2(config-router)#net 2.2.2.0 0.0.0.255 area 0
    R2(config-router)#net 12.12.12.0 0.0.0.255 area 0
    R2(config-router)#exit
     
    實驗結果:
    R1與R2的OSPF鄰居關係Down掉。
    在R1上debug ip ospf hello
    R1#debug ip ospf hello
    *Mar 1 00:09:19.083: OSPF: Rcv hello from 2.2.2.2 area 0 from FastEthernet0/0 12.12.12.2
    *Mar 1 00:09:19.083: OSPF: Mismatched hello parameters from 12.12.12.2
    *Mar 1 00:09:19.087: OSPF: Dead R 80 C 40, Hello R 20 C 10 Mask R 255.255.255.0 C 255.255.255.0
    Hello時間不匹配
    在R2上查看OSPF接口狀態:
    R2#sh ip ospf int f0/0
    FastEthernet0/0 is up, line protocol is up ********************************************
    Timer intervals configured, Hello 20, Dead 80, Wait 80
    說明:
    1、如果修改了hello時間,則dead時間和wait時間會自動修改成修改參數的4倍。
    2、如果修改dead時間或者wait時間, hello時間不發生變化,而wait時間發生變化。
    3、不能修改wait時間。
    ********************************************************************************************************
    四,Secondary地址:
     
     

    實驗準備:
    1,R1與R2運行OSPF協議
    2,R2的F0/0接口IP:12.12.12.2/24配置爲第二地址
     
    實驗配置:
    R1:
    interface Loopback0
     ip address 1.1.1.1 255.255.255.0
    !
    interface FastEthernet0/0
     ip address 12.12.12.1 255.255.255.0
     duplex auto
     speed auto
    !
    router ospf 100
     router-id 1.1.1.1
     log-adjacency-changes
     network 1.1.1.0 0.0.0.255 area 0
     network 12.12.12.0 0.0.0.255 area 0
     
    R2:
    interface Loopback0
     ip address 2.2.2.2 255.255.255.0
    !
    interface FastEthernet0/0
     ip address 12.12.12.2 255.255.255.0 secondary     //將12.12.12.2 配置爲secondary地址
     ip address 10.10.10.10 255.255.255.0
     duplex auto
     speed auto
    !
    router ospf 100
     router-id 2.2.2.2
     log-adjacency-changes
     network 2.2.2.0 0.0.0.255 area 0
     network 10.10.10.0 0.0.0.255 area 0
     network 12.12.12.0 0.0.0.255 area 0
     
    實驗結果:
    R1與R2無法建立OSPF鄰接關係
    在R2上debug ip ospf hello
    R2#debug ip ospf hello
    R2#
    *Mar 1 00:19:10.623: OSPF: Send hello to 224.0.0.5 area 0 on FastEthernet0/0 from 10.10.10.10
    R2#
    *Mar 1 00:19:20.623: OSPF: Send hello to 224.0.0.5 area 0 on FastEthernet0/0 from 10.10.10.10
    R2#
    *Mar 1 00:19:30.623: OSPF: Send hello to 224.0.0.5 area 0 on FastEthernet0/0 from 10.10.10.10
    可以發現:雖然已經將12.12.12.0/24宣告到ospf 100,但是由於12.12.12.2爲secondary addreass,所以R2只會從10.10.10.10發送Hello包到224.0.0.5
    在R1上debug OSPF Hello包和Adj
    R1#debug ip ospf hello
    R1#debug ip ospf adj
    R1#
    *Mar 1 00:22:35.031: OSPF: Send hello to 224.0.0.5 area 0 on FastEthernet0/0 from 12.12.12.1
    R1#
    *Mar 1 00:22:41.015: OSPF: Rcv pkt from 10.10.10.10, FastEthernet0/0, area 0.0.0.0 : src not on the same network
    可以發現:R1收到了R2發送到224.0.0.5的packet,但是由於not on the same netword,所以無法建立鄰接關係。
    ********************************************************************************************************
     
    五,兩邊Router ID相同:
     
     
     

    實驗準備
    1,R1與R2運行OSPF
    2,將R1與R2的router-id均設置爲3.3.3.3
     
    實驗配置:
    R1:
    interface Loopback0
     ip address 1.1.1.1 255.255.255.0
    !
    interface FastEthernet0/0
     ip address 12.12.12.1 255.255.255.0
     duplex auto
     speed auto
    !
    router ospf 100
     router-id 3.3.3.3
     log-adjacency-changes
     network 1.1.1.0 0.0.0.255 area 0
     network 12.12.12.0 0.0.0.255 area 0
     
    R2:
    interface Loopback0
     ip address 2.2.2.2 255.255.255.0
    !
    interface FastEthernet0/0
     ip address 12.12.12.2 255.255.255.0
     duplex auto
     speed auto
    !
    router ospf 100
     router-id 3.3.3.3
     log-adjacency-changes
     network 2.2.2.0 0.0.0.255 area 0
     network 12.12.12.0 0.0.0.255 area 0
     
    實驗結果:
    R1與R2無法建立OSPF鄰接關係。
    在R1上debug ip ospf hello;debug ip ospf packet; debug ip ospf adj
    R1#
    *Mar 1 00:33:34.139: %OSPF-4-DUP_RTRID_NBR: OSPF detected duplicate router-id 3.3.3.3 from 12.12.12.2 on interface FastEthernet0/0
    提示:發現一樣的router-id
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章