千家信息网

网络必备——动态路由(默认路由+静态+OSPF+RIP综合实验)

发表于:2026-11-02 作者:千家信息网编辑
千家信息网最后更新 2026年11月02日,本章目的:全网互通,R2设置静态路由,R2和R3在AREA1区域中使用OSPF协议 ,R3设置默认路由回来,R4和R5使用RIP协议本章环境:GNS3,5台路由器,4台主机,1个外部网.实验图:路由器
千家信息网最后更新 2026年11月02日网络必备——动态路由(默认路由+静态+OSPF+RIP综合实验)

本章目的:全网互通,R2设置静态路由,R2和R3在AREA1区域中使用OSPF协议 ,R3设置默认路由回来,R4和R5使用RIP协议

本章环境:GNS3,5台路由器,4台主机,1个外部网.

实验图:

  1. 路由器接口地址
R1:f0/0(192.168.10.1/24)f0/1(192.168.20.1/24)R2:f0/1(192.168.20.2/24)f0/0(192.168.30.1/24)R3:f0/0(192.168.30.2/24)f0/1(192.168.40.1/24)f1/0(12.0.0.1/24)f2/0(192.168.70.1/24)R4:f0/1(192.168.50.1/24)f0/0(192.168.40.2/24)R6:f0/1(192.168.60.1/24)f0/0(192.168.50.2/24)

2.外部网地址:

R5:f0/0(12.0.0.2/24)f0/1(13.0.0.1/24)

3.客户端地址:

PC机1:(192.168.10.2/24)PC机2:(192.168.70.2/24)PC机3:(13.0.0.13/24)  PC机4:(192.168.60.2/24)

R3的路由器要多加一块单板

1.配置R1路由器

R1#conf t   //进入全局模式Enter configuration commands, one per line.  End with CNTL/Z.R1(config)#int f0/0  //进入接口R1(config-if)#ip add 192.168.10.1 255.255.255.0   //设置地址R1(config-if)#no shut   //开启R1(config-if)#exR1(config)#int f0/1R1(config-if)#ip add 192.168.20.1 255.255.255.0R1(config-if)#no shutR1(config-if)#exR1(config)#do show ip route  //查看路由表Codes: 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       i - IS-IS, su - IS-IS summary, 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 routeGateway of last resort is 192.168.20.2 to network 0.0.0.0C    192.168.10.0/24 is directly connected, FastEthernet0/0  //直连网段C    192.168.20.0/24 is directly connected, FastEthernet0/1  //直连网段S*   0.0.0.0/0 [1/0] via 192.168.20.2    //默认网络

2.配置R2路由器接口地址

R2#conf tEnter configuration commands, one per line.  End with CNTL/Z.R2(config)#int f0/1R2(config-if)#ip add 192.168.20.2 255.255.255.0R2(config-if)#no shutR2(config-if)#ex   R2(config)#int f0/0R2(config-if)#ip add 192.168.30.1 255.255.255.0R2(config-if)#no shutR2(config-if)#ex

3.配置R2静态路由和OSPF协议

R2(config)#router ospf 1  //进入OSPF协议1进程  在协议里一定要在同一个进程R2(config-router)#router-id 2.2.2.2   //设置路由器router-idR2(config-router)#network 192.168.30.0 0.0.0.255 area 1  //宣告30网段再骨干区域area1中R2(config-router)#redistribute connected subnets    //将R2直连的网段注入进来R2(config-router)#redistribute static subnets          //将 静态路由的10网段注入进来R2(config-router)#exR2(config)#ip route 192.168.10.0 255.255.255.0 192.168.20.1  //设置静态路由 网段,子网掩码,下一跳地址R2(config)#do show ip route   Codes: 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       i - IS-IS, su - IS-IS summary, 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 routeGateway of last resort is not setC    192.168.30.0/24 is directly connected, FastEthernet0/0S    192.168.10.0/24 [1/0] via 192.168.20.1C    192.168.20.0/24 is directly connected, FastEthernet0/1

4.配置R3接口地址

R3R3#conf tEnter configuration commands, one per line.  End with CNTL/Z.R3(config)#int f0/0R3(config-if)#ip add 192.168.30.2 255.255.255.0R3(config-if)#no shutR3(config-if)#int f0/1R3(config-if)#ip add 192.168.40.1 255.255.255.0R3(config-if)#no shutR3(config-if)#int f1/0R3(config-if)#ip add 12.0.0.1 255.255.255.0R3(config-if)#no shutR3(config-if)#int f2/0 R3(config-if)#ip add 192.168.70.1 255.255.255.0R3(config-if)#no shutR3(config-if)#ex

5.配置R3默认路由和OSPF协议

R3(config)#ip route 0.0.0.0 0.0.0.0 12.0.0.2  将R3设置成默认路由R3(config)#router ospf 1   //开启OSPF进程1R3(config-router)#router-id 3.3.3.3  //设置路由router-idR3(config-router)#network 192.168.30.0 0.0.0.255 area 1  宣告30网段在area 1区域中R3(config-router)#network 192.168.40.0 0.0.0.255 area 0 宣告40网段在area 0区域中R3(config-router)#network 192.168.70.0 0.0.0.255 area 0宣告70网段在area 0区域中R3(config-router)#exR3(config)#do show ip routeCodes: 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       i - IS-IS, su - IS-IS summary, 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 routeGateway of last resort is 12.0.0.2 to network 0.0.0.0C    192.168.30.0/24 is directly connected, FastEthernet0/0O E2 192.168.10.0/24 [110/20] via 192.168.30.1, 00:00:49, FastEthernet0/0C    192.168.40.0/24 is directly connected, FastEthernet0/1O E2 192.168.20.0/24 [110/20] via 192.168.30.1, 00:00:49, FastEthernet0/0     12.0.0.0/24 is subnetted, 1 subnetsC       12.0.0.0 is directly connected, FastEthernet1/0C    192.168.70.0/24 is directly connected, FastEthernet2/0S*   0.0.0.0/0 [1/0] via 12.0.0.2

6.配置R4接口地址

R4#conf tEnter configuration commands, one per line.  End with CNTL/Z.R4(config)#int f0/0R4(config-if)#ip add 192.168.40.2 255.255.255.0R4(config-if)#no shutR4(config-if)#int f0/1R4(config-if)#ip add 192.168.50.1 255.255.255.0R4(config-if)#no shutR4(config-if)#ex

7.配置R4RIP协议,注入OSPF协议

R4(config)#router rip  //进入rip协议R4(config-router)#ver 2    //使用2版本协议R4(config-router)#no auto-summary   //关闭路由汇总R4(config-router)#network 192.168.50.0   //宣告网段R4(config-router)#redistribute ospf 1 metric 5  //在rip协议中注入OSPF协议R4(config-router)#router ospf 1    //开启OSPF进程1R4(config-router)#router-id 4.4.4.4R4(config-router)#network 192.168.40.0 0.0.0.255 area 0R4(config-router)#redistribute rip subnetsR4(config-router)#exR4(config)#do show ip routeCodes: 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       i - IS-IS, su - IS-IS summary, 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 routeGateway of last resort is 192.168.40.1 to network 0.0.0.0O IA 192.168.30.0/24 [110/20] via 192.168.40.1, 00:00:18, FastEthernet0/0O E2 192.168.10.0/24 [110/20] via 192.168.40.1, 00:00:18, FastEthernet0/0C    192.168.40.0/24 is directly connected, FastEthernet0/0O E2 192.168.20.0/24 [110/20] via 192.168.40.1, 00:00:18, FastEthernet0/0C    192.168.50.0/24 is directly connected, FastEthernet0/1O    192.168.70.0/24 [110/11] via 192.168.40.1, 00:00:18, FastEthernet0/0O*E2 0.0.0.0/0 [110/1] via 192.168.40.1, 00:00:18, FastEthernet0/0

8.配置R6接口地址

R6#conf tEnter configuration commands, one per line.  End with CNTL/Z.R6(config)#int f0/0R6(config-if)#ip add 192.168.50.2 255.255.255.0R6(config-if)#no shutR6(config-if)#int f0/1R6(config-if)#ip add 192.168.60.1 255.255.255.0R6(config-if)#no shutR6(config-if)#ex

9.配置R6RIP协议

R6(config)#router ripR6(config-router)#ver 2R6(config-router)#no auto-summaryR6(config-router)#network 192.168.50.0R6(config-router)#network 192.168.60.0R6(config-router)#ex   R6(config)#do show ip routeCodes: 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       i - IS-IS, su - IS-IS summary, 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 routeGateway of last resort is 192.168.50.1 to network 0.0.0.0R    192.168.30.0/24 [120/5] via 192.168.50.1, 00:00:21, FastEthernet0/0C    192.168.60.0/24 is directly connected, FastEthernet0/1R    192.168.10.0/24 [120/5] via 192.168.50.1, 00:00:21, FastEthernet0/0R    192.168.40.0/24 [120/5] via 192.168.50.1, 00:00:21, FastEthernet0/0R    192.168.20.0/24 [120/5] via 192.168.50.1, 00:00:21, FastEthernet0/0C    192.168.50.0/24 is directly connected, FastEthernet0/0R    192.168.70.0/24 [120/5] via 192.168.50.1, 00:00:21, FastEthernet0/0R*   0.0.0.0/0 [120/1] via 192.168.50.1, 00:00:22, FastEthernet0/0

10.配置R5外部网默认路由,和接口地址

R5R5#conf tEnter configuration commands, one per line.  End with CNTL/Z.R5(config)#ip route 192.168.0.0 255.255.0.0 12.0.0.1  //设置成默认路由R5(config)#int f0/0R5(config-if)#ip add 12.0.0.2 255.255.255.0R5(config-if)#no shutR5(config-if)#int f0/1R5(config-if)#ip add 13.0.0.1 255.255.255.0R5(config-if)#no shutR5(config-if)#exR5(config)#do show ip routeCodes: 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       i - IS-IS, su - IS-IS summary, 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 routeGateway of last resort is not set     12.0.0.0/24 is subnetted, 1 subnetsC       12.0.0.0 is directly connected, FastEthernet0/0     13.0.0.0/24 is subnetted, 1 subnetsC       13.0.0.0 is directly connected, FastEthernet0/1S    192.168.0.0/16 [1/0] via 12.0.0.1

11.给四台主机配好地址

PC1> ip 192.168.10.2 192.168.10.1Checking for duplicate address...PC1 : 192.168.10.2 255.255.255.0 gateway 192.168.10.1PC2> ip 192.168.70.2 192.168.70.1Checking for duplicate address...PC1 : 192.168.70.2 255.255.255.0 gateway 192.168.70.1PC3> ip 13.0.0.13 13.0.0.1Checking for duplicate address...PC1 : 13.0.0.13 255.255.255.0 gateway 13.0.0.1PC号主机> ip 192.168.60.2 192.168.60.1Checking for duplicate address...PC1 : 192.168.60.2 255.255.255.0 gateway 192.168.60.1

12.验证一下是不是全网互通

PC1> ping 192.168.70.2192.168.70.2 icmp_seq=1 timeout192.168.70.2 icmp_seq=2 timeout84 bytes from 192.168.70.2 icmp_seq=3 ttl=61 time=62.159 ms84 bytes from 192.168.70.2 icmp_seq=4 ttl=61 time=62.159 ms84 bytes from 192.168.70.2 icmp_seq=5 ttl=61 time=66.171 msPC1> ping 13.0.0.1313.0.0.13 icmp_seq=1 timeout13.0.0.13 icmp_seq=2 timeout84 bytes from 13.0.0.13 icmp_seq=3 ttl=60 time=92.298 ms84 bytes from 13.0.0.13 icmp_seq=4 ttl=60 time=92.248 ms84 bytes from 13.0.0.13 icmp_seq=5 ttl=60 time=94.935 msPC1> ping 192.168.60.2192.168.60.2 icmp_seq=1 timeout84 bytes from 192.168.60.2 icmp_seq=2 ttl=59 time=112.913 ms84 bytes from 192.168.60.2 icmp_seq=3 ttl=59 time=110.144 ms84 bytes from 192.168.60.2 icmp_seq=4 ttl=59 time=116.545 ms84 bytes from 192.168.60.2 icmp_seq=5 ttl=59 time=116.432 ms

以上就是我们的综合实验了,下一章OSPF最后一个实验虚链路。

路由 地址 网段 配置 接口 路由器 区域 静态 进程 实验 主机 外部网 全网 网络 综合 全局 单板 客户 客户端 就是 数据库的安全要保护哪些东西 数据库安全各自的含义是什么 生产安全数据库录入 数据库的安全性及管理 数据库安全策略包含哪些 海淀数据库安全审计系统 建立农村房屋安全信息数据库 易用的数据库客户端支持安全管理 连接数据库失败ssl安全错误 数据库的锁怎样保障安全 广州万易互联网科技有限公司 互联网核心科技是什么 合肥互联网科技公司 赫美联合互联网科技 互联网高科技股票 互联网科技咨询 联恩商钥互联网科技有限公司 成都玖崟互联网科技有限公司乐商圈怎么样 承德科技产业互联网发展 荆州市昕露互联网络科技有限公司 互联网5g黑科技有哪些 互联网媒体平台算高科技产业 高科技互联网发展前景如何 互联网金融科技名词解释 互联网科技资金流入 广东鹅鹅鹅互联网科技有限公司 互联网时代科技型公司的机会 互联网科技职业技能培训学校 承德科技产业互联网平台 每日互联网科技新闻 伟宏互联网科技 上海卓越科技互联网 国智互联网科技 科技信息互联网 互联网金融公司科技 恒银科技与互联网金融 互联网科技公司实习生 众安科技工业互联网合作 南京一网一红互联网科技有限公司 广东猫王互联网科技有限公司电话
0