需求:
1、
2、
3、
4、
5、
6、
======================================================
解决方案:
需求1:
R2(config)#router ospf 1
R2(config-router)#redistribute rip subnets metric 30
R2(config)#router rip
R2(config-router)#redistribute ospf 1 metric 5
R4(config)#router ospf 1
R4(config-router)#redistribute eigrp 100 subnets
R4(config)#router eigrp 100
R4(config-router)#redistribute ospf 1 metric 10000 100 255 1 1500
---------------------------------------------------------------------------------------
需求2:
R2(config)#router ospf 1
R2(config-router)#area 0 authentication
R2(config)#int s1/1
R2(config-if)#ip ospf authentication-key cisco
R2(config)#service password-encryption
R3(config)#router ospf 1
R3(config-router)#area 0 authentication
R3(config)#int s1/0
R3(config-if)#ip ospf authentication-key cisco
-->区域0做明文认证,但是全局加密。
R3(config)#int s1/1
R3(config-if)#ip ospf authentication message
R3(config-if)#ip ospf message-digest-key 1 md5 cisco1
R4(config)#int s1/0
R4(config-if)#ip ospf authentication message-digest
R4(config-if)#ip ospf message-digest-key 1 md5 cisco1
-->区域1接口上做密文认证。
------------------------------------------------------------------------------
需求3:
R3(config)#int lo 1
R3(config-if)#ip add 10.3.3.3 255.255.255.0
R3(config)#ip route 0.0.0.0 0.0.0.0 lo 1
default-information originate才有效
R3(config)#router ospf 1
R3(config-router)#default-information originate metric-type 1 metric 33
R4#show ip route ospf
O E2 192.168.12.0/24 [110/30] via 192.168.34.3, 00:01:01, Serial1/0
O E2
O IA
O IA
O IA 192.168.23.0/24 [110/128] via 192.168.34.3, 00:01:01, Serial1/0
O*E2 0.0.0.0/0 [110/1] via 192.168.34.3, 00:01:01, Serial1/0
-->看到R4上有一条指向R3的默认路由。
--------------------------------------------------------------------------
R3(config)#access-list 1 permit 4.4.4.4
R3(config)#route-map ccna permit 10
R3(config-route-map)#match ip address 1
R3(config)#router ospf 1
R3(config-router)#default-information originate route-map ccna
R4(config)#router ospf 1
R4(config-router)#no network 4.4.4.4 0.0.0.0 area 1
R4#sh ip route ospf
O E2 192.168.12.0/24 [110/30] via 192.168.34.3, 00:00:07, Serial1/0
O E2
O IA
O IA
O IA 192.168.23.0/24 [110/128] via 192.168.34.3, 00:00:07, Serial1/0
-->这里看到R3少缺少4.4.4.4/32的路由条目时,不再对外发布默认路由。
再把R4环回口的OSPF进程打开
R4(config-router)#network 4.4.4.4 0.0.0.0 area 1
R4#sh ip route ospf
O E2 192.168.12.0/24 [110/30] via 192.168.34.3, 00:00:14, Serial1/0
O E2
O IA
O IA
O IA 192.168.23.0/24 [110/128] via 192.168.34.3, 00:00:14, Serial1/0
O*E2 0.0.0.0/0 [110/1] via 192.168.34.3, 00:00:14, Serial1/0
-->可以看到默认路由出现了!
------------------------------------------------------------------------------------------
需求4:
R5(config)#int lo 1
R5(config-if)#ip add 172.16.1.5 255.255.255.0
R5(config)#int lo 2
R5(config-if)#ip add 172.16.2.5 255.255.255.0
R5(config)#int lo 3
R5(config-if)#ip add 172.16.3.5 255.255.255.0
R5(config)#rouetr eigrp 100
R5(config-router)#network 172.16.0.0 0.0.3.255
R4(config)#ip prefix-list ccnp permit 172.16.1.0/24
R4(config)#ip prefix-list ccnp permit 172.16.2.0/24
R4(config)#ip prefix-list ccnp permit 172.16.3.0/24
R4(config)#route-map ccna permit 10
R4(config-route-map)#match ip address prefix-list ccnp
R4(config-route-map)#set tag 5
R4(config)#route-map ccna permit 20
R4(config)#router ospf 1
R4(config-router)#redistribute eigrp 100 subnets route-map ccna metric 50
R3#sh ip route ospf
O E2 192.168.12.0/24 [110/30] via 192.168.23.2, 00:17:04, Serial1/0
O E2
O
O E2 192.168.45.0/24 [110/50] via 192.168.34.4, 00:00:26, Serial1/1
O
O E2
O E2
O E2
O E2
-->可以看到R3路由表中出现了172.16.1.0到172.16.3.0网段的路由。它们的metric为50,默认为20.
R3#sh ip ospf data
Link ID
0.0.0.0
1.1.1.1
5.5.5.5
172.16.1.0
172.16.2.0
172.16.3.0
192.168.12.0
192.168.45.0
-->R3上查看OSPF数据库可以看到路由标记。
------------------------------------------------------------------------------------
需求5:
R2(config)#router ospf 1
R2(config-router)#redistribute rip subnets tag 11
-->给RIP过来的外部路由打标记11.
R2(config)#route-map ccna permit 10
R2(config-route-map)#match tag 5
R2(config)#router rip
R2(config-router)#redistribute ospf 1 metric 5 route-map ccna
R1#sh ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B -BGP
Gateway of last resort is not set
C
C
R
R
R
-->可以看到R1只学到了OSPF中打了标记5的路由条目。
---------------------------------------------------------------------------------------------
需求6:
首先看一下R5的路由表:
R5#sh ip route eigrp
D EX 192.168.12.0/24 [170/2195456] via 192.168.45.4, 00:00:22, Serial1/0
D EX
D EX
D EX
D EX
D EX 192.168.23.0/24 [170/2195456] via 192.168.45.4, 00:56:28, Serial1/0
D EX 192.168.34.0/24 [170/2195456] via 192.168.45.4, 01:00:45, Serial1/0
D*EX 0.0.0.0/0 [170/2195456] via 192.168.45.4, 00:32:06, Serial1/0
-->现在R5中有192.168.12.0/24的路由条目。下面要拒绝将它放入路由表。
R5(config)#ip prefix-list ccnp deny 192.168.12.0/24
R5(config)#ip prefix-list ccnp permit 0.0.0.0/0 le 32
R5(config)#router eigrp 100
R5(config-router)#distribute-list prefix ccnp in
R5#sh ip route ei
D EX
D EX
D EX
D EX
D EX 192.168.23.0/24 [170/2195456] via 192.168.45.4, 01:02:39, Serial1/0
D EX 192.168.34.0/24 [170/2195456] via 192.168.45.4, 01:06:56, Serial1/0
D*EX 0.0.0.0/0 [170/2195456] via 192.168.45.4, 00:38:17, Serial1/0
-->再次查看R5路由表,可以看到192.168.12.0/24这个条目已经没有了。