配置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
 
 
 

 
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章