OSPF路由汇总及OSPF验证实验

OSPF路由汇总及OSPF验证实验
1、OSPF基本配置
Router>en
Router#conf t
Router(config)#hostname R1
R1(config)#interface f0/0
R1(config-if)#ip add 200.1.1.1 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#exit
R1(config)#interface loopback 0
R1(config-if)#ip add 192.168.12.1 255.255.255.0
R1(config-if)#interface loopback 1
R1(config-if)#ip add 192.168.13.1 255.255.255.0
R1(config-if)#interface loopback 2
R1(config-if)#ip add 192.168.14.1 255.255.255.0
R1(config-if)#interface loopback 3
R1(config-if)#ip add 192.168.15.1 255.255.255.0
R1(config-if)#exit

R1(config)#router ospf 1
R1(config-router)#network 200.1.1.0 0.0.0.255 area 1
R1(config-router)#network 192.168.12.0 0.0.0.255 area 1
R1(config-router)#network 192.168.13.0 0.0.0.255 area 1
R1(config-router)#network 192.168.14.0 0.0.0.255 area 1
R1(config-router)#network 192.168.15.0 0.0.0.255 area 1
R1(config-router)#

Router>enable
Router#configure terminal
Router(config)#hostname R2
R2(config)#interface FastEthernet0/0
R2(config-if)#ip address 200.1.1.2 255.255.255.0
R2(config-if)#no shutdown
R2(config)#interface FastEthernet0/1
R2(config-if)#ip address 200.1.2.1 255.255.255.0
R2(config-if)#no shutdown
R2(config-if)#exit
R2(config)#router ospf 1
R2(config-R2)#network 200.1.1.0 0.0.0.255 area 1
R2(config-R2)#network 200.1.2.0 0.0.0.255 area 0

Router>enable
Router#configure terminal
Router(config)#hostname R3
R3(config)#interface FastEthernet0/0
R3(config-if)#ip address 200.1.2.2 255.255.255.0
R3(config-if)#no shutdown
R3(config-if)#exit
R3(config)#interface loopback 0
R3(config-if)#
R3(config-if)#ip add 172.16.1.1 255.255.255.0
R3(config-if)#exit
R3(config)#router ospf 1
R3(config-R3)#network 172.16.1.0 0.0.0.255 area 0
R3(config-R3)#network 200.1.2.0 0.0.0.255 area 0
R3(config-R3)#end

2、在R3 上查看路由条目
R3#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 external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP

可以看到具体的子网路由,下面路由表路由条目比较多
172.16.0.0/24 is subnetted, 1 subnets
C 172.16.1.0 is directly connected, Loopback0
192.168.12.0/32 is subnetted, 1 subnets
OIA 192.168.12.1 [110/3] via 200.1.2.1, 00:04:53, FastEthernet0/0
192.168.13.0/32 is subnetted, 1 subnets
O IA 192.168.13.1 [110/3] via 200.1.2.1, 00:04:53, FastEthernet0/0
192.168.14.0/32 is subnetted, 1 subnets
O IA192.168.14.1 [110/3] via 200.1.2.1, 00:04:53, FastEthernet0/0
192.168.15.0/32 is subnetted, 1 subnets
O IA 192.168.15.1 [110/3] via 200.1.2.1, 00:04:53, FastEthernet0/0

O IA 200.1.1.0/24 [110/2] via 200.1.2.1, 00:04:53, FastEthernet0/0
C 200.1.2.0/24 is directly connected, FastEthernet0/0
R3#

3、思考如何减少路由条目---方法进行路由汇总 (ABR)
可以看到区域间路由条目很多,具体子网路由是看到的,我们希望减少路由条目,提高路由查询及转发效率,就要把这些子网进行汇总,汇总成;一个超网 。
192.168.12.0
192.168.13.0
192.168.14.0
192.168.15.0
如何汇总成一个网络?
192.168.00001100.0
192.168.00001101.0
192.168.00001110.0
192.168.00001111.0
汇总后的超网
192.168.12.0/22

4、在ABR上进行路由汇总

R2(config)#router ospf 1
R2(config-router)#area 1 range 192.168.12.0 255.255.252.0

5、汇总后在R3上查看路由表,会看到汇总后的路由实验即成功。
R3#show ip route
172.16.0.0/24 is subnetted, 1 subnets
C 172.16.1.0 is directly connected, Loopback0
O IA 192.168.12.0/22 [110/3] via 200.1.2.1, 00:00:05, FastEthernet0/0
O IA 200.1.1.0/24 [110/2] via 200.1.2.1, 00:17:36, FastEthernet0/0
C 200.1.2.0/24 is directly connected, FastEthernet0/0
R3#


实验二OSPF验证
OSPF验证方式:
接口验证和区域验证


一 、接口验证下的简单密码身份验证
要求R1和R2之间的链路做OSPF接口明文验证

R1>en
R1#conf t
R1(config)#in
R1(config)#interface f0/0
R1(config-if)#ip ospf authentication
R1(config-if)#ip ospf authentication-key 666
R1(config-if)#end
R1#
R1#show ip ospf ne
R1#show ip ospf neighbor 邻居关系不存在了

R1#show ip rou
R1#show ip route OSPF路由条目消失
C 192.168.12.0/24 is directly connected, Loopback0
C 192.168.13.0/24 is directly connected, Loopback1
C 192.168.14.0/24 is directly connected, Loopback2
C 192.168.15.0/24 is directly connected, Loopback3
C 200.1.1.0/24 is directly connected, FastEthernet0/0
R1#

在R2上做一样的配置
R2>en
R2#conf t
R2(config)#interface f0/0
R2(config-if)#ip ospf authentication
R2(config-if)#ip ospf authentication-key 666
R2(config-if)#end
R2#

01:10:47: %OSPF-5-ADJCHG: Process 1, Nbr 192.168.15.1 on FastEthernet0/0 from LOADING to FULL, Loading Done
验证成功后系统提示的FULL状态
Router(config)#end
Router#

R2#show ip ospf neighbor 查看邻居关系正常
Neighbor ID Pri State Dead Time Address Interface
192.168.15.1 1 FULL/BDR 00:00:33 200.1.1.1 FastEthernet0/0
172.16.1.1 1 FULL/BDR 00:00:39 200.1.2.2 FastEthernet0/1

R2#show ip ospf interface 查看接口属性
FastEthernet0/0 is up, line protocol is up
......

Simple password authentication enabled

二、接口验证下的密文密码身份验证
要求R1和R2之间的链路做OSPF接口密文验证

R1(config)#interface f0/0
R1(config-if)#ip ospf authentication message-digest
R1(config-if)#ip ospf message-digest-key 1 md5 888

R2(config)#interface f0/0
R2(config-if)#ip ospf authentication message-digest
R2(config-if)#ip ospf message-digest-key 1 md5 888
R2(config-if)#end

未完待续

转载于:https://blog.51cto.com/ronning/2319250

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值