计算机网络-IPv6静态路由配置

一、概述

前面我们学习了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多平台发布

相关推荐
利以檀本人(梦泽不忙)3 天前
#T1359. 围成面积
c++·程序人生·算法
jingling5553 天前
【高级】系统架构师 | 信息系统战略规划、EAI 与新技术
程序人生·职场和发展·系统架构·学习方法·程序员创富
序属秋秋秋4 天前
我的创作纪念日——《惊变365天》
经验分享·学习·程序人生·纪念日·生活·大学生
蓑衣客VS索尼克4 天前
第三章:生活重构:当程序员不再只是“码农“
学习·程序人生·重构·生活
武子康4 天前
66AI-调查研究-68-具身智能 应用全景:家庭、工业、医疗、交通到虚拟交互的未来趋势
人工智能·程序人生·ai·职场和发展·交互·个人开发·具身智能
swanwei4 天前
技术人员突围之路(15年技术管理经验总结)之十
学习·程序人生·生活·求职招聘·交友
武子康6 天前
AI-调查研究-67-具身智能 核心技术构成全解析:感知、决策、学习与交互的闭环系统
人工智能·科技·学习·程序人生·ai·职场和发展·职场发展
郝学胜-神的一滴6 天前
Pomian语言处理器研发笔记(二):使用组合模式定义表示程序结构的语法树
开发语言·c++·笔记·程序人生·决策树·设计模式·组合模式
郝学胜-神的一滴7 天前
策略模式:模拟八路军的抗日策略
开发语言·c++·程序人生·设计模式·策略模式
Cedric11139 天前
解构与重构:“真人不露相,露相非真人” 的存在论新解 —— 论 “真在” 的行为表达本质
程序人生