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

[经验分享] Cisco路由器与三层交换机OSPF的基本组网应用

[复制链接]
累计签到:1 天
连续签到:1 天
发表于 2016-11-7 13:21:33 | 显示全部楼层 |阅读模式
                                                                   QQ截图20161107132105.png
OSPF组网基本配置:
1. 三层交换机
Switch>enable
Switch#configure terminal
Enter configuration commands, one per line. End withCNTL/Z.
Switch(config)#vlan 10                                      //创建VLAN
Switch(config-vlan)#interface vlan 10                       // 创建VLAN虚接口
%LINK-5-CHANGED: Interface Vlan10, changed state to up
Switch(config-if)#ip address 192.168.10.254255.255.255.0   // 设置VLAN虚接口地址

Switch(config-if)#interface fa0/1
Switch(config-if)#switchport access vlan 10             // 设置接口VLAN ID
%LINEPROTO-5-UPDOWN: Line protocol on InterfaceVlan10, changed state to up

Switch(config-if)#interface fa0/24                          // 进入接口配置模式
Router(config-if)#no shutdown                               // 启用/打开 接口
Switch(config-if)#no switchport                        // 交换模式改为路由模式
Switch(config-if)#ip address 192.168.20.1255.255.255.0 // 设置接口IP地址
Switch(config-if)#exit

Switch(config)#ip routing                                   //启用路由功能
Switch(config)#router ospf 1                                //创建ospf进程1
Switch(config-router)#network192.168.20.0 0.0.0.255 area 1 // 设置子网号与区域ID
Switch(config-router)#redistribute connected            //将直连链路发布到LSDB中
Switch(config-router)#exit
Switch(config)#exit
Switch#write                        // 保存当前配置到系统配置文件,以便下次启动使用

2. 路由器R0
Router>enable
Router#configure terminal
Enter configuration commands, one per line. End withCNTL/Z.
Router(config)#hostname R1                              // 修改设备名称

R1(config)#interface fastEthernet 0/0                   // 进入接口配置模式
R1(config-if)#ip address 192.168.20.2 255.255.255.0     // 设置接口IP地址
R1(config-if)#no shutdown                               // 启用/打开 接口
R1(config-if)#interface fastEthernet 0/1
R1(config-if)#ip address 192.168.30.1 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#exit

R1(config)# router ospf 1                                 // 创建ospf进程1
R1(config-router)#network 192.168.20.0 0.0.0.255area 1   // 设置子网号与区域ID
R1(config-router)#network 192.168.30.0 0.0.0.255area 0   // 设置子网号与区域ID
R1(config-router)#exit
Router(config)#exit
Router#write

3. 路由器R1
Router>enable
Router#configure terminal
Enter configuration commands, one per line. End withCNTL/Z.
Router(config)#hostname R1
R1(config)#interface fastEthernet 0/0
R1(config-if)#ip address 192.168.30.2 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#interface fastEthernet 0/1
R1(config-if)#ip address 192.168.40.1 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#exit

R1(config)#router ospf 1
R1(config-router)#network 192.168.30.0 0.0.0.255area 0
R1(config-router)#network 192.168.40.0 0.0.0.255area 2
R1(config-router)#exit
R1(config)#exit
R1#write

4. 路由器R2
Router>enable
Router#confiure terminal
Enter configuration commands, one per line. End withCNTL/Z.
Router(config)#hostname R2
R2(config)#interface fastEthernet 0/0
R2(config-if)#ip address 192.168.40.2 255.255.255.0
R2(config-if)#no shutdown
R2(config-if)#interface fastEthernet 0/1
R2(config-if)#ip address 192.168.50.254 255.255.255.0
R2(config-if)#no shutdown
R2(config-if)#exit

R2(config)#router ospf 1
R2(config-router)#network 192.168.40.0 0.0.0.255area 2
R2(config-router)#network 192.168.50.0 0.0.0.255area 2
R2(config-router)#exit
R2(config)#exit
R2#write

查看OSPF路由表:
1.三层交换机
Switch#show ip route
Codes: C - connected, S - static, I - IGRP, 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 NSSAexternal 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

C 192.168.10.0/24 is directly connected, Vlan10
C 192.168.20.0/24 is directly connected,FastEthernet0/24
O IA 192.168.30.0/24 [110/2] via 192.168.20.2,00:07:08, FastEthernet0/24
O IA 192.168.40.0/24 [110/3] via 192.168.20.2,00:05:31, FastEthernet0/24
OIA 192.168.50.0/24 [110/4] via 192.168.20.2, 00:03:34, FastEthernet0/24

2.路由器R2
R2#show ip route
Codes: C - connected, S - static, I - IGRP, 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 externaltype 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

O E2 192.168.10.0/24 [110/20] via 192.168.40.1,00:00:39, FastEthernet0/0
O IA 192.168.20.0/24 [110/3] via 192.168.40.1,00:03:57, FastEthernet0/0
O IA192.168.30.0/24 [110/2] via 192.168.40.1, 00:03:57, FastEthernet0/0
C 192.168.40.0/24 is directly connected, FastEthernet0/0
C 192.168.50.0/24 is directlyconnected, FastEthernet0/1

网络连通性测试:
QQ截图20161107132114.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-296966-1-1.html 上篇帖子: 思科交换机3650密码恢复 下篇帖子: hsrp+route-map 解决多路由器多isp 路由器 交换机 Cisco 组网
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

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

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

扫描微信二维码查看详情

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


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


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


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



合作伙伴: 青云cloud

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