在Cisco路由器上配置OSPFv3路由协议(进阶篇)

在之前已有一篇关于在Cisco路由器上配置OSPFv3基本功能的教程:


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

该教程除了说明配置上与IPv4中OSPFv2配置的不同外,没有什么特殊之处,无法体现IPv6网络下OSPFv3的各种强大功能,因OSPF是目前网络中使用相当广泛的路由协议,因此本帖以OSPFv3为例,讲述在IPv6网络下OSPFv3的二种新功能,这是OSPFv2中所完全不具备的,本教程不涉及枯燥的协议原理与报文格式,仅以最终表现的效果来向大家展示。

如需深入了解OSPFv3协议原理及报文格式的朋友,建议参考
RFC 5340(已废除原有的RFC 2740)

在Cisco路由器上配置OSPFv3路由协议(进阶篇)

     下面我们将以Cisco路由器为例来演示如何配置IPv6下的OSPFv3路由协议,本次实验采用四台Router及一个Switch,router1.ipv6s.com与router2.ipv6s.com、router3.ipv6s.com、router4.ipv6s.com的一个接口通过一个Switch相连,处于一条链路上(IPv4中一般称为同一个子网中)。


新功能之一:请大家仔细看:所有router的接口IPv6地址,他们均在不同的一个网段,这样也能建立邻居?图没画错吧?在IPv4下它显然是不可能的,但在IPv6下却没有任何问题。不仅仅OSPFv3路由协议如此,RIPng、ISISv6、EIGRPv6等各种IPv6下的路由协议均是如此。这些都归功于IPv6下无处不在的链路本地地址(fe80::/10),所有邻居均是通过link-local地址建立,因此即使他们的全球单播地址不在一个网段也能建立邻居。


新功能之二:router1.ipv6s.com只与router2.ipv6s.com建立邻居,而router3.ipv6s.com只与router4.ipv6s.com建立邻居。这个在IPv4下是比较麻烦的,可以通过设置认证来实现,但是IPv6下却非常容易,通instance id来识别,它是报文格式中所必须的一个字段,默认均为0,只有相同id的才能建立邻居。

OK,二个最基本的原理已经介绍完了,请根据后面的组网图及配置进行配置,OSPFv3的强大功能不仅仅是本文中列举的这二点。

   

实验组网图与IPv6地址分配

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

     

配置思路与流程说明:

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

router1.ipv6s.com的配置步骤:

router1.ipv6s.com con0 is now available

Press RETURN to get started.

router1.ipv6s.com>
enable

router1.ipv6s.com#
configure  terminal

Enter configuration commands, one per line.  End with CNTL/Z.

router1.ipv6s.com(config)#
ipv6 unicast-routing

router1.ipv6s.com(config)#
ipv6 router ospf 1

router1.ipv6s.com(config-rtr)#

*Dec 25 14:57:46.395: %OSPFv3-4-NORTRID: OSPFv3 process 1 could not pick a router-id,

please configure manually

router1.ipv6s.com(config-rtr)#
router-id  1.1.1.1

router1.ipv6s.com(config-rtr)#
exit

router1.ipv6s.com(config)#
interface  FastEthernet  1/0

router1.ipv6s.com(config-if)#
ipv6 enable

router1.ipv6s.com(config-if)#
ipv6 address 1::1/64

router1.ipv6s.com(config-if)#
ipv6 ospf 1 area 0 instance  100

router1.ipv6s.com(config-if)#
no shutdown

router1.ipv6s.com(config-if)#

*Dec 25 14:58:31.215: %LINK-3-UPDOWN: Interface FastEthernet1/0, changed state to up

*Dec 25 14:58:32.215: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet1/0, changed state to up

router1.ipv6s.com(config-if)#

router2.ipv6s.com的配置步骤:

router2.ipv6s.com con0 is now available

Press RETURN to get started.

router2.ipv6s.com>
enable

router2.ipv6s.com#
configure  terminal

Enter configuration commands, one per line.  End with CNTL/Z.

router2.ipv6s.com(config)#
ipv6 unicast-routing

router2.ipv6s.com(config)#
ipv6 router ospf 1

router2.ipv6s.com(config-rtr)#

*Dec 25 14:58:54.259: %OSPFv3-4-NORTRID: OSPFv3 process 1 could not pick a router-id,

please configure manually

router2.ipv6s.com(config-rtr)#
router-id  2.2.2.2

router2.ipv6s.com(config-rtr)#
exit

router2.ipv6s.com(config)#
interface  fastEthernet  1/0

router2.ipv6s.com(config-if)#
ipv6 enable

router2.ipv6s.com(config-if)#
ipv6 address 2::2/64

router2.ipv6s.com(config-if)#
ipv6 ospf 1 area 0 instance  100

router2.ipv6s.com(config-if)#
no shutdown

router2.ipv6s.com(config-if)#

*Dec 25 15:00:10.491: %LINK-3-UPDOWN: Interface FastEthernet1/0, changed state to up

*Dec 25 15:00:11.491: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet1/0, changed state to up

*Dec 25 15:00:13.923: %OSPFv3-5-ADJCHG: Process 1, Nbr 1.1.1.1 on FastEthernet1/0 from LOADING to FULL, Loading Done

router2.ipv6s.com(config-if)#

router3.ipv6s.com的配置步骤:

router3.ipv6s.com con0 is now available

Press RETURN to get started.

router3.ipv6s.com>
enable

router3.ipv6s.com#
configure  terminal

Enter configuration commands, one per line.  End with CNTL/Z.

router3.ipv6s.com(config)#
ipv6 unicast-routing

router3.ipv6s.com(config)#
ipv6 router ospf 1

router3.ipv6s.com(config-rtr)#

*Dec 25 15:01:34.071: %OSPFv3-4-NORTRID: OSPFv3 process 1 could not pick a router-id,

please configure manually

router3.ipv6s.com(config-rtr)#
router-id  3.3.3.3

router3.ipv6s.com(config-rtr)#
exit

router3.ipv6s.com(config)#
interface  fastEthernet  1/0

router3.ipv6s.com(config-if)#
ipv6 enable

router3.ipv6s.com(config-if)#
ipv6 address 3::3/64

router3.ipv6s.com(config-if)#
ipv6 ospf 1 area 0 instance  200

router3.ipv6s.com(config-if)#
no shutdown

router3.ipv6s.com(config-if)#

router3.ipv6s.com(config-if)#

*Dec 25 15:02:09.359: %LINK-3-UPDOWN: Interface FastEthernet1/0, changed state to up

*Dec 25 15:02:10.359: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet1/0, changed state to up

router3.ipv6s.com(config-if)#

router4.ipv6s.com的配置步骤:

router4.ipv6s.com con0 is now available

Press RETURN to get started.

router4.ipv6s.com>
enable

router4.ipv6s.com#configure  terminal

Enter configuration commands, one per line.  End with CNTL/Z.

router4.ipv6s.com(config)#
ipv6 unicast-routing

router4.ipv6s.com(config)#
ipv6 router ospf 1

router4.ipv6s.com(config-rtr)#

*Dec 25 15:05:13.371: %OSPFv3-4-NORTRID: OSPFv3 process 1 could not pick a router-id,

please configure manually

router4.ipv6s.com(config-rtr)#
router-id  4.4.4.4

router4.ipv6s.com(config-rtr)#
exit

router4.ipv6s.com(config)#
interface  fastEthernet  1/0

router4.ipv6s.com(config-if)#
ipv6 enable

router4.ipv6s.com(config-if)#
ipv6 address 4::4/64

router4.ipv6s.com(config-if)#
ipv6 ospf 1 area 0 instance  200

router4.ipv6s.com(config-if)#
no shutdown

router4.ipv6s.com(config-if)#

*Dec 25 15:06:38.187: %LINK-3-UPDOWN: Interface FastEthernet1/0, changed state to up

*Dec 25 15:06:39.187: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet1/0, changed state to up

router4.ipv6s.com(config-if)#

router4.ipv6s.com(config-if)#

*Dec 25 15:06:41.423: %OSPFv3-5-ADJCHG: Process 1, Nbr 3.3.3.3 on FastEthernet1/0 from LOADING to FULL, Loading Done

router4.ipv6s.com(config-if)#^Z

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

所有设备之间的OSPFv3已按照组网图配置完毕,我们可以在router1.ipv6s.com上查看OSPFv3邻居,

并查看IPv6路由表,ping  router2.ipv6s.com通讯正常,但ping router3.ipv6s.com及router4.ipv6s.com上面的接口ipv6地址,因为路由不可达,所以无法ping通

router1.ipv6s.com#
show ipv6 ospf neighbor

Neighbor ID     Pri   State           Dead Time   Interface ID    Interface

2.2.2.2           1   FULL/BDR        00:00:38    4               FastEthernet1/0

router1.ipv6s.com#

router1.ipv6s.com#
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 = 68/282/744 ms

router1.ipv6s.com#
ping ipv6 3::3

Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 3::3, timeout is 2 seconds:

% No valid source address for destination

Success rate is 0 percent (0/1)

router1.ipv6s.com#
ping ipv 4::4

Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 4::4, timeout is 2 seconds:

% No valid source address for destination

Success rate is 0 percent (0/1)

router1.ipv6s.com#
show ipv6 route

IPv6 Routing Table – default – 4 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

C   1::/64 [0/0]

     via FastEthernet1/0, directly connected

L   1::1/128 [0/0]

     via FastEthernet1/0, receive

O   2::/64 [110/1]

     via FastEthernet1/0, directly connected

L   FF00::/8 [0/0]

     via Null0, receive

router1.ipv6s.com#

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

router2.ipv6s.com#
show ipv6 ospf neighbor

Neighbor ID     Pri   State           Dead Time   Interface ID    Interface

1.1.1.1           1   FULL/DR         00:00:31    4               FastEthernet1/0

router2.ipv6s.com#

查看router3.ipv6s.com上面的OSPFv3邻居状态与IPv6路由表,并ping其它设备的接口IPv6地址,与router1.ipv6s.com上原因类似:

router3.ipv6s.com#
show ipv6  ospf  neighbor

Neighbor ID     Pri   State           Dead Time   Interface ID    Interface

4.4.4.4           1   FULL/BDR        00:00:35    4               FastEthernet1/0

router3.ipv6s.com#
ping ipv6 4::4

Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 4::4, timeout is 2 seconds:

!!!!!

Success rate is 100 percent (5/5), round-trip min/avg/max = 0/232/628 ms

router3.ipv6s.com#
ping ipv 1::1

Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 1::1, timeout is 2 seconds:

% No valid source address for destination

Success rate is 0 percent (0/1)

router3.ipv6s.com#
show ipv6 route

IPv6 Routing Table – default – 4 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

C   3::/64 [0/0]

     via FastEthernet1/0, directly connected

L   3::3/128 [0/0]

     via FastEthernet1/0, receive

O   4::/64 [110/1]

     via FastEthernet1/0, directly connected

L   FF00::/8 [0/0]

     via Null0, receive

router3.ipv6s.com#
show ipv6 ospf neighbor

Neighbor ID     Pri   State           Dead Time   Interface ID    Interface

4.4.4.4           1   FULL/BDR        00:00:36    4               FastEthernet1/0

router3.ipv6s.com#

查看router4.ipv6s.com上面的OSPFv3邻居状态:

router4.ipv6s.com#
show ipv6 ospf neighbor

Neighbor ID     Pri   State           Dead Time   Interface ID    Interface

3.3.3.3           1   FULL/DR         00:00:36    4               FastEthernet1/0

router4.ipv6s.com#

原创文章,作者:admin,如若转载,请注明出处:https://www.ipv6s.com/basis/routing/20110103508.html

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注