OSPF虚链路配置:中转区域

OSPF采用由两层组成的分层结构,这要求所有的区域都与主干区域(区域0)直接相连。但是,当某个OSPF区域与OSPF主干区域(区域0)之间没有直接连接时,便会导致LSDB不一致以及该区域中的网络无法到达区域0。采用虚链路在该区域与主干区域之间建立起逻辑的连接,便可解决LSDB不一致以及该区域中的网络无法到达区域0的问题。
 
一、网络拓扑
 
 
二、具体配置
 
1、基本配置:
 
RA:
Router(config)#hostname RA
RA(config)#interface Loopback0
RA(config-if)#ip address 1.1.1.1 255.255.255.0
RA(config-if)#ip ospf network point-to-point
RA(config-if)#exit
RA(config)#interface Serial1/0
RA(config-if)#ip address 10.10.10.1 255.255.255.0
RA(config-if)#no shutdown
RA(config-if)#exit
RA(config)#router ospf 10
RA(config-router)#router-id 1.1.1.1
RA(config-router)#network 1.1.1.0 0.0.0.255 area 0
RA(config-router)#network 10.10.10.0 0.0.0.255 area 0
RA(config-router)#exit
 
RB:
Router(config)#hostname RB
RB(config)#interface Loopback0
RB(config-if)#ip address 2.2.2.2 255.255.255.0
RB(config-if)#ip ospf network point-to-point
RB(config-if)#exit
RB(config)#interface Serial1/0
RB(config-if)#ip address 10.10.10.2 255.255.255.0
RB(config-if)#no shutdown
RB(config-if)#exit
RB(config)#interface Serial1/1
RB(config-if)#ip address 10.10.20.1 255.255.255.0
RB(config-if)#no shutdown
RB(config-if)#exit
RB(config)#router ospf 20
RB(config-router)#router-id 2.2.2.2
RB(config-router)#network 2.2.2.0 0.0.0.255 area 1
RB(config-router)#network 10.10.20.0 0.0.0.255 area 1
RB(config-router)#network 10.10.10.0 0.0.0.255 area 0
RB(config-router)#exit
 
RC:
Router(config)#hostname RC
RC(config)#interface Loopback0
RC(config-if)#ip address 3.3.3.3 255.255.255.0
RC(config-if)#ip ospf network point-to-point
RC(config-if)#exit
RC(config)#interface Serial1/1
RC(config-if)#ip address 10.10.20.2 255.255.255.0
RC(config-if)#no shutdown
RC(config-if)#exit
RC(config)#router ospf 30
RC(config-router)#router-id 3.3.3.3
RC(config-router)#network 3.3.3.0 0.0.0.255 area 2
RC(config-router)#network 10.10.20.0 0.0.0.255 area 1
RC(config-router)#exit
 
2、查看RA的路由表:
 
RA#show 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, 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/24 is subnetted, 1 subnets
C       1.1.1.0 is directly connected, Loopback0
     2.0.0.0/24 is subnetted, 1 subnets
O IA    2.2.2.0 [110/65] via 10.10.10.2, 00:00:07, Serial1/0
     10.0.0.0/24 is subnetted, 2 subnets
C       10.10.10.0 is directly connected, Serial1/0
O IA    10.10.20.0 [110/128] via 10.10.10.2, 00:00:07, Serial1/0
 
可见,RA路由表中没有通往网络3.0.0.0/24的路由。因为网络3.0.0.0/24所在的区域没有和主干区域直接连接,需要采用虚链路在area 0 和 area 3 之间建立一条逻辑链路。
 
3、在区域边界路由器RB和RC上配置虚链路:
 
RB(config)#router ospf 20
RB(config-router)#area 1 virtual-link 3.3.3.3
RB(config-router)#exit
 
RC(config)#router ospf 30
RC(config-router)#area 1 virtual-link 2.2.2.2
RC(config-router)#exit
 
三、验证配置
 
1、查看RA的OSPF路由表:
 
RA#show ip route ospf
     2.0.0.0/24 is subnetted, 1 subnets
O IA    2.2.2.0 [110/65] via 10.10.10.2, 00:03:18, Serial1/0
     3.0.0.0/24 is subnetted, 1 subnets
O IA    3.3.3.0 [110/129] via 10.10.10.2, 00:03:18, Serial1/0
     10.0.0.0/24 is subnetted, 2 subnets
O IA    10.10.20.0 [110/128] via 10.10.10.2, 00:03:18, Serial1/0
 
可见,RA已经学习到通往RC环回接口的路由。
 
2、查看虚链路的运行状况:
 
RB#show ip ospf virtual-link
Virtual Link OSPF_VL0 to router 3.3.3.3 is up  ----通往router 3.3.3.3的虚链路已开通。
  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:01
    Adjacency State FULL (Hello suppressed)
    Index 2/3, retransmission queue length 0, number of retransmission 1
    First 0x0(0)/0x0(0) Next 0x0(0)/0x0(0)
    Last retransmission scan length is 1, maximum is 1
    Last retransmission scan time is 0 msec, maximum is 0 msec

RC#show ip ospf virtual-link
Virtual Link OSPF_VL1 to router 2.2.2.2 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:09
    Adjacency State FULL (Hello suppressed)
    Index 1/2, 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
 
3、查看OSPF数据库:
 
RA#show ip ospf database
            OSPF Router with ID (1.1.1.1) (Process ID 10)
                Router Link States (Area 0)
Link ID         ADV Router      Age         Seq#       Checksum Link count
1.1.1.1         1.1.1.1         684         0x80000009 0x00EA50 3
2.2.2.2         2.2.2.2         1110        0x80000006 0x00398C 3
3.3.3.3         3.3.3.3         2     (DNA) 0x80000001 0x00E6BF 1
                Summary Net Link States (Area 0)
Link ID         ADV Router      Age         Seq#       Checksum
2.2.2.0         2.2.2.2         546         0x80000002 0x000D20
2.2.2.0         3.3.3.3         2     (DNA) 0x80000001 0x007376
3.3.3.0         3.3.3.3         2     (DNA) 0x80000001 0x00CC5A
10.10.20.0      2.2.2.2         1047        0x80000003 0x00F3D6
10.10.20.0      3.3.3.3         2     (DNA) 0x80000001 0x00D9EE
 
RB#show ip ospf database
            OSPF Router with ID (2.2.2.2) (Process ID 20)
                Router Link States (Area 0)
Link ID         ADV Router      Age         Seq#       Checksum Link count
1.1.1.1         1.1.1.1         161         0x80000009 0x00EA50 3
2.2.2.2         2.2.2.2         585         0x80000006 0x00398C 3
3.3.3.3         3.3.3.3         1     (DNA) 0x80000001 0x00E6BF 1
                Summary Net Link States (Area 0)
Link ID         ADV Router      Age         Seq#       Checksum
2.2.2.0         2.2.2.2         20          0x80000002 0x000D20
2.2.2.0         3.3.3.3         1     (DNA) 0x80000001 0x007376
3.3.3.0         3.3.3.3         1     (DNA) 0x80000001 0x00CC5A
10.10.20.0      2.2.2.2         522         0x80000003 0x00F3D6
10.10.20.0      3.3.3.3         1     (DNA) 0x80000001 0x00D9EE
                Router Link States (Area 1)
Link ID         ADV Router      Age         Seq#       Checksum Link count
2.2.2.2         2.2.2.2         20          0x80000009 0x0052C4 3
3.3.3.3         3.3.3.3         429         0x80000008 0x00CF5A 2
                Summary Net Link States (Area 1)
Link ID         ADV Router      Age         Seq#       Checksum
1.1.1.0         2.2.2.2         25          0x80000002 0x00B33C
1.1.1.0         3.3.3.3         583         0x80000001 0x001A92
3.3.3.0         3.3.3.3         593         0x80000001 0x00CC5A
10.10.10.0      2.2.2.2         1284        0x80000003 0x006272
10.10.10.0      3.3.3.3         583         0x80000001 0x00CAC7
 
RC#show ip ospf database
            OSPF Router with ID (3.3.3.3) (Process ID 30)
                Router Link States (Area 0)
Link ID         ADV Router      Age         Seq#       Checksum Link count
1.1.1.1         1.1.1.1         1423  (DNA) 0x80000008 0x00EC4F 3
2.2.2.2         2.2.2.2         5     (DNA) 0x80000006 0x00398C 3
3.3.3.3         3.3.3.3         1183        0x80000001 0x00E6BF 1
                Summary Net Link States (Area 0)
Link ID         ADV Router      Age         Seq#       Checksum
2.2.2.0         2.2.2.2         1294  (DNA) 0x80000001 0x000F1F
2.2.2.0         3.3.3.3         1183        0x80000001 0x007376
3.3.3.0         3.3.3.3         1183        0x80000001 0x00CC5A
10.10.20.0      2.2.2.2         1967  (DNA) 0x80000002 0x00F5D5
10.10.20.0      3.3.3.3         1183        0x80000001 0x00D9EE
                Router Link States (Area 1)
Link ID         ADV Router      Age         Seq#       Checksum Link count
2.2.2.2         2.2.2.2         619         0x80000009 0x0052C4 3
3.3.3.3         3.3.3.3         1025        0x80000008 0x00CF5A 2
                Summary Net Link States (Area 1)
Link ID         ADV Router      Age         Seq#       Checksum
1.1.1.0         2.2.2.2         620         0x80000002 0x00B33C
1.1.1.0         3.3.3.3         1175        0x80000001 0x001A92
3.3.3.0         3.3.3.3         1186        0x80000001 0x00CC5A
10.10.10.0      2.2.2.2         1879        0x80000003 0x006272
10.10.10.0      3.3.3.3         1176        0x80000001 0x00CAC7
                Router Link States (Area 2)
Link ID         ADV Router      Age         Seq#       Checksum Link count
3.3.3.3         3.3.3.3         1186        0x80000005 0x0059B2 1
                Summary Net Link States (Area 2)
Link ID         ADV Router      Age         Seq#       Checksum
1.1.1.0         3.3.3.3         1177        0x80000001 0x001A92
2.2.2.0         3.3.3.3         1188        0x80000001 0x007376
10.10.10.0      3.3.3.3         1178        0x80000001 0x00CAC7
10.10.20.0      3.3.3.3         1188        0x80000001 0x00D9EE
 
数据库中的DNA即是DoNotAge。
Link ID :标志LSA。
ADV Router :通告LSA的路由器。
Age :最长寿命计数器,单位为秒。最长寿命为1小时(3600秒)。
Seq# :LSA的序列号。初始值为0x80000001,每当LSA被更新时都加1.
Checksum :LSA的校验和,确保LSA被可靠地接收。
Link Count :直接连接的链路总数,只用于路由器LSA中,链路计数包括所有的点到点链路、中转链路和末节链路。除点到点串行链路导致计数增加2外,其他所有串行都导致计数增加1,每条以太网链路也导致计数增加1.
 
4、查看RB和RC到主干区域的逻辑连接状况:
 
RB#show ip ospf database router 3.3.3.3
            OSPF Router with ID (2.2.2.2) (Process ID 20)
                Router Link States (Area 0)
  Adv Router is not-reachable
  LS age: 1 (DoNotAge)
  Options: (No TOS-capability, DC)
  LS Type: Router Links
  Link State ID: 3.3.3.3
  Advertising Router: 3.3.3.3
  LS Seq Number: 80000001
  Checksum: 0xE6BF
  Length: 36
  Area Border Router
  Number of Links: 1
    Link connected to: a Virtual Link  ----虚链路
     (Link ID) Neighboring Router ID: 2.2.2.2
     (Link Data) Router Interface address: 10.10.20.2
      Number of TOS metrics: 0
       TOS 0 Metrics: 64

RC#show ip ospf database router 2.2.2.2
            OSPF Router with ID (3.3.3.3) (Process ID 30)
                Router Link States (Area 0)
  Routing Bit Set on this LSA
  LS age: 5 (DoNotAge)
  Options: (No TOS-capability, DC)
  LS Type: Router Links
  Link State ID: 2.2.2.2
  Advertising Router: 2.2.2.2
  LS Seq Number: 80000006
  Checksum: 0x398C
  Length: 60
  Area Border Router
  Number of Links: 3
    Link connected to: a Virtual Link  ----虚链路
     (Link ID) Neighboring Router ID: 3.3.3.3
     (Link Data) Router Interface address: 10.10.20.1
      Number of TOS metrics: 0
       TOS 0 Metrics: 64

 
本文出自 “ Uione” 博客,请务必保留此出处 http://weiqijun.blog.51cto.com/338163/76293
本文出自 51CTO.COM技术博客

你可能感兴趣的:(网络,职场,休闲)