满天星 发表于 2010-8-18 22:16:31

在Cisco路由器上配置OSPFv3路由协议

在Cisco路由器上配置OSPFv3路由协议
   下面我们将以Cisco路由器为例来演示如何配置IPv6下的OSPFv3路由协议,本次实验采用三台Router,router1.ipv6bbs.cn与router2.ipv6bbs.cn运行于骨干区域0,router2.ipv6bbs.cn与router3.ipv6bbs.cn运行于非骨干区域1,每台Router上均起一个Loopback1接口,发布至OSPFv3路由协议中。具体的组网图如下所示:
   
实验组网图与IPv6地址分配

    各设备的接口IPv6地址地址与接口编号请对照下图查看:
   



配置思路与流程说明:


[*]在每台设备上开启IPV6功能:ipv6 unicast-routing
[*]在每台设备上创建OSPFv3进程号100:ipv6 routerospf   100
[*]为每台设备的OSPFv3进程配置唯一的router-id:router-id1.1.1.1
          注意:此处的router-id与IPv4中的OSPF一样,仍未32位的IPv4地址形式,但仅标识ID,无IPv4中地址的意义
[*]在相应接口下开启IPv6:ipv6 enable,并配置IPv6地址:ipv6 address1::1/128
[*]在相应的接口下使能OSPFv3路由协议,并配置该接口需加入的OSPFv3区域号:ipv6 ospf 100 area 0



router1.ipv6bbs.cn的配置步骤:



router1.ipv6bbs.cn con0 is now available

Press RETURN to get started.

router1.ipv6bbs.cn>
router1.ipv6bbs.cn>enable
router1.ipv6bbs.cn#conf t
Enter configuration commands, one per line.End with CNTL/Z.
router1.ipv6bbs.cn(config)#ipv6 unicast-routing
router1.ipv6bbs.cn(config)#ipv6 routerospf   100
router1.ipv6bbs.cn(config-rtr)#
*Aug 18 21:39:07.115: %OSPFv3-4-NORTRID: OSPFv3 process 100 could not pick a router-id,
please configure manually
router1.ipv6bbs.cn(config-rtr)#router-id1.1.1.1
router1.ipv6bbs.cn(config-rtr)#exit
router1.ipv6bbs.cn(config)#interface loopback1
router1.ipv6bbs.cn(config-if)#
*Aug 18 21:39:56.047: %LINK-3-UPDOWN: Interface Loopback1, changed state to up
*Aug 18 21:39:57.047: %LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback1, changed state to up
router1.ipv6bbs.cn(config-if)#ipv6 enable
router1.ipv6bbs.cn(config-if)#ipv6 address1::1/128
router1.ipv6bbs.cn(config-if)#ipv6 ospf 100 area 0
router1.ipv6bbs.cn(config-if)#exit
router1.ipv6bbs.cn(config)#interface gigabitEthernet 0/0
router1.ipv6bbs.cn(config-if)#ipv6 enable
router1.ipv6bbs.cn(config-if)#ipv6 address 1002::1/64
router1.ipv6bbs.cn(config-if)#ipv6 ospf 100 area 0
router1.ipv6bbs.cn(config-if)#no shutdown
router1.ipv6bbs.cn(config-if)#
*Aug 18 21:41:12.455: %LINK-3-UPDOWN: Interface GigabitEthernet0/0, changed state to up
*Aug 18 21:41:13.455: %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/0, changed state to up
router1.ipv6bbs.cn(config-if)#




router2.ipv6bbs.cn的配置步骤:



router2.ipv6bbs.cn con0 is now available

Press RETURN to get started.

router2.ipv6bbs.cn>
router2.ipv6bbs.cn>enable
router2.ipv6bbs.cn#config t
Enter configuration commands, one per line.End with CNTL/Z.
router2.ipv6bbs.cn(config)#ipv6 unicast-routing
router2.ipv6bbs.cn(config)#ipv6 router ospf 100
router2.ipv6bbs.cn(config-rtr)#
*Aug 18 21:42:10.639: %OSPFv3-4-NORTRID: OSPFv3 process 100 could not pick a router-id,
please configure manually
router2.ipv6bbs.cn(config-rtr)#router-id2.2.2.2
router2.ipv6bbs.cn(config-rtr)#exit
router2.ipv6bbs.cn(config)#interface loopback1
router2.ipv6bbs.cn(config-if)#
*Aug 18 21:42:29.287: %LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback1, changed state to up
router2.ipv6bbs.cn(config-if)#ipv6 enable
router2.ipv6bbs.cn(config-if)#ipv6 address 2::2/128
router2.ipv6bbs.cn(config-if)#ipv6 ospf 100 area 0
router2.ipv6bbs.cn(config-if)#exit
router2.ipv6bbs.cn(config)#interface gigabitEthernet0/0
router2.ipv6bbs.cn(config-if)#ipv6 enable
router2.ipv6bbs.cn(config-if)#ipv6 address 1002::2/64
router2.ipv6bbs.cn(config-if)#ipv6 ospf 100 area 0
router2.ipv6bbs.cn(config-if)#no shutdown
router2.ipv6bbs.cn(config-if)#
*Aug 18 21:44:07.651: %LINK-3-UPDOWN: Interface GigabitEthernet0/0, changed state to up
*Aug 18 21:44:08.651: %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/0, changed state to up
router2.ipv6bbs.cn(config-if)#
*Aug 18 21:44:10.399: %OSPFv3-5-ADJCHG: Process 100, Nbr 1.1.1.1 on GigabitEthernet0/0 from LOADING to FULL, Loading Done
router2.ipv6bbs.cn(config-if)#exit
router2.ipv6bbs.cn(config)#interface gigabitEthernet1/0
router2.ipv6bbs.cn(config-if)#ipv6 enable
router2.ipv6bbs.cn(config-if)#ipv6address 2003::1/64
router2.ipv6bbs.cn(config-if)#ipv6 ospf 100 area 1
router2.ipv6bbs.cn(config-if)#no shutdown
router2.ipv6bbs.cn(config-if)#
*Aug 18 21:44:58.571: %LINK-3-UPDOWN: Interface GigabitEthernet1/0, changed state to up
*Aug 18 21:44:59.571: %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet1/0, changed state to up
router2.ipv6bbs.cn(config-if)#exit
router2.ipv6bbs.cn(config)#




router3.ipv6bbs.cn的配置步骤:



router3.ipv6bbs.cn con0 is now available

Press RETURN to get started.

router3.ipv6bbs.cn>
router3.ipv6bbs.cn>en
router3.ipv6bbs.cn#conf t
Enter configuration commands, one per line.End with CNTL/Z.
router3.ipv6bbs.cn(config)#ipv6 unicast-routing
router3.ipv6bbs.cn(config)#ipv6 router ospf 100
router3.ipv6bbs.cn(config-rtr)#
*Aug 18 21:46:09.083: %OSPFv3-4-NORTRID: OSPFv3 process 100 could not pick a router-id,
please configure manually
router3.ipv6bbs.cn(config-rtr)#router-id3.3.3.3
router3.ipv6bbs.cn(config-rtr)#exit
router3.ipv6bbs.cn(config)#interface loopback1
router3.ipv6bbs.cn(config-if)#
*Aug 18 21:46:54.855: %LINK-3-UPDOWN: Interface Loopback1, changed state to up
*Aug 18 21:46:55.855: %LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback1, changed state to up
router3.ipv6bbs.cn(config-if)#ipv6 enable
router3.ipv6bbs.cn(config-if)#ipv6 address 3::3/128
router3.ipv6bbs.cn(config-if)#ipv6 ospf 100 area 1
router3.ipv6bbs.cn(config-if)#exit
router3.ipv6bbs.cn(config)#interface gigabitEthernet0/0
router3.ipv6bbs.cn(config-if)#ipv6 enable
router3.ipv6bbs.cn(config-if)#ipv6 address 2003::2/64
router3.ipv6bbs.cn(config-if)#ipv6 ospf 100 area 1
router3.ipv6bbs.cn(config-if)#no shutdown
router3.ipv6bbs.cn(config-if)#
router3.ipv6bbs.cn(config-if)#
*Aug 18 21:48:03.763: %LINK-3-UPDOWN: Interface GigabitEthernet0/0, changed state to up
*Aug 18 21:48:04.763: %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/0, changed state to up
*Aug 18 21:48:06.731: %OSPFv3-5-ADJCHG: Process 100, Nbr 2.2.2.2 on GigabitEthernet0/0 from LOADING to FULL, Loading Done
router3.ipv6bbs.cn(config-if)#^Z
router3.ipv6bbs.cn#



查看各设备IPv6路由表与OSPFv3邻居状态

所有设备之间的OSPFv3已按照组网图配置完毕,我们可以在router1.ipv6bbs.cn上查看OSPFv3邻居,
并查看IPv6路由表,也能学到router2.ipv6bbs.cn与router3.ipv6bbs.cn上面的loopback接口,
pingrouter2.ipv6bbs.cn与router3.ipv6bbs.cn上面的loopback接口ipv6地址,均能正常通讯



router1.ipv6bbs.cn#show ipv6ospf neighbor

Neighbor ID   Pri   State         Dead Time   Interface ID    Interface
2.2.2.2         1   FULL/BDR      00:00:37    4               GigabitEthernet0/0
router1.ipv6bbs.cn#show ipv6 route
IPv6 Routing Table - default - 7 entries
Codes: C - Connected, L - Local, S - Static, U - Per-user Static route
       B - BGP, M - MIPv6, R - RIP, I1 - ISIS L1
       I2 - ISIS L2, IA - ISIS interarea, IS - ISIS summary, D - EIGRP
       EX - EIGRP external, ND - Neighbor Discovery
       O - OSPF Intra, OI - OSPF Inter, OE1 - OSPF ext 1, OE2 - OSPF ext 2
       ON1 - OSPF NSSA ext 1, ON2 - OSPF NSSA ext 2
LC1::1/128
   via Loopback1, receive
O   2::2/128
   via FE80::C806:FFF:FE3C:8, GigabitEthernet0/0
OI3::3/128
   via FE80::C806:FFF:FE3C:8, GigabitEthernet0/0
C   1002::/64
   via GigabitEthernet0/0, directly connected
L   1002::1/128
   via GigabitEthernet0/0, receive
OI2003::/64
   via FE80::C806:FFF:FE3C:8, GigabitEthernet0/0
L   FF00::/8
   via Null0, receive
router1.ipv6bbs.cn#ping ipv6 2::2

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2::2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 0/105/296 ms
router1.ipv6bbs.cn#ping ipv6 3::3

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 3::3, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 96/143/176 ms
router1.ipv6bbs.cn#



查看router2上面的OSPFv3邻居状态:



router2.ipv6bbs.cn#
router2.ipv6bbs.cn#show ipv6 ospf neighbor

Neighbor ID   Pri   State         Dead Time   Interface ID    Interface
1.1.1.1         1   FULL/DR         00:00:38    4               GigabitEthernet0/0
3.3.3.3         1   FULL/BDR      00:00:33    4               GigabitEthernet1/0
router2.ipv6bbs.cn#



查看router3上面的OSPFv3邻居状态与IPv6路由表:



router3.ipv6bbs.cn#
router3.ipv6bbs.cn#show ipv6 ospf neighbor

Neighbor ID   Pri   State         Dead Time   Interface ID    Interface
2.2.2.2         1   FULL/DR         00:00:37    5               GigabitEthernet0/0
router3.ipv6bbs.cn#
router3.ipv6bbs.cn#show ipv6 route
IPv6 Routing Table - default - 7 entries
Codes: C - Connected, L - Local, S - Static, U - Per-user Static route
       B - BGP, M - MIPv6, R - RIP, I1 - ISIS L1
       I2 - ISIS L2, IA - ISIS interarea, IS - ISIS summary, D - EIGRP
       EX - EIGRP external, ND - Neighbor Discovery
       O - OSPF Intra, OI - OSPF Inter, OE1 - OSPF ext 1, OE2 - OSPF ext 2
       ON1 - OSPF NSSA ext 1, ON2 - OSPF NSSA ext 2
OI1::1/128
   via FE80::C806:FFF:FE3C:1C, GigabitEthernet0/0
OI2::2/128
   via FE80::C806:FFF:FE3C:1C, GigabitEthernet0/0
LC3::3/128
   via Loopback1, receive
OI1002::/64
   via FE80::C806:FFF:FE3C:1C, GigabitEthernet0/0
C   2003::/64
   via GigabitEthernet0/0, directly connected
L   2003::2/128
   via GigabitEthernet0/0, receive
L   FF00::/8
   via Null0, receive
router3.ipv6bbs.cn#



本篇为基本配置篇,已熟悉的朋友可以参考进阶篇:
在Cisco路由器上配置OSPFv3路由协议(进阶篇)

fox_yu_8 发表于 2010-10-18 10:31:18

受教,有个问题,在ospfv3里面不用设置area区域么?ipv6 ospf 100 area 1
是不是自动设置了?我用cisco packettracer搭环境,发现area设置命令如下
Router(config-rtr)#area 0.0.0.0 ?
default-costSet the summary default-cost of a NSSA/stub area
nssa          Specify a NSSA area
stub          Specify a stub area
virtual-linkDefine a virtual link and its parameters
所以没搞明白要设置area必须需要手动设置nssa,stub和virtual-link么?

fox_yu_8 发表于 2010-10-18 10:33:28

另外H3C的ospfv3设置配置我找到了一个
ospfv3 1
router-id 2.2.2.1
area 0.0.0.0
这里面看到H3C的area貌似没有设置nssa、stub等,所以存在疑惑。。。

fox_yu_8 发表于 2010-10-18 12:17:50

按照上述配置做了环境,貌似没有成功。。。

fox_yu_8 发表于 2010-10-18 16:34:40

我看到邻居关系建立没问题,但是路由表没有成功,难道是因为我没配置loopback的原因?

fox_yu_8 发表于 2010-10-18 21:10:32

:L在家里重新做了虚拟环境,通了。。。。但是。。。见下面:
R2#
R2#ping ipv6 2001:da8:fe80:f011::1

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2001:DA8:FE80:F011::1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 524/937/1248 ms
R2#ping ipv6 2001:da8:fe80:f011::2

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2001:DA8:FE80:F011::2, timeout is 2 seconds:
!!...
Success rate is 40 percent (2/5), round-trip min/avg/max = 1552/1648/1744 ms
R2#
这个是第3个router。。。。。用GNS3做测试,s3640设备3640-JN 版本ios    得到这么个结果着实让我狂汗。。。看来虚拟和现实确实存在一定差距啊!(虚拟机都会丢包。。。。看来这个问题教给我们一个道理:实践出真知。。。。。光虚拟实验貌似也不可完全相信耶;P)

满天星 发表于 2010-10-18 21:28:11

在IPv6下的OSPFv3中配置区域一般都是直接在接口下使能OSPFv3进程的时候手工指定。
在华为与H3C等Router下,直接ospfv31创建一个进程号,然后手工指定router-id 2.2.2.1(必须手工指定)然后就可以退出视图到接口下使能OSPFv3协议了:ospfv3 1 area0即可,在OSPFv3的进程1中会自动生成area 0.0.0.0的配置文件,无需手工操作。如果需要将某区域配置为stub等区域,必须先进入ospfv3 1视图,然后再进入自动生成的area 0.0.0.0视图,即可进行相应的配置。
而思科的配置方式则像你上面贴出来的在area 0.0.0.0 后面加相应的参数实现,道理是一样,实现命令行稍有区别。

虚拟机做实验也不能丢包的,很显然是你的配置或者其它什么组网设置出现了问题,最好把你的实验环境结构搞清楚。如果出现丢包应该是其它原因引起的。
另外在思科的设备上必须开启ipv6 unicast-routing功能,保证IPv6单播数据包可被路由
而在华为与H3C等设备则是在系统视图(System-view)下执行ipv6命令,使能全局IPv6功能即可。

PS:发帖时如果碰见IPv6地址被discuz表情所替代,可以编辑一下,然后输入框下面有一个[发帖选项],[禁用表情]打上勾则不会讲IPv6地址自动替换为表情。

fox_yu_8 发表于 2010-10-19 14:02:05

在公司重新搭建环境已经测试,无丢包。
回顾昨晚的搭建,原因可能存在路由上,由于配置失误,R1的router-id配错了。。。。由于路由条目已经生成且未老化,所以造成网络丢包。。。。呵呵。

满天星 发表于 2010-10-19 21:28:26

{:3_62:}
分析清楚问题原因就OK,虚拟实验环境基本上在协议功能方面与真实设备类似,但性能方面就不能计较太多了……

Erina 发表于 2010-11-12 13:11:23

都是专业问题 一句都看不懂:dizzy:
页: [1] 2
查看完整版本: 在Cisco路由器上配置OSPFv3路由协议