配置Ospf与Eigrp的路由再发布

配置Ospf与Eigrp的路由再发布
环境:三台路由器串口相连,接口配置如图
要求:1.配置EIGRP和关闭自动路由汇总
2.在R1上配置LOOP口的EIGRP手工路由汇总
3.在R2和R3配置Ospf 接口验证
4.在ASBR(R2)上作eigrp和ospf双向再发布
5.在R3上将全部loopback 口再发布到ospf中,但loopback2不能被R2,R3学到,不容许使用network命令
6.练习本课全部show命令
 
步骤一:配置三个路由器接口使其连通。
R1的配置
R1(config)# interface Loopback0
R1(config-if)#ip address 172.168.1.1 255.255.255.0
R1(config)# interface Loopback1
R1(config-if)#ip address 172.168.2.1 255.255.255.0
R1(config)#interface Loopback2
R1(config-if)#ip address 172.168.3.1 255.255.255.0
R1(config)# interface s0
R1(config-if)# ip address 10.1.1.1 255.255.255.0
R1(config-if)#clock rate 64000
R1(config-if)#no shutdown
R2的配置
R2(config)#interface s0
R2(config-if)#ip address 20.1.1.1 255.255.255.0
R2(config-if)#no shutdown
R2(config)#interface s1
R2(config-if)# ip address 10.1.1.1 255.255.255.0
R2(config-if)#no shutdown
R3的配置
R3(config)# interface Loopback0
R3(config-if)#ip address 192.168.1.1 255.255.255.0
R3(config)# interface Loopback1
R3(config-if)#ip address 192.168.2.1 255.255.255.0
R3(config)#interface Loopback2
R3(config-if)#ip address 192.168.3.1 255.255.255.0
R3(config)# interface s1
R3(config-if)# ip address 20.1.1.2 255.255.255.0
R3(config-if)#clock rate 64000
R3(config-if)#no shutdown

步骤二: 配置Eigrp ,Ospf
R1的配置
R1(config)# router eigrp 100  à启用EIGRP
R1(config-router)# network 10.1.1.0 0.0.0.255  à发布相应接口
R1(config-router)#network 172.168.1.0 0.0.0.255
R1(config-router)#network 172.168.2.0 0.0.0.255
R1(config-router)#network 172.168.3.0 0.0.0.255
R1(config-router)# no auto-summary  à关闭自动汇总
R2的配置
R2(config)# router eigrp 100
R2(config-router)# network 10.1.1.0 0.0.0.255
R2(config-router)# no auto-summary
R2(config)# router ospf 10  à在R2上即启用EIGRP而且启用OSPF
R2(config-router)# network 20.1.1.0 0.0.0.255 area 0
R3的配置
R3(config)# router ospf 10
R3(config-router)# network 20.1.1.0 0.0.0.255 area 0

步骤三:配置EIGRP手工路由汇总和Ospf接口验证
R1的配置
R1(config)# interface s0
R1(config-if)# ip summary-address eigrp 100 172.168.0.0 255.255.252.0 à手工汇总
R2的配置
R2(config)# interface s0
R2(config-if)# ip ospf authentication message-digest  à启用接口验证
R2(config-if)# ip ospf message-digest-key 1 md5 cisco
R3的配置
R3(config)# interface s1
R3(config-if)# ip ospf authentication message-digest  à启用接口认证
R3(config-if)# ip ospf message-digest-key 1 md5 cisco

步骤四:在R2,R3上作路由再发布并控制loopback2不能被R1,R2学到
R2的配置
R2(config)# router eigrp 100
R2(config-router)# redistribute ospf 10 metric 10000 100 255 1 1500à将ospf重分发进eigrp
R2(config)# router ospf 10
R2(config-router)# redistribute eigrp 100 subnets  à将eigrp路由重分发到ospf
R3的配置
R3(config)# access-list 1 permit 192.168.1.0 0.0.0.255  à定义分发条件列表
R3(config)# access-list 1 permit 192.168.2.0 0.0.0.255
R3(config)# access-list 2 permit 192.168.3.0 0.0.0.255
R3(config)# route-map o-e permit 10   à作映射列表容许相应条目
R3 (config-route-map)# match ip address 1  à将列表加载
R3(config)# route-map o-e deny 20  à拒绝相应条目的映射列表
R3 (config-route-map)# match ip address 2  à将列表加载
R3(config)# route-map o-e permit 25  à最后容许其它全部
R3(config)# router ospf 10
R3(config-router)# redistribute connected subnets route-map o-e

步骤五:查看路由表
R1#sh 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
       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
     20.0.0.0/24 is subnetted, 1 subnets
D EX    20.1.1.0 [170/2195456] via 10.1.1.2, 00:03:50, Serial0  à外部路由条目
     172.168.0.0/16 is variably subnetted, 4 subnets, 2 masks
D       172.168.0.0/22 is a summary, 00:03:56, Null0
C       172.168.1.0/24 is directly connected, Loopback0
C       172.168.2.0/24 is directly connected, Loopback1
C       172.168.3.0/24 is directly connected, Loopback2
     10.0.0.0/24 is subnetted, 1 subnets
C       10.1.1.0 is directly connected, Serial0
D EX 192.168.1.0/24 [170/2195456] via 10.1.1.2, 00:01:53, Serial0
D EX 192.168.2.0/24 [170/2195456] via 10.1.1.2, 00:01:53, Serial0
R2#sh 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
       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
     20.0.0.0/24 is subnetted, 1 subnets
C       20.1.1.0 is directly connected, Serial0
     172.168.0.0/22 is subnetted, 1 subnets
D       172.168.0.0 [90/2297856] via 10.1.1.1, 00:05:39, Serial1
     10.0.0.0/24 is subnetted, 1 subnets
C       10.1.1.0 is directly connected, Serial1
O E2 192.168.1.0/24 [110/20] via 20.1.1.2, 00:03:42, Serial0  àospf外部路由条目类型2
O E2 192.168.2.0/24 [110/20] via 20.1.1.2, 00:03:42, Serial0
R3#sh 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
       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
     20.0.0.0/24 is subnetted, 1 subnets
C       20.1.1.0 is directly connected, Serial1
     172.168.0.0/22 is subnetted, 1 subnets
O E2    172.168.0.0 [110/20] via 20.1.1.1, 00:04:48, Serial1
     10.0.0.0/24 is subnetted, 1 subnets
O E2    10.1.1.0 [110/20] via 20.1.1.1, 00:04:48, Serial1
C    192.168.1.0/24 is directly connected, Loopback0
C    192.168.2.0/24 is directly connected, Loopback1
C    192.168.3.0/24 is directly connected, Loopback2

步骤六:用ping命令测试连通性
R1#ping 192.168.2.1
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 60/60/64 ms
R3#ping 172.168.1.1
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 60/60/60 ms

步骤七:查看配置
R1#sh run
hostname R1
!
interface Loopback0
 ip address 172.168.1.1 255.255.255.0
!
interface Loopback1
 ip address 172.168.2.1 255.255.255.0
!
interface Loopback2
 ip address 172.168.3.1 255.255.255.0
!
interface Serial0
 ip address 10.1.1.1 255.255.255.0
 ip summary-address eigrp 100 172.168.0.0 255.255.252.0 5
 clockrate 64000
!
router eigrp 100
 network 10.1.1.0 0.0.0.255
 network 172.168.1.0 0.0.0.255
 network 172.168.2.0 0.0.0.255
 network 172.168.3.0 0.0.0.255
 no auto-summary
!
end
R2#sh run
hostname R2
!
interface Serial0
 ip address 20.1.1.1 255.255.255.0
 ip ospf authentication message-digest
 ip ospf message-digest-key 1 md5 cisco
!
interface Serial1
 ip address 10.1.1.2 255.255.255.0
!
router eigrp 100
 redistribute ospf 10 metric 10000 100 255 1 1500
 network 10.1.1.0 0.0.0.255
 no auto-summary
!
router ospf 10
redistribute eigrp 100 subnets
 network 20.1.1.0 0.0.0.255 area 0
!
end
R3#sh run hostname R3 ! interface Loopback0  ip address 192.168.1.1 255.255.255.0  ip ospf network point-to-point ! interface Loopback1  ip address 192.168.2.1 255.255.255.0  ip ospf network point-to-point ! interface Loopback2  ip address 192.168.3.1 255.255.255.0  ip ospf network point-to-point  à定义网络类型,不然为主机路由32位 ! interface Serial1  ip address 20.1.1.2 255.255.255.0  ip ospf authentication message-digest  ip ospf message-digest-key 1 md5 cisco  clockrate 64000 ! router ospf 10 redistribute connected subnets route-map o-e  network 20.1.1.0 0.0.0.255 area 0 ! access-list 1 permit 192.168.1.0 0.0.0.255 access-list 1 permit 192.168.2.0 0.0.0.255 access-list 2 permit 192.168.3.0 0.0.0.255 route-map o-e permit 10  match ip address 1 ! route-map o-e deny 20  match ip address 2 ! route-map o-e permit 25 ! end
相关文章
相关标签/搜索