思科模拟器OSPF V2配置

OSPFv2是OSPF第2个版本,与RIP相比它收敛速度快,适用于规模较大的网络。
OSPFv2使用了区域的概念,可以把路由器划分为不同的区域然后进行流量的控制 。     
和OSPF相比,增加router-id的ospf就是ospf v2

1.R1(config-router)#auto-cost reference-bandwidth 1000

[修改参考带宽为1000Mbps]  这两条命令是干预OSPFv2自动选路的

2.R1(config-if)#ip ospf cost 3 [修改接口开销为3]

就像这样,默认路径走的是中间的百兆路线,如果想让他默认走两侧的前兆 路线,就需要更改他的参考带宽
比如改成1000mbps,就可以默认走两侧的千兆路线走

验证PC1与PC2互通时流量经过的路径
C:\>tracert 192.168.2.1

Tracing route to 192.168.2.1 over a maximum of 30 hops: 

  1   0 ms      0 ms      0 ms      192.168.1.254  //路由器R1
  2   0 ms      0 ms      0 ms      10.2.13.3     //路由器R3
  3   0 ms      0 ms      0 ms      10.2.36.6	//路由器R6
  4   0 ms      0 ms      10 ms     10.2.68.8	//路由器R8
  5   0 ms      11 ms     0 ms      192.168.2.1	//目的主机

Trace complete.

3.R1(config-if)#ip ospf hello-interval 5

R1(config-if)#ip ospf dead-interval 20

[接口的Hello间隔和Dead间隔默认值为10s和40s]

[这两条是修改路由器Hello间隔、Dead间隔干预邻接关系的,若两端间隔设置不相同,会导致邻里关系失效]

修改OSPF v2协议中:hello和dead间隔后,会发现两端路由器建立邻接关系
所以两端的hello和dead必须相同,如果不同的话会造成邻接关系失效
所以要么还原这台路由器的设置,或者将另一台路由器也修改成相同的参数即可恢复
R2(config)#in g 0/0
R2(config-if)#
R2(config-if)#ip os
R2(config-if)#ip ospf h
R2(config-if)#ip ospf hello-interval 5
R2(config-if)#ip o
R2(config-if)#ip ospf de
R2(config-if)#ip ospf dead-interval 20
R2(config-if)#do sh ip os ne


Neighbor ID     Pri   State           Dead Time   Address         Interface
1.1.1.1           1   FULL/DR         00:00:29    10.0.12.1       GigabitEthernet0/0
R2(config-if)#do sh ip os ne


Neighbor ID     Pri   State           Dead Time   Address         Interface
1.1.1.1           1   FULL/DR         00:00:09    10.0.12.1       GigabitEthernet0/0
R2(config-if)#do sh ip os ne


Neighbor ID     Pri   State           Dead Time   Address         Interface
1.1.1.1           1   FULL/DR         00:00:08    10.0.12.1       GigabitEthernet0/0
R2(config-if)#do sh ip os ne


Neighbor ID     Pri   State           Dead Time   Address         Interface
1.1.1.1           1   FULL/DR         00:00:00    10.0.12.1       GigabitEthernet0/0
R2(config-if)#
00:08:37: %OSPF-5-ADJCHG: Process 1, Nbr 1.1.1.1 on GigabitEthernet0/0 from FULL to DOWN, Neighbor Down: Dead timer expired

00:08:37: %OSPF-5-ADJCHG: Process 1, Nbr 1.1.1.1 on GigabitEthernet0/0 from FULL to DOWN, Neighbor Down: Interface down or detached




修改成默认设置之后会发现他们之间邻里关系恢复正常了

R2(config-if)#ip ospf he
R2(config-if)#ip ospf hello-interval 10
R2(config-if)#ip os de
R2(config-if)#ip os dead-interval 40
R2(config-if)#do sh ip os ne


Neighbor ID     Pri   State           Dead Time   Address         Interface
1.1.1.1           1   INIT/DROTHER    00:00:36    10.0.12.1       GigabitEthernet0/0
R2(config-if)#
00:15:33: %OSPF-5-ADJCHG: Process 1, Nbr 1.1.1.1 on GigabitEthernet0/0 from LOADING to FULL, Loading Done

4.R2(config-if)#ip ospf priority 0[修改OSPF接口优先级为0]

5..R2#clear ip ospf  process [重置OSPFv2进程]

修改OSPFV2接口优先级,重置一下OSPFV2进程之后就可以重新建立邻接关系

R2(config-if)#ip ospf priority 0
R2(config-if)#do clear ip ospf pro
Reset ALL OSPF processes? [no]: y

R2(config-if)#
00:18:22: %OSPF-5-ADJCHG: Process 1, Nbr 1.1.1.1 on GigabitEthernet0/0 from FULL to DOWN, Neighbor Down: Adjacency forced to reset

00:18:22: %OSPF-5-ADJCHG: Process 1, Nbr 1.1.1.1 on GigabitEthernet0/0 from FULL to DOWN, Neighbor Down: Interface down or detached

R2(config-if)#
00:18:24: %OSPF-5-ADJCHG: Process 1, Nbr 1.1.1.1 on GigabitEthernet0/0 from LOADING to FULL, Loading Done


当两台路由器接口优先级都设置为0时,接口状态会显示2WAY,这个时候网络中就不存在DR/BDR信息,所以R1R2这个时候都会变成DROTHER,这种状态下是一个错误的状态,这样会使邻接关系发生错误,进而无法形成路由表

想要改变这种故障,只需要修改一台路由器的优先级非0即可,也可以修改为点到点类型{point-to-point}

R1#show ip os neighbor 

Neighbor ID     Pri   State           Dead Time   Address         Interface
2.2.2.2           0   2WAY/DROTHER    00:00:39    10.0.12.2       GigabitEthernet0/0
R1#
R1#ping 10.2.1.2

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.2.1.2, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)

6.R1(config-if)#ip ospf network point-to-point [修改OSPFV2接口模式为点到点类型]

修改两边路由器接口类型为点对点模式,即可排除故障
R2(config)#in g 0/0
R2(config-if)#ip os net point-to-point 
R2(config-if)#
00:35:03: %OSPF-5-ADJCHG: Process 1, Nbr 1.1.1.1 on GigabitEthernet0/0 from 2WAY to DOWN, Neighbor Down: Interface down or detached

00:35:03: %OSPF-5-ADJCHG: Process 1, Nbr 1.1.1.1 on GigabitEthernet0/0 from LOADING to FULL, Loading Done

R2(config-if)#do sh ip os ne


Neighbor ID     Pri   State           Dead Time   Address         Interface
1.1.1.1           0   FULL/  -        00:00:35    10.0.12.1       GigabitEthernet0/0

R2#
%SYS-5-CONFIG_I: Configured from console by console

两侧修改之后可以发现,两侧正常通信了

R2#ping 10.2.1.2

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.2.1.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 0/2/5 ms

R2#

猜你喜欢

转载自blog.csdn.net/weixin_59507792/article/details/129256416