一、实验要求

实验目的:

  1. 在路由器上启动OSPF路由进程的方法。
  2. 启用参与路由协议的接口的方法。
  3. OSPF度量值的计算方法。
  4. hello相关参数的配置方法。
  5. 修改参考带宽的方法。
  6. 点到点链路上的OSPF的特征。
  7. 查看和调试OSPF路由协议相关信息的方法。

实验内容:

  1. 根据拓扑图完成网络电缆连接
  2. 在路由器上进行基本配置任务
  3. 配置并激活接口
  4. 在所有路由器上配置OSPF路由
  5. 配置OSPF路由器ID
  6. 使用下列命令验证OSPF路由:show ip routeshow ip protocolshow ip ospf neighborshow ip ospf interface
  7. 观察OSPF邻居的消失和建立
  8. 通过修改端口带宽来修改OSPF度量值
  9. 通过修改链路cost值来修改OSPF度量值

二、拓扑图

QQ图片20250403110710


三、基础ip配置

在开始实验前,我们需要先把一些设备的ip地址提前配置好

area2

S3(fa0):

  • ip:192.168.203.1
  • mask:255.255.255.0
  • gateway:192.168.203.254

R5(fa0/0):

  • ip:192.168.203.254
  • mask:255.255.255.0

area0

R5(fa0/1):

  • ip:192.168.201.1
  • mask:255.255.255.0

R4(fa0/1):

  • ip:192.168.201.2
  • mask:255.255.255.0

R4(fa0/0):

  • ip:192.168.202.254
  • mask:255.255.255.0

R3(fa0/1):

  • ip:192.168.201.3
  • mask:255.255.255.0

Server2虽然不在area0中,但是这里为了方便一并列出。

S2(fa0):

  • ip:192.168.202.1
  • mask:255.255.255.0
  • gateway:192.168.202.254

area1

R3(fa0/0):

  • ip:192.168.200.129
  • mask:255.255.255.192

R1(fa0/0):

  • ip:192.168.200.130
  • mask:255.255.255.192

R1(fa0/1):

  • ip:192.168.200.62
  • mask:255.255.255.192

R2(fa0/0):

  • ip:192.168.200.131
  • mask:255.255.255.192

R2(fa0/1):

  • ip:192.168.200.126
  • mask:255.255.255.192

S0(fa0):

  • ip:192.168.200.1
  • mask:255.255.255.192
  • gateway:192.168.200.62

S1(fa0):

  • ip:192.168.200.65
  • mask:255.255.255.192
  • gateway:192.168.200.126

四、实验操作

1.路由功能

 # R5
 en
 conf
 router ospf 1
 network 192.168.201.0 0.0.0.255 area 0
 net 192.168.203.0 0.0.0.255 a 2
 # R4
 en
 conf
 rou o 1
 net 192.168.201.0 0.0.0.255 a 0
 net 192.168.202.0 0.0.0.255 a 0
 end
 sh ip ro
 # R3
 en
 conf
 rou o 1
 net 192.168.201.0 0.0.0.255 a 0
 net 192.168.200.128 0.0.0.63 a 1
 # R1
 en
 conf
 rou o 1
 net 192.168.200.0 0.0.0.63 a 1
 net 192.168.200.128 0.0.0.63 a 1
 # R2
 en
 conf
 rou o 1
 net 192.168.200.64 0.0.0.63 a 1
 net 192.168.200.128 0.0.0.63 a 1

验证连通性

 # R1
 sh ip ro
 ​
 # S3
 ping 192.168.200.1

2.区域简单密码认证

 # R5
 en
 conf
 rou o 1
 area 0 authentication
 # R3
 en
 conf
 rou o 1
 area 0 au
 # R4
 en
 conf
 ro o 1
 area 0 au
 # R1
 en
 sh ip ro
 # R5
 en
 conf
 int f 0/1
 ip ospf authentication-key cisco
 # R1
 en
 sh ip ro
 # R3
 en
 conf
 int f 0/1
 ip ospf authentication-key cisco
 # R4
 en
 conf
 int f 0/1
 ip ospf authentication-key cisco
 # R1
 en
 sh ip ro

3.链路认证

 # R3
 en
 conf
 int f 0/0
 ip ospf authentication
 ip ospf authentication-key zxl
 # R1
 en 
 conf
 int f 0/0
 ip ospf authentication
 ip ospf authentication-key zxl
 # R2
 en 
 conf
 int f 0/0
 ip ospf authentication
 ip ospf authentication-key zxl
 # S0
 ping 192.168.203.1

4.汇总

 # R5
 en
 sh ip ro
 # R3
 en
 conf
 rou o 1
 area 1 range 192.168.200.0 255.255.255.0
 # R5
 en
 sh ip ro

5.截图

 # R3
 end
 sh run
 # 两个接口
 # router ospf 1的两个认证

The best code is no code at all.