设为首页 收藏本站
查看: 471|回复: 0

[经验分享] 思科OSPF多区域基本配置

[复制链接]

尚未签到

发表于 2017-10-30 09:35:04 | 显示全部楼层 |阅读模式
5台路由器和2台pc机
5cb11479ccceed89f68bf5ed1574e2e7.png

R1路由器的配置
R1#
R1#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
R1(config)#int e0/0
R1(config-if)#ip address 192.168.2.1 255.255.255.0

R1(config-if)#no sh
R1(config-if)#int e0/1
R1(config-if)#ip address 192.168.1.1 255.255.255.0
R1(config-if)#no sh
R1(config-if)#exit
R1(config)#router ospf 1
R1(config-router)#net
R1(config-router)#network 192.168.1.0 0.0.0.255 area 1

R1(config-router)#network 192.168.2.0 0.0.0.255 area 1
R1(config-router)#area 1 stub

R1(config-router)#exit
R1#sh ip int br
Interface                  IP-Address      OK? Method Status                Protocol
Ethernet0/0                192.168.2.1      YES manual up                    up      
Ethernet0/1                192.168.1.1      YES manual up                    up      
Ethernet0/2                unassigned       YES unset  administratively down       down   
Ethernet0/3                unassigned       YES unset  administratively down       down   
R1#sh 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 route

Gateway of last resort is 192.168.2.2 to network 0.0.0.0

C    192.168.1.0/24 is directly connected, Ethernet0/1
C    192.168.2.0/24 is directly connected, Ethernet0/0
O*IA 0.0.0.0/0 [110/11] via 192.168.2.2, 00:24:11, Ethernet0/0
R1#
R2路由器的配置
R2#
R2#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
R2(config)#int e0/0
R2(config-if)#ip address 192.168.2.2 255.255.255.0
R2(config-if)#no sh
R2(config-if)#int e0/1
R2(config-if)#ip address 192.168.3.1 255.255.255.0
R2(config-if)#no sh
R2(config-if)#exit

R2(config)#router ospf 1
R2(config-router)#network 192.168.2.0 0.0.0.255 area 1

R2(config-router)#network 192.168.3.0 0.0.0.255 area 0

R2(config-router)#exit
R2(config)#router ospf 1

R2(config-router)#area 1 stub no-summary
R2#sh ip int br
Interface                  IP-Address      OK? Method Status                Protocol
Ethernet0/0                192.168.2.2      YES manual up                    up      
Ethernet0/1                192.168.3.1      YES manual up                    up      
Ethernet0/2                unassigned       YES unset  administratively down       down   
Ethernet0/3                unassigned       YES unset  administratively down       down   
R2#sh 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 route

Gateway of last resort is not set

O IA 192.168.4.0/24 [110/20] via 192.168.3.2, 00:10:48, Ethernet0/1
O E2 192.168.5.0/24 [110/20] via 192.168.3.2, 00:07:52, Ethernet0/1
O E2 192.168.6.0/24 [110/20] via 192.168.3.2, 00:05:34, Ethernet0/1
O    192.168.1.0/24 [110/20] via 192.168.2.1, 00:12:00, Ethernet0/0
C    192.168.2.0/24 is directly connected, Ethernet0/0
C    192.168.3.0/24 is directly connected, Ethernet0/1
R2#
R3路由器的配置

R3#      
R3#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
R3(config)#int e0/0
R3(config-if)#ip address 192.168.3.2 255.255.255.0
R3(config-if)#no sh
R3(config-if)#int e0/1
R3(config-if)#ip address 192.168.4.1 255.255.255.0
R3(config-if)#no sh
R3(config-if)#exit
R3(config)#router ospf 1
R3(config-router)#network 192.168.3.0 0.0.0.255 area 0
R3(config-router)#network 192.168.4.0 0.0.0.255 area 2
R3(config-router)#area 2 nssa
R3(config-router)#exit
R3(config)#do sh ip int br
Interface                  IP-Address      OK? Method Status                Protocol
Ethernet0/0                192.168.3.2       YES manual up                    up      
Ethernet0/1                192.168.4.1       YES manual up                    up      
Ethernet0/2                unassigned        YES unset  administratively down     down   
Ethernet0/3                unassigned        YES unset  administratively down     down   
R3(config)#do sh 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 route

Gateway of last resort is not set

C    192.168.4.0/24 is directly connected, Ethernet0/1
O N2 192.168.5.0/24 [110/20] via 192.168.4.2, 00:11:57, Ethernet0/1
O N2 192.168.6.0/24 [110/20] via 192.168.4.2, 00:09:38, Ethernet0/1
O IA 192.168.1.0/24 [110/30] via 192.168.3.1, 00:11:57, Ethernet0/0
O IA 192.168.2.0/24 [110/20] via 192.168.3.1, 00:11:57, Ethernet0/0
C    192.168.3.0/24 is directly connected, Ethernet0/0

R4路由器的配置
R4#
R4#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
R4(config)#int e0/0
R4(config-if)#ip address 192.168.4.2 255.255.255.0

R4(config-if)#no sh
R4(config-if)#int e0/1
R4(config-if)#ip address 192.168.5.1 255.255.255.0

R4(config-if)#no sh
R4(config-if)#exit
R4(config)#router ospf 1
R4(config-router)#network 192.168.4.0 0.0.0.255 area 2
R4(config-router)#area 2 nssa
R4(config-router)#exit
R4(config)#router rip

R4(config-router)#network 192.168.5.0

R4(config-router)#version 2

R4(config-router)#no auto-summary
R4(config-router)#exit

R4(config)#router ospf 1
R4(config-router)#redistribute rip subnets
R4(config-router)#router rip
R4(config-router)#redistribute ospf 1 metric 1
R4(config-router)#exit
R4(config)#do sh 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 route

Gateway of last resort is not set

C    192.168.4.0/24 is directly connected, Ethernet0/0
C    192.168.5.0/24 is directly connected, Ethernet0/1
R    192.168.6.0/24 [120/1] via 192.168.5.2, 00:00:06, Ethernet0/1
O IA 192.168.1.0/24 [110/40] via 192.168.4.1, 00:02:26, Ethernet0/0
O IA 192.168.2.0/24 [110/30] via 192.168.4.1, 00:02:26, Ethernet0/0
O IA 192.168.3.0/24 [110/20] via 192.168.4.1, 00:02:26, Ethernet0/0
R4(config)#do sh ip int br
Interface                  IP-Address      OK? Method Status                Protocol
Ethernet0/0                192.168.4.2       YES manual up                    up      
Ethernet0/1                192.168.5.1       YES manual up                    up      
Ethernet0/2                unassigned        YES unset  administratively down     down   
Ethernet0/3                unassigned        YES unset  administratively down     down   
R4(config)#
R5路由器的配置
R5#
R5#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
R5(config)#int e0/0
R5(config-if)#ip address 192.168.5.2 255.255.255.0
R5(config-if)#no sh
R5(config-if)#int e0/1
R5(config-if)#ip address 192.168.6.1 255.255.255.0
R5(config-if)#no sh
R5(config-if)#exit
R5(config)#router rip

R5(config-router)#network 192.168.5.0

R5(config-router)#network 192.168.6.0
R5(config-router)#version 2
R5(config-router)#no auto-summary
R5(config-router)#exit
R5#sh ip int br
Interface                  IP-Address      OK? Method Status                Protocol
Ethernet0/0                192.168.5.2       YES manual up                    up      
Ethernet0/1                192.168.6.1       YES manual up                    up      
Ethernet0/2                unassigned        YES unset  administratively down      down   
Ethernet0/3                unassigned        YES unset  administratively down      down   
R5#sh 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 route

Gateway of last resort is not set

R    192.168.4.0/24 [120/1] via 192.168.5.1, 00:00:20, Ethernet0/0
C    192.168.5.0/24 is directly connected, Ethernet0/0
C    192.168.6.0/24 is directly connected, Ethernet0/1
R    192.168.1.0/24 [120/1] via 192.168.5.1, 00:00:20, Ethernet0/0
R    192.168.2.0/24 [120/1] via 192.168.5.1, 00:00:20, Ethernet0/0
R    192.168.3.0/24 [120/1] via 192.168.5.1, 00:00:20, Ethernet0/0
R5#
最后可以用show查看各个路由器的信息
show ip route  //查看路由表
show ip ospf   //查看OSPF的配置
show ip int ospf int e0/0  // 查看OSPF接口的数据结构
show ip route os  //查看学习到的路由
验证PC机的连通性
d668dfaf0c32c85cf3895a95eae1ffe9.png
20b462ccc6c2ad29619e7de6458d21e5.png



运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-406166-1-1.html 上篇帖子: RHCA CL220 CloudForms 3.1 架构介绍 下篇帖子: 小公司ACL网络规划
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表