CCNP-OSPF认证(附实验PDF下载)

 

CCNP-OSPF 认证 :
实验目的:
      配置 OSPF 邻居间、区域、虚电路的认证。
实验拓扑:
 
 

 
IP 地址配置:
 
R1(config)#in s1/0
R1(config-if)#ip add 219.146.0.1 255.255.255.0
R1(config-if)#no sh
R1(config-if)#exi
 
R2(config)#in s1/0
R2(config-if)#ip add 219.146.0.2 255.255.255.0
R2(config-if)#no sh
R2(config-if)#in s1/1
R2(config-if)#ip add 219.146.1.1 255.255.255.0
R2(config-if)#no sh  
R2(config-if)#exi
 
R3(config)#in s1/1
R3(config-if)#ip add 219.146.1.2 255.255.255.0
R3(config-if)#no sh
R3(config-if)#in s1/0
R3(config-if)#ip add 219.146.2.1 255.255.255.0
R3(config-if)#no sh
R3(config-if)#exi
 
R4(config)#in s1/0
R4(config-if)#ip add 219.146.2.2 255.255.255.0
R4(config-if)#no sh
R4(config-if)#exi
 
首先在 R1 R2 之间配置 OSPF
 
R1(config)#in s1/0
R1(config-if)#ip os 1 a 0    // 在接口下直接启用 OSPF (12.3 后版本支持 )
R1(config-if)#exi
 
R2(config)#router os 1
R2(config-router)#net 219.146.0.2 0.0.0.0 a 0 // 这里只在一个接口下启用 OSPF
R2(config-router)#exi
 
R1(config)#do sh ip os nei
Neighbor ID     Pri   State           Dead Time   Address         Interface
219.146.1.1       0   FULL/ -        00:00:34    219.146.0.2     Serial1/0
 
已经建立了邻居关系。这里的 neighbor id 就是 router-id 。因为 R2 没有指定 router-id ,也没有 loopback 口,就使用物理接口 IP 地址最大的作为 router-id, 所以就是 219.146.1.1 了。
 
开启 debug
R1(config)#do de ip os pa
R1(config)#do de ip os ev
 
R1(config)#
*Mar 1 01:24:07.755: OSPF: rcv. v:2 t:1 l:48 rid:219.146.1.1
      aid:0.0.0.0 chk:3473 aut:0 auk: from Serial1/0
 
使用的是类型 0 (没有认证)的认证。
 
1 、配置邻居间的明文认证。
 
R1(config)#in s1/0
R1(config-if)#ip os authentication-key cisco    // 在接口下定义密钥     
R1(config-if)#ip os au // 启用明文认证。
R1(config-if)#exi
 
R1(config)#
*Mar 1 01:28:07.747: OSPF: Rcv pkt from 219.146.0.2, Serial1/0 : Mismatch Authentication type. Input packet specified type 0, we use type 1
 
因为 R2 还没有启用认证,所有看对方使用的是类型 0 (没有认证)的认证,而自己使用类型 1 (明文认证)的认证。
 
R2(config)#in s1/0
R2(config-if)#ip os authentication-key cisco
R2(config-if)#ip os au
R2(config-if)#exi
 
R1(config)#
*Mar 1 01:35:47.739: OSPF: rcv. v:2 t:1 l:48 rid:219.146.1.1
      aid:0.0.0.0 chk:3472 aut:1 auk: from Serial1/0
已经使用类型 1 (明文认证)了。
 
R2(config)#do sh ip os int s1/0
Serial1/0 is up, line protocol is up
 Internet Address 219.146.0.2/24, Area 0
 Process ID 1, Router ID 219.146.1.1, Network Type POINT_TO_POINT, Cost: 64
 Transmit Delay is 1 sec, State POINT_TO_POINT
 Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
    oob-resync timeout 40
    Hello due in 00:00:00
 Supports Link-local Signaling (LLS)
 Cisco NSF helper support enabled
 IETF NSF helper support enabled
 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 1, Adjacent neighbor count is 1
    Adjacent with neighbor 219.146.0.1
 Suppress hello for 0 neighbor(s)
 Simple password authentication enabled
从这里也能看到使用的明文认证。
 
R2(config)#do sh run int s1/0
Building configuration...
 
Current configuration : 147 bytes
!
interface Serial1/0
 ip address 219.146.0.2 255.255.255.0
 ip ospf authentication
 ip ospf authentication-key cisco
 serial restart-delay 0
end
使用明文认证可以看到密码,可以加密一下。
 
R2(config)#service password-encryption
R2(config)#do sh run int s1/0
Building configuration...
 
Current configuration : 156 bytes
!
interface Serial1/0
 ip address 219.146.0.2 255.255.255.0
 ip ospf authentication
 ip ospf authentication-key 7 045802150C2E
 serial restart-delay 0
end
 
密码已经加密显示。
 
R2(config)#in s1/0
R2(config-if)#ip os authentication null
R2(config-if)#exi
可以使用这条命令来禁用接口的认证。
 
R1(config)#
*Mar 1 01:46:37.755: OSPF: Rcv pkt from 219.146.0.2, Serial1/0 : Mismatch Authentication type. Input packet specified type 0, we use type 1
可以看到认证已经禁用。
 
R2(config)#do sh run int s1/0
Building configuration...
 
Current configuration : 161 bytes
!
interface Serial1/0
 ip address 219.146.0.2 255.255.255.0
 ip ospf authentication null
 ip ospf authentication-key 7 045802150C2E
 serial restart-delay 0
end
 
R2(config)#in s1/0
R2(config-if)#ip os au
R2(config-if)#ip os authentication-key mycisco   // 更改密码,明文认证密码会自动覆盖。所以明文认证如果更改密码会造成邻居关系重建。
R2(config-if)#exi
 
R1(config)#
*Mar 1 02:41:08.023: OSPF: Rcv pkt from 219.146.0.2, Serial1/0 : Mismatch Authentication Key - Clear Text
现在看到的是明文认证密钥不匹配。还原:
R2(config)#in s1/0
R2(config-if)#ip os authentication-k cisco
R2(config-if)#exi
 
 
2 、配置邻居间的 MD5 认证:
 
R2(config)#in s1/1
R2(config-if)#ip os 1 a 1    // 启用 OSPF
R2(config-if)#ip os message-digest-key 1 md5 mycisco // 定义 key-id 和密码。
R2(config-if)#ip os authentication message-digest         // 启用 MD5 认证。
R2(config-if)#exi
 
R2 上开启 debug
R2(config)#do de ip os pa
OSPF packet debugging is on
R2(config)#do de ip os ev
OSPF events debugging is on
R2(config)#do de ip os adj
OSPF adjacency events debugging is on
 
 
R3(config)#in s1/1
R3(config-if)#ip os 1 a 1    // 启用 OSPF
R3(config-if)#ip os message-digest-key 2 md5 mycisco
R3(config-if)#ip os au m
R3(config-if)#exi
 
R2(config)#
*Mar 1 03:04:37.027: OSPF: Send with youngest Key 1
*Mar 1 03:04:37.791: OSPF: Rcv pkt from 219.146.1.2, Serial1/1 : Mismatch Authentication Key - No message digest key 2 on interface
 
可以看出自己使用的是 key1, 而对方使用的是 key2 。所以不能建立邻居关系。
 
解决的办法有两个:
1.   R2 上配一个 key2
2.   R3 上配一个 key1.
 
R2(config)#in s1/1
R2(config-if)#ip os message-digest-key 2 md5 mycisco
R2(config-if)#exi
 
R2(config)#
*Mar 1 03:10:17.027: OSPF: Send with youngest Key 2
*Mar 1 03:10:17.775: OSPF: rcv. v:2 t:1 l:48 rid:219.146.2.1
      aid:0.0.0.1 chk:0 aut:2 keyid:2 seq:0x3C7EF108 from Serial1/1
 
看到现在使用 key2 来认证,从 aut2 可以知道是类型 2 MD5 认证)的认证。这样,使用 MD5 认证除了安全外还可以做密码的迁移而不影响通信。这是明文认证所做不到的。
 
 
3 、配置区域内的明文认证:
 
R3(config-if)#in s1/0
R3(config-if)#ip os authentication-key ccnp     // 定义密码。
R3(config-if)#exi
R3(config)#router os 1
R3(config-router)#net 219.146.2.1 0.0.0.0 a 2
R3(config-router)#area 2 authentication          // 启用区域认证。
R3(config-router)#exi
 
R4(config)#in s1/0
R4(config-if)#ip os authentication-key ccnp
R4(config-if)#exi
R4(config)#router os 1
R4(config-router)#net 219.146.2.2 0.0.0.0 a 2
R4(config-router)#area 2 au
R4(config-router)#exi
 
 
4 、配置区域内的 MD5 认证:
 
R3(config)#in s1/0
R3(config-if)#no ip os authentication-k ccnp         // 去掉刚才配的明文密码。
R3(config-if)#ip os message-digest-key 1 md5 ccnp // 配置 MD5 key-id 和密码。
R3(config-if)#exi
R3(config)#router os 1
R3(config-router)#no area 2 au
R3(config-router)#area 2 au me // 启用区域 MD5 认证。
R3(config-router)#exi
 
R4(config)#in s1/0
R4(config-if)#no ip os authentication-key ccnp
R4(config-if)#ip os message-digest-key 1 md5 ccnp
R4(config-if)#exi
R4(config)#router os 1
R4(config-router)#no area 2 au
R4(config-router)#area 2 authentication message-digest
R4(config-router)#exi
 
R4(config)#do sh ip os
 Routing Process "ospf 1" with ID 219.146.2.2
 Start time: 04:16:37.204, Time elapsed: 00:09:03.708
 Supports only single TOS(TOS0) routes
 Supports opaque LSA
 Supports Link-local Signaling (LLS)
 Supports area transit capability
 Router is not originating router-LSAs with maximum metric
 Initial SPF schedule delay 5000 msecs
 Minimum hold time between two consecutive SPFs 10000 msecs
 Maximum wait time between two consecutive SPFs 10000 msecs
 Incremental-SPF disabled
 Minimum LSA interval 5 secs
 Minimum LSA arrival 1000 msecs
 LSA group pacing timer 240 secs
 Interface flood pacing timer 33 msecs
 Retransmission pacing timer 66 msecs
 Number of external LSA 0. Checksum Sum 0x000000
 Number of opaque AS LSA 0. Checksum Sum 0x000000
 Number of DCbitless external and opaque AS LSA 0
 Number of DoNotAge external and opaque AS LSA 0
 Number of areas in this router is 1. 1 normal 0 stub 0 nssa
 Number of areas transit capable is 0
 External flood list length 0
 IETF NSF helper support enabled
 Cisco NSF helper support enabled
    Area 2
        Number of interfaces in this area is 1
        Area has message digest authentication
        SPF algorithm last executed 00:00:48.856 ago
        SPF algorithm executed 4 times
        Area ranges are
        Number of LSA 2. Checksum Sum 0x01A72A
        Number of opaque link LSA 0. Checksum Sum 0x000000
        Number of DCbitless LSA 0
        Number of indication LSA 0
        Number of DoNotAge LSA 0
        Flood list length 0
 
区域使用的是 MD5 认证。
 
5 、配置虚电路的明文认证:
 
R4(config)#do sh ip rou
Codes: C - connected, S - static, 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
       i - IS-IS, su - IS-IS summary, 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
 
C    219.146.2.0/24 is directly connected, Serial1/0
发现 R4 上没有学到区域外的路由,这是因为 R4 没有和区域 0 相连,这个拓扑是错误的,是不推荐的。这种情况就只在配置虚电路来使网络正常。
 
R2(config)#router os 1
R2(config-router)#area 1 virtual-link 219.146.2.1 authentication-key ccnp     // 区域 id 是虚电路穿过的 id 219.146.2.1 是对端路由器的 router-id 。后面是明文认证。
R2(config-router)#area 1 virtual-link 219.146.2.1 authentication          // 启用虚电路认证。
R2(config-router)#exi
 
 
R3(config)#router os 1
R3(config-router)#area 1 virtual-link 219.146.1.1 authentication-key ccnp
R3(config-router)#area 1 virtual-link 219.146.1.1 authentication
R3(config-router)#exi
 
R4(config)#do sh ip rou
Codes: C - connected, S - static, 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
       i - IS-IS, su - IS-IS summary, 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
 
C    219.146.2.0/24 is directly connected, Serial1/0
O IA 219.146.0.0/24 [110/192] via 219.146.2.1, 00:00:31, Serial1/0
O IA 219.146.1.0/24 [110/128] via 219.146.2.1, 00:04:01, Serial1/0
 
已经学到了路由。
6 、配置虚电路的 MD5 认证:
 
R2(config)#router os 1
R2(config-router)#no area 1 vir 219.146.2.1
R2(config-router)#no area 1 vir 219.146.2.1 authentication
R2(config-router)#area 1 vir 219.146.2.1 message-digest-key 1 md5 ccnp
R2(config-router)#area 1 vir 219.146.2.1 authentication message-digest
R2(config-router)#exi
 
         
R3(config)#router os 1
R3(config-router)#no ip os vir 219.146.1.1
R3(config-router)#no area 1 vir 219.146.1.1 au
R3(config-router)#area 1 vir 219.146.1.1 message-digest-key 1 md5 ccnp
R3(config-router)#area 1 vir 219.146.1.1 authentication message-digest
R3(config-router)#exi
 
R3(config)#do sh ip os vir
Virtual Link OSPF_VL1 to router 219.146.1.1 is up
 Run as demand circuit
 DoNotAge LSA allowed.
 Transit area 1, via interface Serial1/1, Cost of using 64
 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:03
    Adjacency State FULL (Hello suppressed)
    Index 1/3, retransmission queue length 0, number of retransmission 0
    First 0x0(0)/0x0(0) Next 0x0(0)/0x0(0)
    Last retransmission scan length is 0, maximum is 0
    Last retransmission scan time is 0 msec, maximum is 0 msec
 Message digest authentication enabled
    Youngest key id is 1
 
虚电路的 MD5 认证开启。
 
 
 
 
7 、总结:
 
      1. 邻居间的认证:
           配置密码(接口下进行)
           开启认证(接口下进行)
 
2. 区域间的认证:
配置密码(接口下进行)
开启认证(路由模式下进行)
 
3. 虚电路的认证:
配置密码(配置虚电路时一起配置)
开启认证(配置虚电路时一起开启)
 

你可能感兴趣的:(职场,认证,休闲,ccnp,ospf)