思科实验18.网络层:OSPF路由协议(下)

2023-11-15

实验流程

开始
设计拓扑
配置主机IP地址
配置路由器各端口ip
封装OSPF,RIP协议
验证主机连通

1.设计拓扑

在这里插入图片描述

2.配置主机IP地址

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

3.配置路由器各端口ip

因为操作比较复杂,一步一步来,首先目的把各端口给上ip地址并把端口打开,使得网络看起来连通,具体要封装的协议接下来再进行操作。

路由器0

Router>en
Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#int g0/0
Router(config-if)#ip address 192.168.20.2 255.255.255.0
Router(config-if)#no shut
Router(config-if)#int g0/1
Router(config-if)#ip address 192.168.30.1 255.255.255.0
Router(config-if)#no shut
Router(config-if)#int s0/3/0
Router(config-if)#ip address 192.168.50.1 255.255.255.0
Router(config-if)#no shut
Router(config-if)#int s0/3/1
Router(config-if)#ip address 192.168.60.1 255.255.255.0
Router(config-if)#no shut

路由器1

Router>en
Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#int g0/0
Router(config-if)#ip address 192.168.10.1 255.255.255.0
Router(config-if)#no shut
Router(config-if)#int g0/1
Router(config-if)#ip address 192.168.20.1 255.255.255.0
Router(config-if)#no shut

路由器2

Router>en
Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#int g0/0
Router(config-if)#ip address 192.168.40.1 255.255.255.0
Router(config-if)#no shut
Router(config-if)#int g0/1
Router(config-if)#ip address 192.168.30.2 255.255.255.0
Router(config-if)#no shut

路由器3

Router>en
Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#int s0/3/0
Router(config-if)#ip address 192.168.50.2 255.255.255.0
Router(config-if)#no shut
Router(config-if)#int g0/0
Router(config-if)#ip address 192.168.70.1 255.255.255.0
Router(config-if)#no shut
Router(config-if)#int g0/1
Router(config-if)#ip address 192.168.80.1 255.255.255.0
Router(config-if)#no shut

路由器4

Router>en
Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#int s0/3/0
Router(config-if)#ip address 192.168.60.2 255.255.255.0
Router(config-if)#no shut
Router(config-if)#int g0/0
Router(config-if)#ip address 192.168.120.1 255.255.255.0
Router(config-if)#no shut
Router(config-if)#int g0/1
Router(config-if)#ip address 192.168.130.1 255.255.255.0
Router(config-if)#no shut

路由器5

Router>en
Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#int g0/0
Router(config-if)#ip address 192.168.80.2 255.255.255.0
Router(config-if)#no shut
Router(config-if)#int g0/1
Router(config-if)#ip address 192.168.90.1 255.255.255.0
Router(config-if)#no shut
Router(config-if)#int s0/3/0
Router(config-if)#ip address 192.168.100.1 255.255.255.0
Router(config-if)#no shut

路由器6

Router>en
Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#int g0/0
Router(config-if)#ip address 192.168.130.2 255.255.255.0
Router(config-if)#no shut
Router(config-if)#int g0/1
Router(config-if)#ip address 192.168.140.1 255.255.255.0
Router(config-if)#no shut
Router(config-if)#int s0/3/0
Router(config-if)#ip address 192.168.150.1 255.255.255.0
Router(config-if)#no shut

路由器7

Router>en
Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#int s0/3/0
Router(config-if)#ip address 192.168.100.2 255.255.255.0
Router(config-if)#no shut
Router(config-if)#int g0/0
Router(config-if)#ip address 192.168.110.1 255.255.255.0
Router(config-if)#no shut

路由器8

Router>en
Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#int s0/3/0
Router(config-if)#ip address 192.168.150.2 255.255.255.0
Router(config-if)#no shut
Router(config-if)#int g0/0
Router(config-if)#ip address 192.168.160.1 255.255.255.0
Router(config-if)#no shut

此时拓扑图
在这里插入图片描述

4.封装OSPF协议

OSPF区域下是这样划分的
area0
路由器1,路由器2,路由器0
area1
路由器3,路由器5,路由器7
area2
路由器4,路由器6

首先配置area0区域
路由器1

Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#route ospf 1
Router(config-router)#network 192.168.20.0 0.0.0.255 area 0
Router(config-router)#network 192.168.10.0 0.0.0.255 area 0

路由器2

Router>en
Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#route ospf 1
Router(config-router)#network 192.168.30.0 0.0.0.255 area 0
Router(config-router)#network 192.168.40.0 0.0.0.255 area 0

路由器0

Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#route ospf 1
Router(config-router)#network 192.168.20.0 0.0.0.255 area 0
Router(config-router)#network 192.168.30.0 0.0.0.255 area 0
Router(config-router)#network 192.168.50.0 0.0.0.255 area 0
Router(config-router)#network 192.168.60.0 0.0.0.255 area 0

配置area1区域
路由器3

Router(config-router)#network 192.168.50.0 0.0.0.255 area 0
Router(config-router)#network 192.168.70.0 0.0.0.255 area 1
Router(config-router)#network 192.168.80.0 0.0.0.255 area 1

路由器5

Router>en
Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#route ospf 1
Router(config-router)#network 192.168.80.0 0.0.0.255 area 1
Router(config-router)#network 192.168.90.0 0.0.0.255 area 1
Router(config-router)#network 192.168.100.0 0.0.0.255 area 1

路由器7

Router>en
Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#route ospf 1
Router(config-router)#network 192.168.100.0 0.0.0.255 area 1
Router(config-router)#network 192.168.110.0 0.0.0.255 area 1

配置area2区域
路由器4

Router>en
Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#route ospf 1
Router(config-router)#network 192.168.60.0 0.0.0.255 area 0
Router(config-router)#network 192.168.130.0 0.0.0.255 area 2
Router(config-router)#network 192.168.120.0 0.0.0.255 area 2

路由器6

Router>en
Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#route ospf 1
Router(config-router)#network 192.168.130.0 0.0.0.255 area 2
Router(config-router)#network 192.168.140.0 0.0.0.255 area 2

5.封装RIP协议

RIP区域这样划分
rip
路由器6,路由器8
路由器6

Router(config)#route rip
Router(config-router)#version 2
Router(config-router)#network 192.168.150.0

路由器8

Router>en
Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#route rip
Router(config-router)#version 2
Router(config-router)#network 192.168.150.0
Router(config-router)#network 192.168.160.0

6.剩余工作

ospf区域缺少rip区域的路由,RIP区域缺少ospf区域的路由。
这里还要配置路由器6
ospf和rip交界的路由器

Router>en
Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#route ospf 1
Router(config-router)#redistribute rip metric 1000 metric-type 1 subnets 
Router(config-router)#exit
Router(config)#route rip
Router(config-router)#redistribute ospf 1 metric 5

此时每个路由器都存在各个路由器的路由表
查看其中一个路由器的路由表看一下
例如路由器8

Router#show ip route
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
       i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
       * - candidate default, U - per-user static route, o - ODR
       P - periodic downloaded static route

Gateway of last resort is not set

R    192.168.10.0/24 [120/5] via 192.168.150.1, 00:00:04, Serial0/3/0
R    192.168.20.0/24 [120/5] via 192.168.150.1, 00:00:04, Serial0/3/0
R    192.168.30.0/24 [120/5] via 192.168.150.1, 00:00:04, Serial0/3/0
R    192.168.40.0/24 [120/5] via 192.168.150.1, 00:00:04, Serial0/3/0
R    192.168.50.0/24 [120/5] via 192.168.150.1, 00:00:04, Serial0/3/0
R    192.168.60.0/24 [120/5] via 192.168.150.1, 00:00:04, Serial0/3/0
R    192.168.70.0/24 [120/5] via 192.168.150.1, 00:00:04, Serial0/3/0
R    192.168.80.0/24 [120/5] via 192.168.150.1, 00:00:04, Serial0/3/0
R    192.168.90.0/24 [120/5] via 192.168.150.1, 00:00:04, Serial0/3/0
R    192.168.100.0/24 [120/5] via 192.168.150.1, 00:00:04, Serial0/3/0
R    192.168.110.0/24 [120/5] via 192.168.150.1, 00:00:04, Serial0/3/0
R    192.168.120.0/24 [120/5] via 192.168.150.1, 00:00:04, Serial0/3/0
R    192.168.130.0/24 [120/5] via 192.168.150.1, 00:00:04, Serial0/3/0
R    192.168.140.0/24 [120/5] via 192.168.150.1, 00:00:04, Serial0/3/0
     192.168.150.0/24 is variably subnetted, 2 subnets, 2 masks
C       192.168.150.0/24 is directly connected, Serial0/3/0
L       192.168.150.2/32 is directly connected, Serial0/3/0
     192.168.160.0/24 is variably subnetted, 2 subnets, 2 masks
C       192.168.160.0/24 is directly connected, GigabitEthernet0/0
L       192.168.160.1/32 is directly connected, GigabitEthernet0/0

7.验证主机连通

使用主机PC0ping主机PC1,2,3,4,5,6,7

C:\>ping 192.168.40.11

Pinging 192.168.40.11 with 32 bytes of data:

Request timed out.
Reply from 192.168.40.11: bytes=32 time<1ms TTL=125
Reply from 192.168.40.11: bytes=32 time<1ms TTL=125
Reply from 192.168.40.11: bytes=32 time<1ms TTL=125

Ping statistics for 192.168.40.11:
    Packets: Sent = 4, Received = 3, Lost = 1 (25% loss),
Approximate round trip times in milli-seconds:
    Minimum = 0ms, Maximum = 0ms, Average = 0ms

C:\>ping 192.168.70.11

Pinging 192.168.70.11 with 32 bytes of data:

Request timed out.
Reply from 192.168.70.11: bytes=32 time=5ms TTL=125
Reply from 192.168.70.11: bytes=32 time=1ms TTL=125
Reply from 192.168.70.11: bytes=32 time=1ms TTL=125

Ping statistics for 192.168.70.11:
    Packets: Sent = 4, Received = 3, Lost = 1 (25% loss),
Approximate round trip times in milli-seconds:
    Minimum = 1ms, Maximum = 5ms, Average = 2ms

C:\>ping 192.168.120.11

Pinging 192.168.120.11 with 32 bytes of data:

Reply from 192.168.120.11: bytes=32 time=11ms TTL=125
Reply from 192.168.120.11: bytes=32 time=2ms TTL=125
Reply from 192.168.120.11: bytes=32 time=1ms TTL=125
Reply from 192.168.120.11: bytes=32 time=1ms TTL=125

Ping statistics for 192.168.120.11:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 1ms, Maximum = 11ms, Average = 3ms

C:\>ping 192.168.90.11

Pinging 192.168.90.11 with 32 bytes of data:

Reply from 192.168.90.11: bytes=32 time=1ms TTL=124
Reply from 192.168.90.11: bytes=32 time=1ms TTL=124
Reply from 192.168.90.11: bytes=32 time=1ms TTL=124
Reply from 192.168.90.11: bytes=32 time=1ms TTL=124

Ping statistics for 192.168.90.11:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 1ms, Maximum = 1ms, Average = 1ms

C:\>ping 192.168.140.11

Pinging 192.168.140.11 with 32 bytes of data:

Request timed out.
Reply from 192.168.140.11: bytes=32 time=1ms TTL=124
Reply from 192.168.140.11: bytes=32 time=1ms TTL=124
Reply from 192.168.140.11: bytes=32 time=1ms TTL=124

Ping statistics for 192.168.140.11:
    Packets: Sent = 4, Received = 3, Lost = 1 (25% loss),
Approximate round trip times in milli-seconds:
    Minimum = 1ms, Maximum = 1ms, Average = 1ms

C:\>ping 192.168.110.11

Pinging 192.168.110.11 with 32 bytes of data:

Reply from 192.168.110.11: bytes=32 time=2ms TTL=123
Reply from 192.168.110.11: bytes=32 time=7ms TTL=123
Reply from 192.168.110.11: bytes=32 time=3ms TTL=123
Reply from 192.168.110.11: bytes=32 time=2ms TTL=123

Ping statistics for 192.168.110.11:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 2ms, Maximum = 7ms, Average = 3ms

C:\>ping 192.168.160.11

Pinging 192.168.160.11 with 32 bytes of data:

Request timed out.
Reply from 192.168.160.11: bytes=32 time=2ms TTL=123
Reply from 192.168.160.11: bytes=32 time=5ms TTL=123
Reply from 192.168.160.11: bytes=32 time=2ms TTL=123

Ping statistics for 192.168.160.11:
    Packets: Sent = 4, Received = 3, Lost = 1 (25% loss),
Approximate round trip times in milli-seconds:
    Minimum = 2ms, Maximum = 5ms, Average = 3ms

C:\>

可见,均能ping通,已经完全可以连通了。
OK,文章到这里就结束了。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

思科实验18.网络层:OSPF路由协议(下) 的相关文章

  • Linux常用命令与JavaWeb开发环境的搭建

    文章目录 前言 一 系统信息以及查看文件 1 1系统信息 1 2查看文件 二 查看进程和防火墙的开关 三 搭建Java Web开发环境 3 1JDK 3 2Tomcat 3 3Mysql 总结 前言 Linux 特点 免费 开源 免费 安全

随机推荐

  • 继电器驱动电路原理及注意事项

    继电器驱动电流一般需要20 40mA或更大 线圈电阻100 200欧姆 因此要加驱动电路 1 晶体管用来驱动继电器 必须将晶体管的发射极接地 具体电路如下 NPN晶体管 PNP晶体管 NPN晶体管驱动时 当晶体管T1基极被输入高电平时 晶体
  • 导入数据的几种方法

    采用标准python类库导入数据 读取文件 from csv import reader import numpy as np filename pima csv with open filename rt as raw data read
  • centOS7服务器搭建

    一 安装jdk 运行代码 yum search jdk 1 查询当前云服务器里面通过yum可以安装哪些jdk 以这个jdk1 8的版本为例 运行代码 yum y install java 1 8 0 openjdk 2 安装jdk1 8版本
  • obj(判断对象中是否包含某个key属性)

    key in obj 不包含 obj hasOwnProperty key 包含
  • 纯代码构建Swift工程

    有些东西很简单 但是我还是把它记录了下来 使用Storyboard创建一个新的项目后 应用程序从闪屏 到主窗口 再到第一个界面经过的文件分别是 LaunchScreen storyboard gt Main storyboard gt Vi
  • NBIoT与LoRa技术详解及竞争态势分析

    物联网的无线通信技术很多 主要分为两类 一类是Zigbee WiFi 蓝牙 Z wave等短距离通信技术 另一类是LPWAN low power Wide Area Network 低功耗广域网 即广域网通信技术 LPWA又可分为两类 一类
  • 计算机视觉领域经典模型汇总(RCNN、YOLO等)

    一 RCNN系列 1 RCNN RCNN是用于目标检测的经典方法 其核心思想是将目标检测任务分解为两个主要步骤 候选区域生成和目标分类 候选区域生成 RCNN的第一步是生成可能包含目标的候选区域 RCNN使用传统的计算机视觉技术 特别是选择
  • linux中tmp文件在哪,Linux系统中/tmp文件夹

    在Linux系统中 tmp文件夹里面的文件会被清空 至于多长时间被清空 如何清空的 可能大家知识的就不多了 所以 今天我们就来剖析一个这两个问题 在RHEL CentOS Fedora 系统中 本次实验是在RHEL6中进行的 1 tmpwa
  • 数字后端dbGet使用方法合集

    以下资料是我之前写过的 芯片数字后端中Innovus Encounter dbGet命令使用方法的介绍 整理了一下 做成合集 方便大家查询 点击标题就可以选择文章查看 会直接挂在公众号的主页菜单栏里的 后端资料 里 感觉好的话 请多多推广喔
  • java报错:Connection reset by peer: socket write error

    用java做excel导出时 报错 ClientAbortException java net SocketException Connection reset by peer socket write error 大致出现问题的原因如下
  • java指纹识别+谷歌图片识别技术(采用Hash方法)

    转载自 http blog csdn net yjflinchong article details 7469213 java指纹识别 谷歌图片识别技术 前阵子在阮一峰的博客上看到了这篇 相似图片搜索原理 博客 就有一种冲动要将这些原理实现
  • Python3 PyCharm 捕获异常报 Too broad exception clause 警告

    最近在 PyCharm 中写代码的时候会抱怨 Exception 没有指定错误类型 Too broad exception clause 这是因为捕获的异常过于宽泛 没有针对性 可以通过指定精确的异常类型来解决 BaseException
  • NLP进阶,使用TextRNN和TextRNN_ATT实现文本分类

    TextRNN TextRNN仅仅是将Word Embedding后 输入到双向LSTM中 然后对最后一位的输出输入到全连接层中 在对其进行softmax分类即可 模型如下图 代码 class RNN nn Module def init
  • STM32 - 利用SPI接口读写FLASH编程实践

    1 SPI 固件库介绍 可以直接查看 F103固件库手册 只有英文没有中文 chm 找到SPI章节 相关信息都在这里 初始化结构体及函数定义在库文件 stm32f4xx spi h 及 stm32f4xx spi c 中 编程 时我们可以结
  • 【Shell案例】【for循环、seq生成】3、输出7的倍数

    描述写一个 bash脚本以输出数字 0 到 500 中 7 的倍数 0 7 14 21 的命令 方法1 in方式循环 if的括号是中括号 中间的条件要有空格 循环体用do和done配对 判断用if和fi配对 循环条件内不用加 echo的时候
  • Canal报错:Could not find first log file name in binary log index file

    解决方案 rm home admin canal server conf example meta dat 然后重启 home admin canal server bin restart sh
  • RecyclerView实现九宫格和点击事件

    想要实现的效果如下 开始界面 点击界面展示 在屏幕中间弹出一个对话框 效果就如同将图片放大一样 不过当然 这里的图片放大并非真正意义上的拉伸 而是展示出较大的那张图片 若是不打算用两张图片 也可以自定义大小 这里因为只是简单的demo 也为
  • 异常:java lang AbstractMethodError

    通常在尝试调用抽象方法时抛出此 java lang AbstractMethodError 通常 此错误是在编译时本身识别的 如果在运行时抛出此错误 则该类必须不兼容 与先前存在的类不兼容 更改 因此 它是IncompatibleClass
  • 嵌入式 Linux 入门 环境篇(四、必备开发工具安装)

    嵌入式 Linux入门 环境篇第四课 开发工具软件的安装与说明 by 矜辰所致 前言 前面的环境篇我们把开发的基本环境安装好了 Ubuntu虚拟机 网络配置 为了从 0 开始说明 还特意买了一台新电脑 就问是不是不将就 在我们接下来做嵌入式
  • 思科实验18.网络层:OSPF路由协议(下)

    多区域OSPF和RIP结合 实验流程 1 设计拓扑 2 配置主机IP地址 3 配置路由器各端口ip 4 封装OSPF协议 5 封装RIP协议 6 剩余工作 7 验证主机连通 实验流程 mermaid svg k8yA2guPqb8dork0