ospf综合实验

该博客围绕网络实验展开,介绍了网络配置过程。先配置星型结构,为r1、r2、r3配置gre协议,修改优先级放弃竞选DR;再为r1、r4、r5配置MGRE结构,封装接口协议。完成后可相互学习路由,实现全网可达,同时给出检查直连和静态可达等注意事项。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

实验要求

我的ip分配

给各个接口配置IP,给各个路由配置静态达到全网可达

[r1]interface l	
[r1]interface LoopBack 0
[r1-LoopBack0]
[r1-LoopBack0]ip add	
[r1-LoopBack0]ip address 192.168.1.1 25
[r1-LoopBack0]
[r1-LoopBack0]qu	
[r1-LoopBack0]quit 
[r1]
[r1]int	
[r1]interface l	
[r1]interface LoopBack 1
[r1-LoopBack1]
[r1-LoopBack1]ip add	
[r1-LoopBack1]ip address 192.168.1.129 25
[isp-GigabitEthernet0/0/0]ip ad	
[isp-GigabitEthernet0/0/0]ip address 20.0.0.2 24
[isp]ping 10.0.0.1
  PING 10.0.0.1: 56  data bytes, press CTRL_C to break
    Reply from 10.0.0.1: bytes=56 Sequence=1 ttl=255 time=30 ms
    Reply from 10.0.0.1: bytes=56 Sequence=2 ttl=255 time=20 ms
    Reply from 10.0.0.1: bytes=56 Sequence=3 ttl=255 time=10 ms
    Reply from 10.0.0.1: bytes=56 Sequence=4 ttl=255 time=20 ms
    Reply from 10.0.0.1: bytes=56 Sequence=5 ttl=255 time=30 ms

  --- 10.0.0.1 ping statistics ---
    5 packet(s) transmitted
    5 packet(s) received
    0.00% packet loss
    round-trip min/avg/max = 10/22/30 ms

[isp]ping 20.0.0.1
  PING 20.0.0.1: 56  data bytes, press CTRL_C to break
    Reply from 20.0.0.1: bytes=56 Sequence=1 ttl=255 time=10 ms
    Reply from 20.0.0.1: bytes=56 Sequence=2 ttl=255 time=20 ms
    Reply from 20.0.0.1: bytes=56 Sequence=3 ttl=255 time=20 ms
    Reply from 20.0.0.1: bytes=56 Sequence=4 ttl=255 time=20 ms
    Reply from 20.0.0.1: bytes=56 Sequence=5 ttl=255 time=30 ms

直连可达

[r1]ip route-static 0.0.0.0 0 10.0.0.2
[r1]ip route-static 0.0.0.0 0 20.0.0.2
[r2]ip route-static 0.0.0.0 0 30.0.0.2
[r3]ip route-static 0.0.0.0 0 40.0.0.2
[r4]ip route-static 0.0.0.0 0 50.0.0.2 
[r5]ip route-static 0.0.0.0 0 60.0.0.2

达到可达

1.首先配置星型结构,给r1,r2,r3配置gre协议

        配置tunnel接口

[r1-Tunnel0/0/0]dis th
[V200R003C00]
#
interface Tunnel0/0/0
 ip address 10.1.2.1 255.255.255.0 
 tunnel-protocol gre p2mp
 source 20.0.0.1
 nhrp entry multicast dynamic
[r2]display nhrp peer a
------------------------------------------------------------------------------- 
Protocol-addr   Mask  NBMA-addr       NextHop-addr    Type         Flag         
------------------------------------------------------------------------------- 
10.1.2.1        32    20.0.0.1        10.1.2.1        static       hub          
------------------------------------------------------------------------------- 
Tunnel interface: Tunnel0/0/0
Created time    : 00:01:09
Expire time     : --
[r1]display nhrp peer a
------------------------------------------------------------------------------- 
Protocol-addr   Mask  NBMA-addr       NextHop-addr    Type         Flag         
------------------------------------------------------------------------------- 
10.1.2.2        32    30.0.0.1        10.1.2.2        dynamic      route tunnel 
------------------------------------------------------------------------------- 
Tunnel interface: Tunnel0/0/0
Created time    : 00:03:34
Expire time     : 01:56:26
------------------------------------------------------------------------------- 
Protocol-addr   Mask  NBMA-addr       NextHop-addr    Type         Flag         
------------------------------------------------------------------------------- 
10.1.2.3        32    40.0.0.1        10.1.2.3        dynamic      route tunnel 
------------------------------------------------------------------------------- 
Tunnel interface: Tunnel0/0/0
Created time    : 00:00:38
Expire time     : 01:59:22

Number of nhrp peers: 2

修改优先级放弃竞选DR


[r2-Tunnel0/0/0]ospf dr-priority 0

[r3-Tunnel0/0/0]ospf dr-priority 0

r1,r2,r3之间建立完

[r1]display ospf peer brief 

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

2.配置r1,r4,r5配置MGRE结构

        同上先配置Tunnel接口地址

[r5-Tunnel0/0/0]ip address 10.1.1.5 24
[r4-Tunnel0/0/0]ip address 10.1.1.4 24

封装接口协议

[r4-Tunnel0/0/0]tunnel-protocol gre p2mp 
[r5-Tunnel0/0/0]tunnel-protocol gre p2mp 
[r4-Tunnel0/0/0]source GigabitEthernet 0/0/0
[r4-Tunnel0/0/0]nhrp entry 10.1.1.1 10.0.0.1 register 
[r4-Tunnel0/0/0]ospf network-type broadcast

查看nhrp相关信息

[r1]display nhrp peer all 
------------------------------------------------------------------------------- 
Protocol-addr   Mask  NBMA-addr       NextHop-addr    Type         Flag         
------------------------------------------------------------------------------- 
10.1.2.2        32    30.0.0.1        10.1.2.2        dynamic      route tunnel 
------------------------------------------------------------------------------- 
Tunnel interface: Tunnel0/0/0
Created time    : 01:08:53
Expire time     : 01:51:07
------------------------------------------------------------------------------- 
Protocol-addr   Mask  NBMA-addr       NextHop-addr    Type         Flag         
------------------------------------------------------------------------------- 
10.1.2.3        32    40.0.0.1        10.1.2.3        dynamic      route tunnel 
------------------------------------------------------------------------------- 
Tunnel interface: Tunnel0/0/0
Created time    : 01:05:57
Expire time     : 01:54:03
------------------------------------------------------------------------------- 
Protocol-addr   Mask  NBMA-addr       NextHop-addr    Type         Flag         
------------------------------------------------------------------------------- 
10.1.1.5        32    60.0.0.1        10.1.1.5        static       hub          
------------------------------------------------------------------------------- 
Tunnel interface: Tunnel0/0/1
Created time    : 00:47:16
Expire time     : --
------------------------------------------------------------------------------- 
Protocol-addr   Mask  NBMA-addr       NextHop-addr    Type         Flag         
------------------------------------------------------------------------------- 
10.1.1.4        32    50.0.0.1        10.1.1.4        static       hub          
------------------------------------------------------------------------------- 
Tunnel interface: Tunnel0/0/1
Created time    : 00:47:05
Expire time     : --

 两个静态,两个hub,ospf搭建完成,可以相互学习路由,全网可达

[r1]display ip routing-table protocol ospf 
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Public routing table : OSPF
         Destinations : 4        Routes : 4        

OSPF routing table status : <Active>
         Destinations : 4        Routes : 4

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

    192.168.2.1/32  OSPF    10   1562        D   10.1.2.2        Tunnel0/0/0
    192.168.3.1/32  OSPF    10   1562        D   10.1.2.3        Tunnel0/0/0
    192.168.4.1/32  OSPF    10   1562        D   10.1.1.4        Tunnel0/0/1
    192.168.5.1/32  OSPF    10   1562        D   10.1.1.5        Tunnel0/0/1
[r4]display current-configuration interface t 0/0/0
[V200R003C00]
#
interface Tunnel0/0/0
 ip address 10.1.1.4 255.255.255.0 
 tunnel-protocol gre p2mp
 source GigabitEthernet0/0/0
 ospf network-type broadcast
 nhrp entry 10.1.1.5 60.0.0.1 register
 nhrp entry 10.1.1.1 10.0.0.1 register
#
return

注意事项:

先要检查直连和静态可达

记得需要重启tunnel接口,建立邻居

p2p是点到点协议,需要需修改接口类型broadcast

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值