一、拓扑

clip_p_w_picpath002

二、配置

1. 按照上图所示配置IP地址以及通告网络

邻居都可以正常建立,但在R2上看路由

R2#show ip route

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

1.0.0.0/32 is subnetted, 1 subnets

O 1.1.1.1 [110/65] via 12.1.1.1, 00:03:47, Serial0/0

23.0.0.0/24 is subnetted, 1 subnets

C 23.1.1.0 is directly connected, Serial0/1

12.0.0.0/24 is subnetted, 1 subnets

C 12.1.1.0 is directly connected, Serial0/0

在区域1 上的路由器上看,其路由表没有未直接连接的区域0一边的路由

2. 在不连续的区域0穿越的区域之间的ABR上配置虚链路。

R2 的路由进程里面配置Area 1 vitrual-link 3.3.3.3

R3的路由进程里面配置Area 1 vitrual-link 2.2.2.2

R2#show ip ospf interface

OSPF_VL0 is up, line protocol is up

Internet Address 23.1.1.2/24, Area 0

Process ID 110, Router ID 2.2.2.2, Network Type VIRTUAL_LINK, Cost: 64

Configured as demand circuit.

Run as demand circuit.

DoNotAge LSA allowed.

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:08

Supports Link-local Signaling (LLS)

Index 2/3, 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 3.3.3.3 (Hello suppressed)

Suppress hello for 1 neighbor(s)

未配置虚链路之前的LSDB摘要

R2#show ip ospf database

OSPF Router with ID (2.2.2.2) (Process ID 110)

Router Link States (Area 0)

Link ID ADV Router Age Seq# Checksum Link count

1.1.1.1 1.1.1.1 1395 0x80000003 0x00342C 3

2.2.2.2 2.2.2.2 1394 0x80000002 0x0098D7 2

Summary Net Link States (Area 0)

Link ID ADV Router Age Seq# Checksum

23.1.1.0 2.2.2.2 1394 0x80000001 0x008C4F

Router Link States (Area 1)

Link ID ADV Router Age Seq# Checksum Link count

2.2.2.2 2.2.2.2 1379 0x80000002 0x00282A 2

3.3.3.3 3.3.3.3 1375 0x80000002 0x00C785 2

Summary Net Link States (Area 1)

Link ID ADV Router Age Seq# Checksum

1.1.1.1 2.2.2.2 1384 0x80000001 0x00AB44

4.4.4.4 3.3.3.3 1343 0x80000001 0x0003DC

12.1.1.0 2.2.2.2 1400 0x80000001 0x001CCA

34.1.1.0 3.3.3.3 1373 0x80000001 0x00DEED

配置之后

R2#show ip ospf database

OSPF Router with ID (2.2.2.2) (Process ID 110)

Router Link States (Area 0)

Link ID ADV Router Age Seq# Checksum Link count

1.1.1.1 1.1.1.1 1712 0x80000003 0x00342C 3

2.2.2.2 2.2.2.2 193 0x80000003 0x00DE18 3

3.3.3.3 3.3.3.3 5 (DNA) 0x80000003 0x003880 3

4.4.4.4 4.4.4.4 1476 (DNA) 0x80000002 0x0034D5 3

Summary Net Link States (Area 0)

Link ID ADV Router Age Seq# Checksum

23.1.1.0 2.2.2.2 1711 0x80000001 0x008C4F

23.1.1.0 3.3.3.3 1501 (DNA) 0x80000001 0x006E69

Router Link States (Area 1)

Link ID ADV Router Age Seq# Checksum Link count

2.2.2.2 2.2.2.2 193 0x80000003 0x00321B 2

3.3.3.3 3.3.3.3 194 0x80000003 0x00D176 2

Summary Net Link States (Area 1)

Link ID ADV Router Age Seq# Checksum

1.1.1.1 2.2.2.2 1701 0x80000001 0x00AB44

4.4.4.4 3.3.3.3 1660 0x80000001 0x0003DC

12.1.1.0 2.2.2.2 1717 0x80000001 0x001CCA

34.1.1.0 3.3.3.3 1690 0x80000001 0x00DEED

配置虚链路以后,看R2的路由表

R2#show ip route

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

34.0.0.0/24 is subnetted, 1 subnets

O 34.1.1.0 [110/128] via 23.1.1.3, 00:08:54, Serial0/1

1.0.0.0/32 is subnetted, 1 subnets

O 1.1.1.1 [110/65] via 12.1.1.1, 00:08:54, Serial0/0

4.0.0.0/32 is subnetted, 1 subnets

O 4.4.4.4 [110/129] via 23.1.1.3, 00:08:54, Serial0/1

23.0.0.0/24 is subnetted, 1 subnets

C 23.1.1.0 is directly connected, Serial0/1

12.0.0.0/24 is subnetted, 1 subnets

C 12.1.1.0 is directly connected, Serial0/

配置虚链路以后,路由能够传递过来了,因为在区域0的LSA里有4.4.4.4这条了

配置要点:

配置虚链路时,在要被穿越的某个区域的ABR上配置,配置时指定对方的Router-id

虚链路的认证

虚链路已经起来,再在R2上配置虚链路的认证

router-id 2.2.2.2

log-adjacency-changes

area 1 virtual-link 3.3.3.3 authentication authentication-key 123

network 12.1.1.0 0.0.0.255 area 0

network 23.1.1.0 0.0.0.255 area 1

经过实验发现,在默认配置下,当虚链路已经起来,再配置认证的话,即使双方的配置不同,也不会影响虚链路。

在R2上开启debug ip ospf adj,再在R3上清除OSPF进程,看R2的输出:

*Mar 1 00:56:10.839: OSPF: Rcv pkt from 23.1.1.3, OSPF_VL0 : Mismatch Authentication type. Input packet specified type 0, we use type 1

密码配置错误时的输出

R2#

*Mar 1 01:01:50.835: OSPF: Rcv pkt from 23.1.1.3, OSPF_VL0 : Mismatch Authentication Key - Clear Text

把两边的密码配置成一样为123时

*Mar 1 01:03:02.291: %OSPF-5-ADJCHG: Process 110, Nbr 3.3.3.3 on OSPF_VL0 from LOADING to FULL, Loading Done