From 5e5e3ef4f1eb0a8b8e0db15fb2016774257685f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=A9=89=E5=A9=B7?= <2465898445@qq.com> Date: Wed, 23 Apr 2025 21:41:56 +0800 Subject: [PATCH] 20250423 --- ...17\221\357\274\210OSPF+RIP\357\274\211.md" | 209 ++++++++++++++++++ 1 file changed, 209 insertions(+) create mode 100644 "35 \347\216\213\345\251\211\345\251\267/20250422 \350\267\257\347\224\261\345\231\250\351\207\215\345\210\206\345\217\221\357\274\210OSPF+RIP\357\274\211.md" diff --git "a/35 \347\216\213\345\251\211\345\251\267/20250422 \350\267\257\347\224\261\345\231\250\351\207\215\345\210\206\345\217\221\357\274\210OSPF+RIP\357\274\211.md" "b/35 \347\216\213\345\251\211\345\251\267/20250422 \350\267\257\347\224\261\345\231\250\351\207\215\345\210\206\345\217\221\357\274\210OSPF+RIP\357\274\211.md" new file mode 100644 index 0000000..2501b03 --- /dev/null +++ "b/35 \347\216\213\345\251\211\345\251\267/20250422 \350\267\257\347\224\261\345\231\250\351\207\215\345\210\206\345\217\221\357\274\210OSPF+RIP\357\274\211.md" @@ -0,0 +1,209 @@ +# 路由器重分发(OSPF+RIP) + +# 版本 1 RIP充当翻译官 + + + +![image-20250422143735823](https://gitee.com/wangwting/image-ownership-location/raw/master/img/upgit_20250422_1745303855.png) + +```cmd +OSPF路由器只会OSPF语言;RIP路由器充当翻译官就要会OSPF语言和RIP语言;则在RIP中还需要将OSPF翻译成RIP +``` + +- OSPF + +```cmd +把RIP路由器当成翻译官,OSPF路由器就只需要宣告自己的ip,也就是network 1.1.1.0 0.0.0.255 area 0 + +network 2.2.2.0 0.0.0.255 area 0 +``` + +- RIP + +```cmd +RIP路由器作为翻译官,要做的是宣告自己的IP;还需要为OSPF翻译,所以要有一条通道可以翻译OSPF: +router rip +network 3.3.3.0 + +还要进入router ospf 1中, +network 2.2.2.0 0.0.0.255 area 0 +也宣告一下作为翻译的通道,表示两个都学到,就是会翻译OSPF和RIP +``` + + + +## 开启端口并配置IP + +- OSPF(路由器) + +```cmd +Router>en +Router#conf t +Router(config)#int g0/0 +Router(config-if)#no shutdown +Router(config-if)#ip add 1.1.1.2 255.255.255.0 +Router(config-if)#ex +Router(config)#int g0/1 +Router(config-if)#no shutdown +Router(config-if)#ip ad 2.2.2.1 255.255.255.0 +``` + +- RIP(路由器) + +```cmd +Router>en +Router#conf t +Router(config)#int g0/0 +Router(config-if)#no shutdown +Router(config-if)#ip add 3.3.3.1 255.255.255.0 +Router(config-if)#ex +Router(config)#int g0/1 +Router(config-if)#no shutdown +Router(config-if)#ip add 2.2.2.2 255.255.255.0 +Router(config-if)#ex +``` + +## OSPF协议 + +- OSPF路由器 + +```cmd +Router(config)#router ospf 1 +Router(config-router)#network 1.1.1.0 0.0.0.255 area 0 +Router(config-router)#network 2.2.2.0 0.0.0.255 area 0 +``` + +## RIP协议 + +- RIP(路由器) + +```cmd +Router(config)#router rip +Router(config-router)#version 2 +Router(config-router)#network 3.3.3.0 +Router(config-router)#ex +Router(config)#router ospf 1 +Router(config-router)#network 2.2.2.0 0.0.0.255 area 0 +Router(config-router)#ex +``` + +## 路由器重分发 + +- RIP(路由器) + +```cmd +Router(config)#router rip +Router(config-router)#redistribute ospf 1 metric 5 +Router(config-router)#ex +Router(config)#router ospf 1 +Router(config-router)#redistribute rip subnets +``` + + + + + +# 版本2 OSPF充当翻译官 + +![image-20250422144920627](https://gitee.com/wangwting/image-ownership-location/raw/master/img/upgit_20250422_1745304560.png) + +```cmd +RIP路由器只会RIP语言;OSPF路由器充当翻译官就要会OSPF语言和RIP语言;则在OSPF中还需要将RIP翻译成OSPF +``` + +- RIP + +```cmd +把OSPF路由器当成翻译官,RIP路由器就只需要宣告自己的ip,也就是 +network 3.3.3.0 0.0.0.255 area 0 + +network 2.2.2.0 0.0.0.255 area 0 +``` + +- OSPF + +```cmd +OSPF路由器作为翻译官,要做的是宣告自己的IP; +router ospf 1 +network 1.1.1.0 0.0.0.255 area 0 +还需要为RIP翻译,所以要有一条通道可以翻译RIP: +router rip +version 2 +network 2.2.2.0 +``` + + + +## 开启端口并配置IP + +- OSPF(路由器) + +```cmd +Router>en +Router#conf t +Router(config)#int g0/0 +Router(config-if)#no shutdown +Router(config-if)#ip add 1.1.1.2 255.255.255.0 +Router(config-if)#ex +Router(config)#int g0/1 +Router(config-if)#no shutdown +Router(config-if)#ip ad 2.2.2.1 255.255.255.0 +``` + +- RIP(路由器) + +```cmd +Router>en +Router#conf t +Router(config)#int g0/0 +Router(config-if)#no shutdown +Router(config-if)#ip add 3.3.3.1 255.255.255.0 +Router(config-if)#ex +Router(config)#int g0/1 +Router(config-if)#no shutdown +Router(config-if)#ip add 2.2.2.2 255.255.255.0 +Router(config-if)#ex +``` + + + +## RIP协议 + +```cmd +Router>en +Router#conf t +Router(config)#router rip +Router(config-router)#version 2 +Router(config-router)#network 3.3.3.0 +Router(config-router)#network 2.2.2.0 +``` + + + +## OSPF协议 + +```cmd +Router>en +Router#conf t +Router(config)#router ospf 1 +Router(config-router)#network 1.1.1.0 0.0.0.255 area 0 +Router(config-router)#ex +Router(config)#router rip +Router(config-router)#version 2 +Router(config-router)#network 2.2.2.0 +``` + +## 路由器重分发 + +```cmd +Router(config)#router rip +Router(config-router)#version 2 +Router(config-router)#redistribute ospf 1 metric 5 +Router(config-router)#ex +Router(config)#router ospf 1 +Router(config-router)#redistribute rip subnets +``` + + + +- 最终的结果都是要show ip route上显示的ip才能ping通,才算成功 \ No newline at end of file -- Gitee