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

[经验分享] ospf单区域配置

[复制链接]
累计签到:1 天
连续签到:1 天
发表于 2014-11-20 08:39:21 | 显示全部楼层 |阅读模式


133917104.jpg

router0:
Router>en
Router#conf t
Router(config)#int fastEthernet 0/0
Router(config-if)#ip add 192.168.1.1 255.255.255.0
Router(config-if)#no shutdown
Router(config-if)#int s2/0
Router(config-if)#ip add 10.0.0.1 255.0.0.0
Router(config-if)#no shutdown
Router(config-if)#clock rate 64000
router1:
Router>en
Router#conf t
Router(config)#int fastEthernet 0/0
Router(config-if)#ip add 192.168.2.1 255.255.255.0
Router(config-if)#no shutdown
Router(config-if)#int s2/0
Router(config-if)#ip add 10.0.0.2 255.0.0.0
Router(config-if)#no shutdown
Router(config-if)#int s3/0
Router(config-if)#ip add 20.0.0.1 255.0.0.0
Router(config-if)#no shutdown
Router(config-if)#clock rate 64000
router2:
Router>en
Router#conf t
Router(config)#int fastEthernet 0/0
Router(config-if)#ip add 192.168.3.1 255.255.255.0
Router(config-if)#no shutdown
Router(config-if)#int s2/0
Router(config-if)#ip add 20.0.0.2 255.0.0.0
Router(config-if)#no shutdown
接下来我们就去配置OSPF:
其实配置OSPF只是配置与当前路由器相连的接口或接口的IP就可以了。
router0:
Router(config)#router ospf 1
router(config-router)#network 192.168.1.0 0.0.0.255 area 0 //这里的0.0.0.255是192.168.1.0的通配掩码,也就是说当它全为0时,就要进行所有检查也就是匹配,而全为1时,就忽略,我们的子网掩码是由32位二进制数组成,全为0时为0,全为1时为255。这里的0.0.0.255表示检查192.168.1这个网段,若想只检查到192.168这里,通配掩码就为0.0.255.255,依次类推......
router(config-router)#network 10.0.0.0 0.255.255.255 area 0
router1:
Router(config)#router ospf 2
router(config-router)#network 192.168.2.0 0.0.0.255 area 0
router(config-router)#network 10.0.0.0 0.255.255.255 area 0
router(config-router)#network 20.0.0.0 0.255.255.255 area 0
router2:
Router(config)#router ospf 3
router(config-router)#network 192.168.3.0 0.0.0.255 area 0
router(config-router)#network 20.0.0.0 0.255.255.255 area 0
这样我们就可以用192.168.1.2 PC机去与所有网段进行通信,接下来我们分别去查看路由表中所用的协议、OSPF、接口、相邻路由ID、邻居和邻接状态。
router0:
Router#show ip protocols //所使用的协议
Routing Protocol is "ospf 1"
Outgoing update filter list for all interfaces is not set
Incoming update filter list for all interfaces is not set
Router ID 192.168.1.1
Number of areas in this router is 1. 1 normal 0 stub 0 nssa
Maximum path: 4
Routing for Networks:
192.168.1.0 0.0.0.255 area 0
10.0.0.0 0.255.255.255 area 0
Routing Information Sources:
Gateway Distance Last Update
10.0.0.2 110 00:02:14
Distance: (default is 110)

Router#show ip route ospf //路由表中有关OSPF的表项
O 20.0.0.0/8 [110/1562] via 10.0.0.2, 00:02:43, Serial2/0
O 192.168.2.0/24 [110/782] via 10.0.0.2, 00:02:43, Serial2/0
O 192.168.3.0/24 [110/1563] via 10.0.0.2, 00:02:15, Serial2/0
Router#show ip ospf interface //查看接口是否已经被配置到目标区域
FastEthernet0/0 is up, line protocol is up
Internet address is 192.168.1.1/24, Area 0
Process ID 1, Router ID 192.168.1.1, Network Type BROADCAST, Cost: 1
Transmit Delay is 1 sec, State DR, Priority 1
Designated Router (ID) 192.168.1.1, Interface address 192.168.1.1
No backup designated router on this network
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
Hello due in 00:00:01
Index 1/1, flood queue length 0
Next 0x0(0)/0x0(0)
Last flood scan length is 1, maximum is 1
Last flood scan time is 0 msec, maximum is 0 msec
Neighbor Count is 0, Adjacent neighbor count is 0
Suppress hello for 0 neighbor(s)
Serial2/0 is up, line protocol is up
Internet address is 10.0.0.1/8, Area 0
Process ID 1, Router ID 192.168.1.1, Network Type POINT-TO-POINT, Cost: 781
Transmit Delay is 1 sec, State POINT-TO-POINT,
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
Hello due in 00:00:08
Index 2/2, flood queue length 0
Next 0x0(0)/0x0(0)
Last flood scan length is 1, maximum is 1
Last flood scan time is 0 msec, maximum is 0 msec
Neighbor Count is 1 , Adjacent neighbor count is 1
Adjacent with neighbor 10.0.0.2
Suppress hello for 0 neighbor(s)
Router#show ip ospf database //查看链锯号和相邻路由器ID
OSPF Router with ID (192.168.1.1) (Process ID 1)
Router Link States (Area 0)
Link ID ADV Router Age Seq# Checksum Link count
192.168.1.1 192.168.1.1 201 0x80000003 0x00e967 3
192.168.2.1 192.168.2.1 184 0x80000005 0x00d5a1 5
192.168.3.1 192.168.3.1 184 0x80000003 0x001026 3
Router#show ip ospf neighbor //查看关于邻居和邻接状态的信息
Neighbor ID Pri State Dead Time Address Interface
192.168.2.1 1 FULL/- 00:00:37 10.0.0.2 Serial2/0
router1:
Router#show ip protocols
Routing Protocol is "ospf 2"
Outgoing update filter list for all interfaces is not set
Incoming update filter list for all interfaces is not set
Router ID 192.168.2.1
Number of areas in this router is 1. 1 normal 0 stub 0 nssa
Maximum path: 4
Routing for Networks:
192.168.2.0 0.0.0.255 area 0
10.0.0.0 0.255.255.255 area 0
20.0.0.0 0.255.255.255 area 0
Routing Information Sources:
Gateway Distance Last Update
10.0.0.1 110 00:03:26
20.0.0.2 110 00:03:31
Distance: (default is 110)
Router#show ip route ospf
O 192.168.1.0/24 [110/782] via 10.0.0.1, 00:03:54, Serial2/0
O 192.168.3.0/24 [110/782] via 20.0.0.2, 00:03:37, Serial3/0
Router#show ip ospf interface
FastEthernet0/0 is up, line protocol is up
Internet address is 192.168.2.1/24, Area 0
Process ID 2, Router ID 192.168.2.1, Network Type BROADCAST, Cost: 1
Transmit Delay is 1 sec, State DR, Priority 1
Designated Router (ID) 192.168.2.1, Interface address 192.168.2.1
No backup designated router on this network
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
Hello due in 00:00:07
Index 1/1, flood queue length 0
Next 0x0(0)/0x0(0)
Last flood scan length is 1, maximum is 1
Last flood scan time is 0 msec, maximum is 0 msec
Neighbor Count is 0, Adjacent neighbor count is 0
Suppress hello for 0 neighbor(s)
Serial2/0 is up, line protocol is up
Internet address is 10.0.0.2/8, Area 0
Process ID 2, Router ID 192.168.2.1, Network Type POINT-TO-POINT, Cost: 781
Transmit Delay is 1 sec, State POINT-TO-POINT,
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
Hello due in 00:00:04
Index 2/2, flood queue length 0
Next 0x0(0)/0x0(0)
Last flood scan length is 1, maximum is 1
Last flood scan time is 0 msec, maximum is 0 msec
Neighbor Count is 1 , Adjacent neighbor count is 1
Adjacent with neighbor 10.0.0.1
Suppress hello for 0 neighbor(s)
Serial3/0 is up, line protocol is up
Internet address is 20.0.0.1/8, Area 0
Process ID 2, Router ID 192.168.2.1, Network Type POINT-TO-POINT, Cost: 781
Transmit Delay is 1 sec, State POINT-TO-POINT,
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
Hello due in 00:00:08
Index 3/3, flood queue length 0
Next 0x0(0)/0x0(0)
Last flood scan length is 1, maximum is 1
Last flood scan time is 0 msec, maximum is 0 msec
Neighbor Count is 1 , Adjacent neighbor count is 1
Adjacent with neighbor 20.0.0.2
Suppress hello for 0 neighbor(s)
Router#show ip ospf database
OSPF Router with ID (192.168.2.1) (Process ID 2)
Router Link States (Area 0)
Link ID ADV Router Age Seq# Checksum Link count
192.168.1.1 192.168.1.1 260 0x80000003 0x00e967 3
192.168.2.1 192.168.2.1 243 0x80000005 0x00d5a1 5
192.168.3.1 192.168.3.1 243 0x80000003 0x001026 3
Router#show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
192.168.1.1 1 FULL/- 00:00:36 10.0.0.1 Serial2/0
192.168.3.1 1 FULL/- 00:00:32 20.0.0.2 Serial3/0
router2:
Router#show ip protocols
Routing Protocol is "ospf 3"
Outgoing update filter list for all interfaces is not set
Incoming update filter list for all interfaces is not set
Router ID 192.168.3.1
Number of areas in this router is 1. 1 normal 0 stub 0 nssa
Maximum path: 4
Routing for Networks:
192.168.3.0 0.0.0.255 area 0
20.0.0.0 0.255.255.255 area 0
Routing Information Sources:
Gateway Distance Last Update
20.0.0.1 110 00:04:24
Distance: (default is 110)
Router#show ip route ospf
O 10.0.0.0/8 [110/1562] via 20.0.0.1, 00:04:29, Serial2/0
O 192.168.1.0/24 [110/1563] via 20.0.0.1, 00:04:29, Serial2/0
O 192.168.2.0/24 [110/782] via 20.0.0.1, 00:04:29, Serial2/0

Router#show ip ospf interface
FastEthernet0/0 is up, line protocol is up
Internet address is 192.168.3.1/24, Area 0
Process ID 3, Router ID 192.168.3.1, Network Type BROADCAST, Cost: 1
Transmit Delay is 1 sec, State DR, Priority 1
Designated Router (ID) 192.168.3.1, Interface address 192.168.3.1
No backup designated router on this network
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
Hello due in 00:00:09
Index 1/1, flood queue length 0
Next 0x0(0)/0x0(0)
Last flood scan length is 1, maximum is 1
Last flood scan time is 0 msec, maximum is 0 msec
Neighbor Count is 0, Adjacent neighbor count is 0
Suppress hello for 0 neighbor(s)
Serial2/0 is up, line protocol is up
Internet address is 20.0.0.2/8, Area 0
Process ID 3, Router ID 192.168.3.1, Network Type POINT-TO-POINT, Cost: 781
Transmit Delay is 1 sec, State POINT-TO-POINT,
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
Hello due in 00:00:06
Index 2/2, flood queue length 0
Next 0x0(0)/0x0(0)
Last flood scan length is 1, maximum is 1
Last flood scan time is 0 msec, maximum is 0 msec
Neighbor Count is 1 , Adjacent neighbor count is 1
Adjacent with neighbor 20.0.0.1
Suppress hello for 0 neighbor(s)
Router#show ip ospf database
OSPF Router with ID (192.168.3.1) (Process ID 3)
Router Link States (Area 0)
Link ID ADV Router Age Seq# Checksum Link count
192.168.1.1 192.168.1.1 306 0x80000003 0x00e967 3
192.168.3.1 192.168.3.1 289 0x80000003 0x001026 3
192.168.2.1 192.168.2.1 289 0x80000005 0x00d5a1 5
Router#show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
192.168.2.1 1 FULL/- 00:00:34 20.0.0.1 Serial2/0
到此,实验已经做完了


运维网声明 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-31497-1-1.html 上篇帖子: HSRP配置实例 下篇帖子: eigrp 配置
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

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

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

扫描微信二维码查看详情

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


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


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


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



合作伙伴: 青云cloud

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