一、概述
前面我们学习了IPv6的基础概念、IPv6地址的格式与配置方法以及ICMPv6和DHCPv6的应用,但是在实际情况下基于IPv6的还有很多应用,基于IPv6的OSPF、BGP、RIP等等。这里只简单学习下IPv6的静态路由配置即可,能够上网实现网段互通。
相关应用
二、IPv6静态路由
拓扑图:
IPv6静态路由与IPv4静态路由类似,也需要管理员手工配置,适合于一些结构比较简单的IPv6网络。在创建IPv6静态路由时,可以同时指定出接口和下一跳,或者只指定出接口或只指定下一跳。
-
对于点到点接口:指定出接口。
-
对于广播类型接口:指定下一跳。
[Huawei] ipv6 route-static dest-ipv6-address prefix-length { interface-type interface-number [ nexthop-ipv6-address ] | nexthop-ipv6-address | vpn-instance vpn-destination-name nexthop-ipv6-address } [ preference preference][ permanent | inherit-cost ] [ description text ]
AR1
ipv6 route-static 2001:1:: 64 2001:1::3 # 静态路由
ipv6 route-static 2001:2:: 64 2001:1::3 # 静态路由
ipv6 route-static 2001:3:: 64 2001:1::3 # 静态路由AR4
ipv6 route-static :: 0 2001:3::3 # 配置默认路由
IPV6的静态路由与IPv4类似,都需要管理员手动指定、也包括全0的默认路由,使用:: 0
表示,使用静态路由一样需要考虑双向的路由配置。
三、OSPFv3配置
OSPFv3拓扑图
这里只简单配置OSPFv3不深入讨论相关报文了。有几点需要注意:
- OSPFv3是用于IPv6使用
- 和OSPFv2类似,保留了router-id、process id等等
- 不再需要network网段通告,在接口进行通告即可
- 必须配置router-id,格式与ospfv2一致
配置:
# AR1
# 全局启用ipv6
ipv6
# 配置ospf进程以及router-id
ospfv3 1
router-id 1.1.1.1
# 接口通告进行ospfv3的进程和区域
interface GigabitEthernet0/0/0
ipv6 enable
ipv6 address 2001:1::1/64
ospfv3 1 area 0.0.0.0
# 接口通告进行ospfv3的进程和区域
interface LoopBack0
ipv6 enable
ipv6 address 240E::1/64
ospfv3 1 area 0.0.0.0
# AR2
# 全局启用IPv6
ipv6
# 配置OSPFv3进程和router-id
ospfv3 1
router-id 2.2.2.2
# 接口通告
interface GigabitEthernet0/0/1
ipv6 enable
ipv6 address 2001:2::2/64
ospfv3 1 area 0.0.0.0
# AR3
#
ipv6
#
ospfv3 1
router-id 3.3.3.3
#
interface GigabitEthernet0/0/0
ipv6 enable
ipv6 address 2001:1::3/64
ospfv3 1 area 0.0.0.0
#
interface GigabitEthernet0/0/1
ipv6 enable
ipv6 address 2001:2::3/64
ospfv3 1 area 0.0.0.0
#
interface GigabitEthernet0/0/2
ipv6 enable
ipv6 address 2001:3::3/64
ospfv3 1 area 0.0.0.0
# AR4
ipv6
#
ospfv3 1
router-id 4.4.4.4
#
interface GigabitEthernet0/0/2
ipv6 enable
ipv6 address 2001:3::4/64
ospfv3 1 area 0.0.0.0
查看路由:
# 查看OSPFv3邻居
<AR3>dis ospfv3 peer
OSPFv3 Process (1)
OSPFv3 Area (0.0.0.0)
Neighbor ID Pri State Dead Time Interface Instance ID
1.1.1.1 1 Full/Backup 00:00:33 GE0/0/0 0
2.2.2.2 1 Full/Backup 00:00:34 GE0/0/1 0
4.4.4.4 1 Full/Backup 00:00:31 GE0/0/2 0
# 查看IPv6路由表
[AR4]dis ipv6 routing-table
Routing Table : Public
Destinations : 7 Routes : 7
Destination : ::1 PrefixLength : 128
NextHop : ::1 Preference : 0
Cost : 0 Protocol : Direct
RelayNextHop : :: TunnelID : 0x0
Interface : InLoopBack0 Flags : D
Destination : 2001:1:: PrefixLength : 64
NextHop : FE80::2E0:FCFF:FE93:5F2B Preference : 10
Cost : 2 Protocol : OSPFv3
RelayNextHop : :: TunnelID : 0x0
Interface : GigabitEthernet0/0/2 Flags : D
Destination : 2001:2:: PrefixLength : 64
NextHop : FE80::2E0:FCFF:FE93:5F2B Preference : 10
Cost : 2 Protocol : OSPFv3
RelayNextHop : :: TunnelID : 0x0
Interface : GigabitEthernet0/0/2 Flags : D
Destination : 2001:3:: PrefixLength : 64
NextHop : 2001:3::4 Preference : 0
Cost : 0 Protocol : Direct
RelayNextHop : :: TunnelID : 0x0
Interface : GigabitEthernet0/0/2 Flags : D
Destination : 2001:3::4 PrefixLength : 128
NextHop : ::1 Preference : 0
Cost : 0 Protocol : Direct
RelayNextHop : :: TunnelID : 0x0
Interface : GigabitEthernet0/0/2 Flags : D
Destination : 240E::1 PrefixLength : 128
NextHop : FE80::2E0:FCFF:FE93:5F2B Preference : 10
Cost : 2 Protocol : OSPFv3
RelayNextHop : :: TunnelID : 0x0
Interface : GigabitEthernet0/0/2 Flags : D
Destination : FE80:: PrefixLength : 10
NextHop : :: Preference : 0
Cost : 0 Protocol : Direct
RelayNextHop : :: TunnelID : 0x0
Interface : NULL0 Flags : D
# 测试连通性
[AR4]ping ipv6 240e::1
PING 240e::1 : 56 data bytes, press CTRL_C to break
Reply from 240E::1
bytes=56 Sequence=1 hop limit=63 time = 30 ms
Reply from 240E::1
bytes=56 Sequence=2 hop limit=63 time = 40 ms
Reply from 240E::1
bytes=56 Sequence=3 hop limit=63 time = 30 ms
Reply from 240E::1
bytes=56 Sequence=4 hop limit=63 time = 30 ms
Reply from 240E::1
bytes=56 Sequence=5 hop limit=63 time = 40 ms
--- 240e::1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 30/34/40 ms
总结:这里大概了解下ipv6的路由配置,静态路由配置与IPv4类似,OSPFv3稍有不同。
本文由mdnice多平台发布