OSPF协议实验

R1

[Huawei]display Ip interface brief ---查看路口命令

Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              unassigned           down       down      
GigabitEthernet0/0/1              192.168.1.1/29       up         up        
GigabitEthernet0/0/2              unassigned           down       down      
LoopBack0                         192.168.1.33/27      up         up(s)     
NULL0                             unassigned           up         up(s) 

R2

Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              unassigned           down       down      
GigabitEthernet0/0/1              192.168.1.2/29       up         up        
GigabitEthernet0/0/2              unassigned           down       down      
LoopBack0                         192.168.1.65/27      up         up(s)     
NULL0                             unassigned           up         up(s)     
[Huawei]

R3

Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              192.168.1.129/30     up         up        
GigabitEthernet0/0/1              192.168.1.3/29       up         up        
GigabitEthernet0/0/2              unassigned           down       down      
LoopBack0                         192.168.1.97/27      up         up(s)     
NULL0                             unassigned           up         up(s)

R4

Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              192.168.1.30/30      up         up        
GigabitEthernet0/0/1              unassigned           down       down      
GigabitEthernet0/0/2              unassigned           down       down      
LoopBack0                         4.4.4.4/24           up         up(s)     
NULL0                             unassigned           up         up(s)     
[R4]

R1

[R1]ospf 1 router-id  1.1.1.1 ---进入ospf

[R1-ospf-1]area 0.0.0.0

[R1-ospf-1-area-0.0.0.0]network 192.168.1.0 0.0.0.7

[R1-ospf-1-area-0.0.0.0]network  192.168.1.33 0.0.0.0

结果

estination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

   192.168.1.65/32  OSPF    10   1           D   192.168.1.2     GigabitEthernet
0/0/0
   192.168.1.97/32  OSPF    10   1           D   192.168.1.3     GigabitEthernet
0/0/0
  192.168.1.128/30  OSPF    10   2           D   192.168.1.3     GigabitEthernet
0/0/0

OSPF routing table status : <Inactive>

链路数据表

<R1>dis ospf lsdb

                 Area: 0.0.0.0
 Type      LinkState ID    AdvRouter          Age  Len   Sequence   Metric
 Router    2.2.2.2         2.2.2.2            746  48    80000006       1
 Router    1.1.1.1         1.1.1.1            745  48    80000008       1
 Router    3.3.3.3         3.3.3.3            685  48    80000006       1
 Network   192.168.1.1     1.1.1.1            745  36    80000004       0
 Sum-Net   192.168.1.128   3.3.3.3            655  28    80000001       1
 邻居表

     OSPF Process 1 with Router ID 1.1.1.1
          Peer Statistic Information
 ----------------------------------------------------------------------------
 Area Id          Interface                        Neighbor id      State    
 0.0.0.0          GigabitEthernet0/0/0             2.2.2.2          Full        
 0.0.0.0          GigabitEthernet0/0/0             3.3.3.3          Full        
 ----------------------------------------------------------------------------
 

[R1]display ospf peer brief 

R2

[R2]ospf 1 router-id  2.2.2.2

[R2-ospf-1]area 0

[R2-ospf-1-area-0.0.0.0]network 192.168.1.2 0.0.0.0

结果

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

   192.168.1.33/32  OSPF    10   1           D   192.168.1.1     GigabitEthernet
0/0/0
   192.168.1.97/32  OSPF    10   1           D   192.168.1.3     GigabitEthernet
0/0/0
  192.168.1.128/30  OSPF    10   2           D   192.168.1.3     GigabitEthernet
0/0/0

OSPF routing table status : <Inactive>
         Destinations : 0        Routes : 0
链路数据表

 Type      LinkState ID    AdvRouter          Age  Len   Sequence   Metric
 Router    2.2.2.2         2.2.2.2            859  48    80000006       1
 Router    1.1.1.1         1.1.1.1            860  48    80000008       1
 Router    3.3.3.3         3.3.3.3            799  48    80000006       1
 Network   192.168.1.1     1.1.1.1            860  36    80000004       0
 Sum-Net   192.168.1.128   3.3.3.3            769  28    80000001       1
 
 邻居表


     OSPF Process 1 with Router ID 2.2.2.2
          Peer Statistic Information
 ----------------------------------------------------------------------------
 Area Id          Interface                        Neighbor id      State    
 0.0.0.0          GigabitEthernet0/0/0             1.1.1.1          Full        
 0.0.0.0          GigabitEthernet0/0/0             3.3.3.3          Full        
 ----------------------------------------------------------------------------
 

R3

[R3]ospf 1 router-id 3.3.3.3

[R3-ospf-1]area 0

[R3-ospf-1-area-0.0.0.0]network 192.168.1.3 0.0.0.0

[R3-ospf-1-area-0.0.0.0]network 192.168.1.97 0.0.0.0

[R3-ospf-1-area-0.0.0.1]network  192.168.1.129 0.0.0.0

结果

SPF routing table status : <Active>
         Destinations : 2        Routes : 2

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

   192.168.1.33/32  OSPF    10   1           D   192.168.1.1     GigabitEthernet
0/0/0
   192.168.1.65/32  OSPF    10   1           D   192.168.1.2     GigabitEthernet
0/0/0

OSPF routing table status : <Inactive>
         Destinations : 0        Routes : 0
链路数据表

     OSPF Process 1 with Router ID 3.3.3.3
         Link State Database 

                 Area: 0.0.0.0
 Type      LinkState ID    AdvRouter          Age  Len   Sequence   Metric
 Router    2.2.2.2         2.2.2.2            912  48    80000006       1
 Router    1.1.1.1         1.1.1.1            912  48    80000008       1
 Router    3.3.3.3         3.3.3.3            850  48    80000006       1
 Network   192.168.1.1     1.1.1.1            912  36    80000004       0
 Sum-Net   192.168.1.128   3.3.3.3            820  28    80000001       1
 
                 Area: 0.0.0.1
 Type      LinkState ID    AdvRouter          Age  Len   Sequence   Metric
 Router    4.4.4.4         4.4.4.4            743  36    80000003       1
 Router    3.3.3.3         3.3.3.3            737  36    80000005       1
 Network   192.168.1.129   3.3.3.3            737  32    80000002       0
 Sum-Net   192.168.1.97    3.3.3.3            820  28    80000001       0
 Sum-Net   192.168.1.65    3.3.3.3            820  28    80000001       1
 Sum-Net   192.168.1.33    3.3.3.3            820  28    80000001       1
 Sum-Net   192.168.1.0     3.3.3.3            820  28    80000001       1
  

邻居表

          Peer Statistic Information
 ----------------------------------------------------------------------------
 Area Id          Interface                        Neighbor id      State    
 0.0.0.0          GigabitEthernet0/0/0             1.1.1.1          Full        
 0.0.0.0          GigabitEthernet0/0/0             2.2.2.2          Full        
 0.0.0.1          GigabitEthernet0/0/1             4.4.4.4          Full        
 --------------------------------------------------------------------------

R4

[R4]ospf 1 router-id 4.4.4.4

[R4-ospf-1-area-0.0.0.1]network 192.168.1.130  0.0.0.0

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

    192.168.1.0/29  OSPF    10   2           D   192.168.1.129   GigabitEthernet
0/0/0
   192.168.1.33/32  OSPF    10   2           D   192.168.1.129   GigabitEthernet
0/0/0
   192.168.1.65/32  OSPF    10   2           D   192.168.1.129   GigabitEthernet
0/0/0
   192.168.1.97/32  OSPF    10   1           D   192.168.1.129   GigabitEthernet
0/0/0

OSPF routing table status : <Inactive>
         Destinations : 0        Routes : 0

链路数据表

     OSPF Process 1 with Router ID 4.4.4.4
         Link State Database 

                 Area: 0.0.0.1
 Type      LinkState ID    AdvRouter          Age  Len   Sequence   Metric
 Router    4.4.4.4         4.4.4.4            787  36    80000003       1
 Router    3.3.3.3         3.3.3.3            783  36    80000005       1
 Network   192.168.1.129   3.3.3.3            783  32    80000002       0
 Sum-Net   192.168.1.97    3.3.3.3            866  28    80000001       0
 Sum-Net   192.168.1.65    3.3.3.3            866  28    80000001       1
 Sum-Net   192.168.1.33    3.3.3.3            866  28    80000001       1
 Sum-Net   192.168.1.0     3.3.3.3            866  28    80000001       1
 
 邻居表

     OSPF Process 1 with Router ID 4.4.4.4
          Peer Statistic Information
 ----------------------------------------------------------------------------
 Area Id          Interface                        Neighbor id      State    
 0.0.0.1          GigabitEthernet0/0/0             3.3.3.3          Full        
 ----------------------------------------------------------------------------
现在[R1]ping 192.168.1.97


[R1]ping 4.4.4.4

配置缺省路由

[R4-ospf-1]default-route-advertise always 

[R3]ping 4.4.4.4

更改接口优先级

[R1-GigabitEthernet0/0/0]ospf dr-priority 0

R2也是

R1J结果

     OSPF Process 1 with Router ID 1.1.1.1
          Peer Statistic Information
 ----------------------------------------------------------------------------
 Area Id          Interface                        Neighbor id      State    
 0.0.0.0          GigabitEthernet0/0/0             2.2.2.2          2-Way       
 0.0.0.0          GigabitEthernet0/0/0             3.3.3.3          Full        
 ----------------------------------------------------------------------------
认证 R1到R3都是一样

[R1-GigabitEthernet0/0/0]ospf authentication-mode md5 1 cipher 12345

[R1-ospf-1-area-0.0.0.1]authentication-mode md5 1 cipher wdy12345

[R4-ospf-1-area-0.0.0.1]authentication-mode md5 1 cipher wdy12345

R3汇总

[R3-ospf-1-area-0.0.0.0]abr-summary 192.168.1.2 255.255.255.128

防滑

[R3]ip route-static 192.168.1.0 25 null 0

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值