ospf综合实验

实验要求

我的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

OSPF(开放最短路径优先)是一种用于路由的动态路由协议,它是根据路由器之间的链路状态来计算最短路径的。 在一个OSPF综合实验案例中,可以模拟一个复杂的网络拓扑,包括多个路由器和连接它们的链路。假设有5个路由器A、B、C、D和E,它们之间通过不同的链路相连。 首先,需要配置每个路由器上的OSPF进程,并为它们分配一个路由器ID。然后,在每个链路上配置正确的IP地址和子网掩码。接下来,通过在OSPF进程中启用不同的区域,将路由器分成不同的区域。 然后,需要配置每个路由器之间的OSPF邻居关系。这可以通过指定邻居的路由器ID和链路上的IP地址来完成。路由器之间的邻居关系建立后,它们将开始交换链路状态信息(LSA)。 每个路由器将根据接收到的LSA计算自己的链路状态数据库(LSDB)。然后,通过运行Dijkstra算法,每个路由器将计算出到达其他路由器的最短路径。最后,每个路由器将根据最短路径选择相应的接口进行路由。 在这个实验案例中,还可以模拟链路故障的情况,观察OSPF的快速收敛性。当某个链路出现故障时,路由器将发送通告信息给邻居,通知它们链路状态已经改变。邻居将更新自己的LSDB,并重新计算最短路径。 通过这个综合实验案例,可以深入了解OSPF协议的工作原理和功能。同时,还可以通过观察实验结果,了解OSPF网络中的优势和效率。这些知识和经验将帮助网络工程师更好地设计、优化和故障排除复杂的网络拓扑。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值