OSPF的实验

实验目的:

1.整个OSPF环境地址为172.16.0.0/16

2.每个路由器有自己的环回

3.R2-R5所在MA网络中,只有R2是DR,其他都是DROTHER

4.R3-R4之间明文认证,R4-R5之间密文认证

5.R3存在环回100,IP为100.1.1.1/24,不能宣告进OSPF

6.区域划分如图,区域编号有0,1,2

7.全网可达

配置ip地址

设备接口地址
R1s4/0/0172.16.0.1/30
R2s4/0/0172.16.0.2/30
R2g0/0/0172.16.0.129/25
R3g0/0/0172.16.0.130/25
R3s4/0/0172.16.0.5/30
R4s4/0/0172.16.0.6/30
R4s4/0/1172.16.0.9/30
R4g0/0/0172.16.0.131/25
R5g0/0/0172.16.0.132/25
R5S4/0/1172.16.0.10/30

配置路由

R1
[r1]interface s4/0/0
[r1-Serial4/0/0]ip address 172.16.0.1 30
[r1]interface LoopBack 0
[r1-LoopBack0]ip address 172.16.1.1 24
R2
[r2]interface g0/0/0 
[r2-GigabitEthernet0/0/0]ip address 172.16.0.129 25
[r2]interface s4/0/0
[r2-Serial4/0/0]ip address 172.16.0.2 30
[r2]interface LoopBack 0            
[r2-LoopBack0]ip address 172.16.2.1 24
R3
[r3]interface g0/0/0
[r3-GigabitEthernet0/0/0]ip address 172.16.0.130 25
[r3]interface s4/0/0
[r3-Serial4/0/0]ip address 172.16.0.5 30
[r3]interface LoopBack 0
[r3-LoopBack0]ip address 172.16.3.1 24
R4
[r4]interface g0/0/0
[r4-GigabitEthernet0/0/0]ip address 172.16.0.131 25
[r4]interface s4/0/0
[r4-Serial4/0/0]ip address 172.16.0.6 30
[r4]interface s4/0/1
[r4-Serial4/0/1]ip address 172.16.0.9 30
[r4]interface LoopBack 0
[r4-LoopBack0]ip address 172.16.4.1 24
R5
[r5]interface g0/0/0
[r5-GigabitEthernet0/0/0]ip address 172.16.0.132 25
[r5]interface s4/0/1
[r5-Serial4/0/1]ip address 172.16.0.10 30
[r5]interface LoopBack 0
[r5-LoopBack0]ip address 172.16.5.1 24
测试连通性

R2与R1、R3、R4、R5

[r2]ping 172.16.0.1
  PING 172.16.0.1: 56  data bytes, press CTRL_C to break
    Reply from 172.16.0.1: bytes=56 Sequence=1 ttl=255 time=50 ms
    Reply from 172.16.0.1: bytes=56 Sequence=2 ttl=255 time=20 ms
    Reply from 172.16.0.1: bytes=56 Sequence=3 ttl=255 time=10 ms
    Reply from 172.16.0.1: bytes=56 Sequence=4 ttl=255 time=10 ms
    Reply from 172.16.0.1: bytes=56 Sequence=5 ttl=255 time=20 ms
​
  --- 172.16.0.1 ping statistics ---
    5 packet(s) transmitted
    5 packet(s) received
    0.00% packet loss
    round-trip min/avg/max = 10/22/50 ms
    [r2]ping 172.16.0.130
  PING 172.16.0.130: 56  data bytes, press CTRL_C to break
    Reply from 172.16.0.130: bytes=56 Sequence=1 ttl=255 time=100 ms
    Reply from 172.16.0.130: bytes=56 Sequence=2 ttl=255 time=60 ms
    Reply from 172.16.0.130: bytes=56 Sequence=3 ttl=255 time=40 ms
    Reply from 172.16.0.130: bytes=56 Sequence=4 ttl=255 time=40 ms
    Reply from 172.16.0.130: bytes=56 Sequence=5 ttl=255 time=50 ms
​
  --- 172.16.0.130 ping statistics ---
    5 packet(s) transmitted
    5 packet(s) received
    0.00% packet loss
    round-trip min/avg/max = 40/58/100 ms
    [r2]ping 172.16.0.131
  PING 172.16.0.131: 56  data bytes, press CTRL_C to break
    Reply from 172.16.0.131: bytes=56 Sequence=1 ttl=255 time=120 ms
    Reply from 172.16.0.131: bytes=56 Sequence=2 ttl=255 time=40 ms
    Reply from 172.16.0.131: bytes=56 Sequence=3 ttl=255 time=40 ms
    Reply from 172.16.0.131: bytes=56 Sequence=4 ttl=255 time=40 ms
    Reply from 172.16.0.131: bytes=56 Sequence=5 ttl=255 time=40 ms
​
  --- 172.16.0.131 ping statistics ---
    5 packet(s) transmitted
    5 packet(s) received
    0.00% packet loss
    round-trip min/avg/max = 40/56/120 ms
​
[r2]ping 172.16.0.132
  PING 172.16.0.132: 56  data bytes, press CTRL_C to break
    Reply from 172.16.0.132: bytes=56 Sequence=1 ttl=255 time=90 ms
    Reply from 172.16.0.132: bytes=56 Sequence=2 ttl=255 time=40 ms
    Reply from 172.16.0.132: bytes=56 Sequence=3 ttl=255 time=40 ms
    Reply from 172.16.0.132: bytes=56 Sequence=4 ttl=255 time=40 ms
    Reply from 172.16.0.132: bytes=56 Sequence=5 ttl=255 time=50 ms
​
  --- 172.16.0.132 ping statistics ---
    5 packet(s) transmitted
    5 packet(s) received
    0.00% packet loss
    round-trip min/avg/max = 40/52/90 ms

R4与R3、R5

[r4]ping 172.16.0.130
  PING 172.16.0.130: 56  data bytes, press CTRL_C to break
    Reply from 172.16.0.130: bytes=56 Sequence=1 ttl=255 time=90 ms
    Reply from 172.16.0.130: bytes=56 Sequence=2 ttl=255 time=40 ms
    Reply from 172.16.0.130: bytes=56 Sequence=3 ttl=255 time=40 ms
    Reply from 172.16.0.130: bytes=56 Sequence=4 ttl=255 time=50 ms
    Reply from 172.16.0.130: bytes=56 Sequence=5 ttl=255 time=60 ms
​
  --- 172.16.0.130 ping statistics ---
    5 packet(s) transmitted
    5 packet(s) received
    0.00% packet loss
    round-trip min/avg/max = 40/56/90 ms
​
[r4]ping 172.16.0.132
  PING 172.16.0.132: 56  data bytes, press CTRL_C to break
    Reply from 172.16.0.132: bytes=56 Sequence=1 ttl=255 time=90 ms
    Reply from 172.16.0.132: bytes=56 Sequence=2 ttl=255 time=50 ms
    Reply from 172.16.0.132: bytes=56 Sequence=3 ttl=255 time=50 ms
    Reply from 172.16.0.132: bytes=56 Sequence=4 ttl=255 time=60 ms
    Reply from 172.16.0.132: bytes=56 Sequence=5 ttl=255 time=30 ms
​
  --- 172.16.0.132 ping statistics ---

ospf配置

R1
[r1]ospf 1 router-id 1.1.1.1  
[r1-ospf-1]area 1
[r1-ospf-1-area-0.0.0.1]network 172.16.0.0 0.0.0.0
R2
[r2]ospf 1 r[r2]ospf 1 router-id 2.2.2.2
[r2-ospf-1]area 1
[r2-ospf-1-area-0.0.0.1]network  172.16.2.1 0.0.0.0
[r2-ospf-1]area 0
[r2-ospf-1-area-0.0.0.0]network 172.16.0.129 0.0.0.0
R3
[r3]ospf 1 router-id 3.3.3.3
[r3-ospf-1]area 0
[r3-ospf-1-area-0.0.0.0]network 172.16.0.130 0.0.0.0
[r3-ospf-1]area 2           
[r3-ospf-1-area-0.0.0.2]network 172.16.0.5 0.0.0.0
[r3-ospf-1-area-0.0.0.2]network 172.16.3.1 0.0.0.
R4
[r4]ospf 1 router-id 4.4.4.4    
[r4-ospf-1]area 0  
[r4-ospf-1-area-0.0.0.0]network 172.16.0.131 0.0.0.0
[r4-ospf-1]area 2
[r4-ospf-1-area-0.0.0.2]network 172.16.4.1 0.0.0.0
[r4-ospf-1-area-0.0.0.2]network 172.16.0.9 0.0.0.0
R5
[r5]ospf 1 router-id 5.5.5.5
[r5-ospf-1]area 0
[r5-ospf-1-area-0.0.0.0]network 172.16.0.132 0.0.0.0
[r5-ospf-1]area 2
[r5-ospf-1-area-0.0.0.2]network 172.16.0.10 0.0.0.0
[r5-ospf-1-area-0.0.0.2]network 172.16.5.1 0.0.0.0

查看ospf表

R1
[r1]display ip routing-table protocol ospf 
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Public routing table : OSPF
         Destinations : 7        Routes : 7        
​
OSPF routing table status : <Active>
         Destinations : 7        Routes : 7
​
Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface
​
     172.16.0.4/30  OSPF    10   97          D   172.16.0.2      Serial4/0/0
     172.16.0.8/30  OSPF    10   97          D   172.16.0.2      Serial4/0/0
   172.16.0.128/25  OSPF    10   49          D   172.16.0.2      Serial4/0/0
     172.16.2.1/32  OSPF    10   48          D   172.16.0.2      Serial4/0/0
     172.16.3.1/32  OSPF    10   49          D   172.16.0.2      Serial4/0/0
     172.16.4.1/32  OSPF    10   49          D   172.16.0.2      Serial4/0/0
     172.16.5.1/32  OSPF    10   49          D   172.16.0.2      Serial4/0/0
​
OSPF routing table status : <Inactive>
         Destinations : 0        Routes : 0
R2
[r2]display ip routing-table protocol ospf
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Public routing table : OSPF
         Destinations : 5        Routes : 7        
​
OSPF routing table status : <Active>
         Destinations : 5        Routes : 7
​
Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface
​
     172.16.0.4/30  OSPF    10   49          D   172.16.0.130    GigabitEthernet0/0/0
                    OSPF    10   49          D   172.16.0.131    GigabitEthernet0/0/0
     172.16.0.8/30  OSPF    10   49          D   172.16.0.131    GigabitEthernet0/0/0
                    OSPF    10   49          D   172.16.0.132    GigabitEthernet0/0/0
     172.16.3.1/32  OSPF    10   1           D   172.16.0.130    GigabitEthernet0/0/0
     172.16.4.1/32  OSPF    10   1           D   172.16.0.131    GigabitEthernet0/0/0
     172.16.5.1/32  OSPF    10   1           D   172.16.0.132    GigabitEthernet0/0/0
​
OSPF routing table status : <Inactive>
         Destinations : 0        Routes : 0
R3
<r3>display ip routing-table protocol ospf 
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Public routing table : OSPF
         Destinations : 6        Routes : 6        
​
OSPF routing table status : <Active>
         Destinations : 6        Routes : 6
​
Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface
​
     172.16.0.0/30  OSPF    10   49          D   172.16.0.129    GigabitEthernet0/0/0
     172.16.0.8/30  OSPF    10   96          D   172.16.0.6      Serial4/0/0
     172.16.1.1/32  OSPF    10   49          D   172.16.0.129    GigabitEthernet0/0/0
     172.16.2.1/32  OSPF    10   1           D   172.16.0.129    GigabitEthernet0/0/0
     172.16.4.1/32  OSPF    10   48          D   172.16.0.6      Serial4/0/0
     172.16.5.1/32  OSPF    10   96          D   172.16.0.6      Serial4/0/0
​
OSPF routing table status : <Inactive>
         Destinations : 0        Routes : 0
R4
<r4>display ip routing-table protocol ospf
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Public routing table : OSPF
         Destinations : 5        Routes : 5        
​
OSPF routing table status : <Active>
         Destinations : 5        Routes : 5
​
Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface
​
     172.16.0.0/30  OSPF    10   49          D   172.16.0.129    GigabitEthernet0/0/0
     172.16.1.1/32  OSPF    10   49          D   172.16.0.129    GigabitEthernet0/0/0
     172.16.2.1/32  OSPF    10   1           D   172.16.0.129    GigabitEthernet0/0/0
     172.16.3.1/32  OSPF    10   48          D   172.16.0.5      Serial4/0/0
     172.16.5.1/32  OSPF    10   48          D   172.16.0.10     Serial4/0/1
​
OSPF routing table status : <Inactive>
         Destinations : 0        Routes : 0
R5
<r5>display ip routing-table protocol ospf
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Public routing table : OSPF
         Destinations : 6        Routes : 6        
​
OSPF routing table status : <Active>
         Destinations : 6        Routes : 6
​
Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface
​
     172.16.0.0/30  OSPF    10   49          D   172.16.0.129    GigabitEthernet0/0/0
     172.16.0.4/30  OSPF    10   96          D   172.16.0.9      Serial4/0/1
     172.16.1.1/32  OSPF    10   49          D   172.16.0.129    GigabitEthernet0/0/0
     172.16.2.1/32  OSPF    10   1           D   172.16.0.129    GigabitEthernet0/0/0
     172.16.3.1/32  OSPF    10   96          D   172.16.0.9      Serial4/0/1
     172.16.4.1/32  OSPF    10   48          D   172.16.0.9      Serial4/0/1
​
OSPF routing table status : <Inactive>

将R2变成DR,其他的变成DROTHER

<r2>display ospf peer 
​
         OSPF Process 1 with Router ID 2.2.2.2
                 Neighbors 
​
 Area 0.0.0.0 interface 172.16.0.129(GigabitEthernet0/0/0)'s neighbors
 Router ID: 3.3.3.3          Address: 172.16.0.130    
   State: Full  Mode:Nbr is  Master  Priority: 0
   DR: 172.16.0.129  BDR: None   MTU: 0    
   Dead timer due in 28  sec 
   Retrans timer interval: 5 
   Neighbor is up for 00:00:39     
   Authentication Sequence: [ 0 ] 
​
 Router ID: 4.4.4.4          Address: 172.16.0.131    
   State: Full  Mode:Nbr is  Master  Priority: 0
   DR: 172.16.0.129  BDR: None   MTU: 0    
   Dead timer due in 35  sec 
   Retrans timer interval: 5 
   Neighbor is up for 00:00:29     
   Authentication Sequence: [ 0 ] 
​
 Router ID: 5.5.5.5          Address: 172.16.0.132    
   State: Full  Mode:Nbr is  Master  Priority: 0
   DR: 172.16.0.129  BDR: None   MTU: 0    
   Dead timer due in 37  sec 
   Retrans timer interval: 5 
   Neighbor is up for 00:00:18     
   Authentication Sequence: [ 0 ] 
​
                 Neighbors 
​
 Area 0.0.0.1 interface 172.16.0.2(Serial4/0/0)'s neighbors
  ---- More ----

密文明文设置

R3与R4之间明文
[r3]int[r3]interface s4/0/0
[r3-Serial4/0/0]ospf authentication-mode simple cipher 111
[r4]interface s4/0/0
[r4-Serial4/0/0]ospf authentication-mode simple cipher 111
R4与R5之间密文
[r4]interface s4/0/1
[r4-Serial4/0/1]ospf authentication-mode md5 1 cipher 333
r5]interface s4/0/1
[r5-Serial4/0/1]ospf authentication-mode md5 1 cipher 333

R3的环回地址下放缺省

[r3]ip route-static 0.0.0.0 0 LoopBack 1
[r3]ospf 1 router-id 3.3.3.3
[r3-ospf-1]default-route-advertise
<r1>display ip routing-table protocol ospf
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Public routing table : OSPF
         Destinations : 8        Routes : 8        
​
OSPF routing table status : <Active>
         Destinations : 8        Routes : 8
​
Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface
​
        0.0.0.0/0   O_ASE   150  1           D   172.16.0.2      Serial4/0/0
     172.16.0.4/30  OSPF    10   97          D   172.16.0.2      Serial4/0/0
     172.16.0.8/30  OSPF    10   97          D   172.16.0.2      Serial4/0/0
   172.16.0.128/25  OSPF    10   49          D   172.16.0.2      Serial4/0/0
     172.16.2.1/32  OSPF    10   48          D   172.16.0.2      Serial4/0/0
     172.16.3.1/32  OSPF    10   49          D   172.16.0.2      Serial4/0/0
     172.16.4.1/32  OSPF    10   49          D   172.16.0.2      Serial4/0/0
     172.16.5.1/32  OSPF    10   49          D   172.16.0.2      Serial4/0/0
​
OSPF routing table status : <Inactive>
         Destinations : 0        Routes : 0

实验到此结束

总结:掌握ospf的基本配置,熟悉且掌握子网的划分

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值