网络通信 频道

OSPF连载3:配置OSPFv3

 

OSPFv3配置示例
提示:下面的实验环境使用的IOS版本是12.3(20), 高级企业特性集。
图 4-4 配置示例拓扑
配置示例中使用的拓扑如图4-4所示。路由器R1和R2通过点到点链路把两个局域网连接起来。两个串行接口运行在区域0中。R1的以太接口和环回接口运行在区域3中,R2的以太接口和环回接口运行在区域2中。下面分别配置R1和R2。
(1)配置路由器R1。
Router1#config t
Router1(config)#ipv6 unicast-routing
router1(config)#ipv6 router ospf 1
router1(config-rtr)#router-id 1.1.1.1
router1(config-rtr)#exit
router1(config)#interface f0/0
router1(config-if)#ipv6 address 2006:1010:0:1::/64 eui-64
router1(config-if)# ipv6 ospf 1 area 3
router1(config-if)#interface s0/0
router1(config-if)# ipv6 ospf 1 area 0
router1(config-if)#exit
router1(config)#interface loopback 1
router1(config-if)#ipv6 address 2006:1010:0:2::/64 eui-64
router1(config-if)#ipv6 ospf 1 area 3
router1(config-if)#interface loopback 2
router1(config-if)#ipv6 add 2006:1010:0:3::/64 eui-64
router1(config-if)#ipv6 ospf 1 area 3
router1(config-if)#exit
router1(config)#
配置完成后的配置列表如下所示(仅列出相关内容):
hostname router1
!
ipv6 unicast-routing
!
interface Loopback1
 no ip address
 ipv6 address 2006:1010:0:2::/64 eui-64
 ipv6 ospf 1 area 3
!
interface Loopback2
 no ip address
 ipv6 address 2006:1010:0:3::/64 eui-64
 ipv6 ospf 1 area 3
!
interface FastEthernet0/0
 no ip address
 duplex auto
 speed auto
 ipv6 address 2006:1010:0:1::/64 eui-64
 ipv6 enable
 ipv6 ospf 1 area 3
!
interface Serial0/0
 no ip address
 ipv6 enable
 ipv6 ospf 1 area 0
 no fair-queue
!
ipv6 router ospf 1
 router-id 1.1.1.1
 log-adjacency-changes
(2)配置路由器R2。
Router2#config t
Router2(config)#ipv6 unicast-routing
Router2(config)#ipv6 router ospf 1
Router2(config-rtr)#router-id 2.2.2.2
Router2(config-rtr)#exit
Router2(config)#interface f0/0
Router2(config-if)#ipv6 address 2006:1010:0:5::/64 eui-64
Router2(config-if)# ipv6 ospf 1 area 2
Router2(config-if)#interface s0/0
Router2(config-if)# ipv6 ospf 1 area 0
Router2(config-if)#exit
Router2(config)#interface loopback 1
Router2(config-if)#ipv6 address 2006:1010:0:6::/64 eui-64
Router2(config-if)#ipv6 ospf 1 area 2
Router2(config-if)#interface loopback 2
Router2(config-if)#ipv6 add 2006:1010:0:7::/64 eui-64
Router2(config-if)#ipv6 ospf 1 area 2
Router2(config-if)#exit
Router2(config)#
配置完成后的配置列表如下所示(仅列出相关内容):
hostname router2
!
ipv6 unicast-routing
!
interface Loopback1
 no ip address
 ipv6 address 2006:1010:0:6::/64 eui-64
 ipv6 ospf 1 area 2
!
interface Loopback2
 no ip address
 ipv6 address 2006:1010:0:7::/64 eui-64
 ipv6 ospf 1 area 2
!
interface FastEthernet0/0
 no ip address
 duplex auto
 speed auto
 ipv6 address 2006:1010:0:5::/64 eui-64
 ipv6 ospf 1 area 2
!
interface Serial0/0
 no ip address
 ipv6 enable
 ipv6 ospf 1 area 0
!
ipv6 router ospf 1
 router-id 2.2.2.2
5.2 检查OSPFv3的运行状态
1. show ipv6 ospf
router2#sh ipv6 ospf
 Routing Process "ospfv3 1" with ID 2.2.2.2
 It is an area border router
 SPF schedule delay 5 secs, Hold time between two SPFs 10 secs
 Minimum LSA interval 5 secs. Minimum LSA arrival 1 secs
 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 areas in this router is 2. 2 normal 0 stub 0 nssa
    Area BACKBONE(0)
        Number of interfaces in this area is 1
        SPF algorithm executed 7 times
        Number of LSA 8. Checksum Sum 0x04C5E5
        Number of DCbitless LSA 0
        Number of indication LSA 0
        Number of DoNotAge LSA 0
        Flood list length 0
    Area 2
        Number of interfaces in this area is 1
        SPF algorithm executed 3 times
        Number of LSA 6. Checksum Sum 0x013219
        Number of DCbitless LSA 0
        Number of indication LSA 0
        Number of DoNotAge LSA 0
        Flood list length 0
该命令显示了路由器R2上OSPFv3的基本运行情况。
该路由器上运行的OSPFv3的进程号为1;路由器ID号是2.2.2.2;该路由器是一台区域边界路由器。该路由器上有两个区域,并且都是标准区域(normal area)。
在骨干(backbone)区域内有一个接口;该区域中的SPF算法已经执行了7次;区域0中的LSA共有8个。
在区域2中有一个接口;该区域中的SPF算法已经执行了3次;该区域中的LSA共有6个。
2. show ipv6 ospf neighbor
router1#sh ipv6 ospf neighbor
 
Neighbor ID     Pri   State           Dead Time   Interface ID       Interface
2.2.2.2          1   FULL/ -        00:00:34    5               Serial0/0
router1#
该命令显示了路由器R1的邻居情况。其中,interface ID一列显示的是邻居路由器与路由器R1相连接口的ID号。
3. show ipv6 ospf neighbor detail
router1#sh ipv6 ospf neighbor detail
 Neighbor 2.2.2.2
    In the area 0 via interface Serial0/0
    Neighbor: interface-id 5, link-local address FE80::20C:31FF:FEE9:860
    Neighbor priority is 1, State is FULL, 6 state changes
    Options is 0x831C1F25
    Dead timer due in 00:00:32
    Neighbor is up for 00:13:28
    Index 1/1/1, retransmission queue length 0, number of retransmission 1
    First 0x0(0)/0x0(0)/0x0(0) Next 0x0(0)/0x0(0)/0x0(0)
    Last retransmission scan length is 2, maximum is 2
    Last retransmission scan time is 0 msec, maximum is 0 msec
该命令报告了邻居的详细信息。路由器R1在区域0中的s0/0接口上建立了一个邻居关系,邻居的ID为2.2.2.2;邻居的接口ID为5,该接口的本链路地址为FE80::20C:31FF:FEE9:860邻居的优先级为1,处于数据库同步状态(full),曾经有过6次状态改变。
4. show ipv6 ospf interface
router2#sh ipv6 ospf int s0/0
          Serial0/0 is up, line protocol is up
          Link Local Address FE80::20C:31FF:FEE9:860, Interface ID 5
          Area 0, Process ID 1, Instance ID 0, Router ID 2.2.2.2
          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
    Hello due in 00:00:06
 Index 1/1/1, flood queue length 0
 Next 0x0(0)/0x0(0)/0x0(0)
 Last flood scan length is 2, maximum is 2
 Last flood scan time is 0 msec, maximum is 0 msec
          Neighbor Count is 1, Adjacent neighbor count is 1
          Adjacent with neighbor 1.1.1.1
 Suppress hello for 0 neighbor(s)
第一行报告了接口是否处于up状态;
第二行报告了接口的本链路地址和接口ID;
第三行报告了接口运行在的区域号、进程号、实例号及路由器ID号;
第四行报告了接口运行在点到点网络类型上;
第五行报告了在该接口上物理邻居数量和相邻关系数量;
第六行报告了与邻居1.1.1.1建立了相邻关系。
5. show ipv6 ospf database
下面显示的是在路由器R2的两个环回接口还没有运行在OSPF进程中时,路由器R1上的链路状态数据库。
router1#sh ipv6 ospf database
 
            OSPFv3 Router with ID (1.1.1.1) (Process ID 1)
 
                Router Link States (Area 0)
 
ADV Router     Age         Seq#        Fragment ID Link count   Bits
1.1.1.1         880         0x80000002  0            1           B
2.2.2.2         885         0x80000005  0            1           B
 
                Inter Area Prefix Link States (Area 0)
 
ADV Router     Age         Seq#        Prefix
1.1.1.1         875         0x80000001 2006:1010:0:1::/64
1.1.1.1         253         0x80000001 2006:1010:0:2:20E:38FF:FEEE:39A0/128
1.1.1.1         229         0x80000001 2006:1010:0:3:20E:38FF:FEEE:39A0/128
2.2.2.2         1699        0x80000001 2006:1010:0:5::/64
 
                Link (Type-8) Link States (Area 0)
 
ADV Router     Age         Seq#        Link ID    Interface
1.1.1.1         880         0x80000002  5          Se0/0
2.2.2.2         1754        0x80000001  5          Se0/0
 
                Router Link States (Area 3)
 
ADV Router     Age         Seq#        Fragment ID Link count Bits
1.1.1.1         233         0x80000004  0            0         B
 
                Inter Area Prefix Link States (Area 3)
 
ADV Router     Age         Seq#        Prefix
1.1.1.1         877         0x80000001 2006:1010:0:5::/64
 
                Link (Type-8) Link States (Area 3)
 
ADV Router     Age         Seq#        Link ID    Interface
1.1.1.1         887         0x80000001  4          Fa0/0
 
                Intra Area Prefix Link States (Area 3)
 
ADV Router     Age         Seq#        Link ID    Ref-lstype Ref-LSID
1.1.1.1         235         0x80000003  0          0x2001      0
router1#
其中:
l           “ADV Router” 一列表示通告LSA的路由器ID;
l           “Age” 一列表示LSA在数据库中存留的时间;
l           “Seq#” 一列表示LSA的序列码;
l           “Fragment ID” 一列表示LSA的分段编号(如果LSA过大会分段传送);
l           “Link count” 一列表示路由器在该区域内的链路数量;
l           “Bits” 一列的值为“B”,表示是一台区域边界路由器。
l           “Prefix” 一列表示LSA携带的地址前缀;
l           “Link ID” 一列表示接口的ID号;
l           “interface” 一列表示路由器在哪些接口上产生的类型8 LSA;
l           “Ref-lstype” 一列表示参考的是哪种类型的LSA;
l           “Ref-LSID” 一列表示参考的链路 ID号。
提示:相邻关系没有达到full状态或者处于down状态的接口,以及环回接口不被描述,因此,路由器R1在区域3中的接口数量为0。
6. show ipv6 ospf database router
router1#sh ipv6 ospf database router
 
            OSPFv3 Router with ID (1.1.1.1) (Process ID 1)
 
                Router Link States (Area 0)
 
1.            LS age: 911
2.            Options: (V6-Bit E-Bit R-bit DC-Bit)
3.            LS Type: Router Links
4.            Link State ID: 0
5.            Advertising Router: 1.1.1.1
6.            LS Seq Number: 80000002
7.            Checksum: 0xC0E7
8.            Length: 40
9.            Area Border Router
10.         Number of Links: 1
 
11.         Link connected to: another Router (point-to-point)
12.         Link Metric: 64
13.         Local Interface ID: 5
14.         Neighbor Interface ID: 5
15.         Neighbor Router ID: 2.2.2.2
 
 
 Routing Bit Set on this LSA
 LS age: 917
 Options: (V6-Bit E-Bit R-bit DC-Bit)
 LS Type: Router Links
 Link State ID: 0
 Advertising Router: 2.2.2.2
 LS Seq Number: 80000005
 Checksum: 0x4A5B
 Length: 40
 Area Border Router
 Number of Links: 1
 
    Link connected to: another Router (point-to-point)
      Link Metric: 64
      Local Interface ID: 5
      Neighbor Interface ID: 5
      Neighbor Router ID: 1.1.1.1
 
 
                Router Link States (Area 3)
 
 LS age: 268
 Options: (V6-Bit E-Bit R-bit DC-Bit)
 LS Type: Router Links
 Link State ID: 0
 Advertising Router: 1.1.1.1
 LS Seq Number: 80000004
 Checksum: 0xCD3C
 Length: 24
 Area Border Router
 Number of Links: 0
下面只解释路由器R1在区域0中通告的路由器LSA(LSA类型1),其他部分的含义请读者参考该部分的解释去理解。
第一行,该LSA在数据库中存活时间;
第二行,选项比特的设置情况。有关选项比特的含义和功能意义深刻,已超出本书讨论范围,请读者参考RFC2740。
第三行,LSA类型;
第四行,LSA ID;
第五行,通告者路由器ID;
第六行,LSA的序列码;
第七行,校验值;
第八行,长度;
第九行,该路由器是一台ABR;
第十行,该路由器有一条链路在区域0中;
第十一行,该链路与另一台路由器相连,是一条点到点链路;
第十二行,链路度量值;
第十三行,本路由器接口ID号;
第十四行,邻居路由器接口ID号;
第十五行,邻居路由器ID号;
7. show ipv6 ospf database inter-area prefix
router1#sh ipv6 ospf database inter-area prefix
 
            OSPFv3 Router with ID (1.1.1.1) (Process ID 1)
 
                Inter Area Prefix Link States (Area 0)
 
 LS age: 1296
 LS Type: Inter Area Prefix Links
 Link State ID: 0
 Advertising Router: 1.1.1.1
 LS Seq Number: 80000001
 Checksum: 0xCEDB
 Length: 36
 Metric: 1
 Prefix Address: 2006:1010:0:1::
 Prefix Length: 64, Options: None
 
 LS age: 673
 LS Type: Inter Area Prefix Links
 Link State ID: 1
 Advertising Router: 1.1.1.1
 LS Seq Number: 80000001
 Checksum: 0xB49C
 Length: 44
 Metric: 0
 Prefix Address: 2006:1010:0:2:20E:38FF:FEEE:39A0
 Prefix Length: 128, Options: None
 
 LS age: 653
 LS Type: Inter Area Prefix Links
 Link State ID: 2
 Advertising Router: 1.1.1.1
 LS Seq Number: 80000001
 Checksum: 0xBC92
 Length: 44
 Metric: 0
 Prefix Address: 2006:1010:0:3:20E:38FF:FEEE:39A0
 Prefix Length: 128, Options: None
 
 Routing Bit Set on this LSA
 LS age: 140
 LS Type: Inter Area Prefix Links
 Link State ID: 0
 Advertising Router: 2.2.2.2
 LS Seq Number: 80000002
 Checksum: 0xF6AA
 Length: 36
 Metric: 1
 Prefix Address: 2006:1010:0:5::
 Prefix Length: 64, Options: None
 
 
                Inter Area Prefix Link States (Area 3)
 
1.            LS age: 1302
2.            LS Type: Inter Area Prefix Links
3.            Link State ID: 0
4.            Advertising Router: 1.1.1.1
5.            LS Seq Number: 80000001
6.            Checksum: 0x98CD
7.            Length: 36
8.            Metric: 65
9.            Prefix Address: 2006:1010:0:5::
10.         Prefix Length: 64, Options: None
 
router1#
编号部分是路由器R1向区域3通告的区域间LSA(LSA类型3)。
第一行,该LSA在数据库中存活时间;
第二行,LSA类型;
第三行,LSA ID;
第四行,通告者路由器ID;
第五行,LSA的序列码;
第六行,校验值;
第七行,LSA长度;
第八行,路由前缀的度量值;
第九行,通告的路由前缀;
第十行,前缀长度及选项参数;
8. show ipv6 ospf database prefix
router1#sh ipv6 ospf database prefix
 
            OSPFv3 Router with ID (1.1.1.1) (Process ID 1)
 
                Intra Area Prefix Link States (Area 3)
 
 Routing Bit Set on this LSA
 LS age: 700
 LS Type: Intra-Area-Prefix-LSA
 Link State ID: 0
 Advertising Router: 1.1.1.1
 LS Seq Number: 80000003
 Checksum: 0x840F
 Length: 84
 Referenced LSA Type: 2001
 Referenced Link State ID: 0
 Referenced Advertising Router: 1.1.1.1
 Number of Prefixes: 3
 Prefix Address: 2006:1010:0:3:20E:38FF:FEEE:39A0
 Prefix Length: 128, Options: LA , Metric: 0
 Prefix Address: 2006:1010:0:2:20E:38FF:FEEE:39A0
 Prefix Length: 128, Options: LA , Metric: 0
 Prefix Address: 2006:1010:0:1::
 Prefix Length: 64, Options: None, Metric: 1
以上是路由器R1向区域3中通告的LSA类型9。下面只解释该类型LSA携带的专有信息。
l           Referenced LSA Type: 2001 —— 表示参考的LSA类型;
l           Referenced Link State ID: 0 —— 表示参考的链路ID;如果参考的LSA类型为1,该值为0。
l           Referenced Advertising Router: 1.1.1.1 —— 表示被参考的路由器ID;
l           Number of Prefixes: 3 —— 表示该LSA携带了3个前缀。这3个前缀分别是(1)2006:1010:0:3:20E:38FF:FEEE:39A0,前缀长度为128,度量为0,选项LA(local address)表示该前缀实际上是通告者路由器的接口地址。(2)2006:1010:0:2:20E:38FF:FEEE:39A0,前缀长度为128,度量为0,选项LA(local address)表示该前缀是通告者路由器的接口地址。(3)2006:1010:0:1::,前缀长度是64,度量为1。
9. show ipv6 route
下面是路由器R2上的3个环回接口运行在OSPF进程后,两台路由器上的路由表。
(1)路由器R1的路由表
router1#sh ipv6 route
IPv6 Routing Table - 11 entries
Codes: C - Connected, L - Local, S - Static, R - RIP, B - BGP
       U - Per-user Static route
       I1 - ISIS L1, I2 - ISIS L2, IA - ISIS interarea, IS - ISIS summary
       O - OSPF intra, OI - OSPF inter, OE1 - OSPF ext 1, OE2 - OSPF ext 2
       ON1 - OSPF NSSA ext 1, ON2 - OSPF NSSA ext 2
C   2006:1010:0:1::/64 [0/0]
     via ::, FastEthernet0/0
L   2006:1010:0:1:20E:38FF:FEEE:39A0/128 [0/0]
     via ::, FastEthernet0/0
C   2006:1010:0:2::/64 [0/0]
     via ::, Loopback1
L   2006:1010:0:2:20E:38FF:FEEE:39A0/128 [0/0]
     via ::, Loopback1
C   2006:1010:0:3::/64 [0/0]
     via ::, Loopback2
L   2006:1010:0:3:20E:38FF:FEEE:39A0/128 [0/0]
     via ::, Loopback2
OI 2006:1010:0:5::/64 [110/65]
     via FE80::20C:31FF:FEE9:860, Serial0/0
OI 2006:1010:0:6:20C:31FF:FEE9:860/128 [110/64]
     via FE80::20C:31FF:FEE9:860, Serial0/0
OI 2006:1010:0:7:20C:31FF:FEE9:860/128 [110/64]
     via FE80::20C:31FF:FEE9:860, Serial0/0
L   FE80::/10 [0/0]
     via ::, Null0
L   FF00::/8 [0/0]
     via ::, Null0
router1#
(2)路由器R2的路由表
router2#sh ipv6 route
IPv6 Routing Table - 11 entries
Codes: C - Connected, L - Local, S - Static, R - RIP, B - BGP
       U - Per-user Static route
       I1 - ISIS L1, I2 - ISIS L2, IA - ISIS interarea, IS - ISIS summary
       O - OSPF intra, OI - OSPF inter, OE1 - OSPF ext 1, OE2 - OSPF ext 2
       ON1 - OSPF NSSA ext 1, ON2 - OSPF NSSA ext 2
OI 2006:1010:0:1::/64 [110/65]
     via FE80::20E:38FF:FEEE:39A0, Serial0/0
OI 2006:1010:0:2:20E:38FF:FEEE:39A0/128 [110/64]
     via FE80::20E:38FF:FEEE:39A0, Serial0/0
OI 2006:1010:0:3:20E:38FF:FEEE:39A0/128 [110/64]
     via FE80::20E:38FF:FEEE:39A0, Serial0/0
C   2006:1010:0:5::/64 [0/0]
     via ::, FastEthernet0/0
L   2006:1010:0:5:20C:31FF:FEE9:860/128 [0/0]
    via ::, FastEthernet0/0
C   2006:1010:0:6::/64 [0/0]
     via ::, Loopback1
L   2006:1010:0:6:20C:31FF:FEE9:860/128 [0/0]
     via ::, Loopback1
C   2006:1010:0:7::/64 [0/0]
     via ::, Loopback2
L   2006:1010:0:7:20C:31FF:FEE9:860/128 [0/0]
     via ::, Loopback2
L   FE80::/10 [0/0]
     via ::, Null0
L   FF00::/8 [0/0]
     via ::, Null0
router2#
0
相关文章