首页 > 网络应用 > 华为交换机配置IPv6静态路由示例

29168

浏览

0

评论

华为交换机配置IPv6静态路由示例

作者:stephen | 分类:网络应用 | 标签:

组网要求
如图2-2 所示,图中所有IPv6 地址的前缀长度都为64。要求各Switch 之间配置IPv6 静
态路由协议后,可以使所有主机和Switch 之间互通。Switch 与PC 连接的VLANIF 接口
配置IPv6 全球单播地址。Switch 之间互联的VLANIF 接口使用IPv6 链路本地地址。

                  图2-2 配置IPv6 静态路由组网图

Switch接口对应的VLANIFIP 地址
SwitchAGE2/0/0VLANIF 101::1/64
SwitchAGE1/0/0VLANIF 20自动生成
SwitchBGE1/0/0VLANIF 20自动生成
SwitchBGE2/0/0VLANIF 40自动生成
SwitchBGE3/0/0VLANIF 302::1/64
SwitchCGE1/0/0VLANIF 40自动生成
SwitchCGE2/0/0VLANIF 503::1/64

配置思路
采用如下的思路配置IPv6 静态路由:
1. 配置各接口所属VLAN。
2. 首先配置各Switch 各VLANIF 接口的IPv6 地址,使网络互通。
3. 在各Switch 上配置到目的地址的IPv6 静态路由及缺省路由。
4. 在各主机上配置IPv6 缺省网关,使任意两台主机可以互通。
数据准备
为完成此配置例,需准备如下的数据:
l 各接口所属的VLAN,具体数据如图2-2 所示。
l SwitchA 的出接口为VLANIF20 的缺省路由。
l SwitchB 的目的地址为1:: 64,出接口为VLANIF20 的静态路由。
l SwitchB 的目的地址为3:: 64,出接口为VLANIF40 的静态路由。
l SwitchC 的出接口为VLANIF40 的缺省路由。
l 主机PC1 的缺省网关1::1,主机PC2 的缺省网关2::1,主机PC3 的缺省网关3::1。
操作步骤
步骤1 配置接口所属VLAN
<Quidway>system-view
[Quidway] sysname SwitchA
[SwitchA] vlan 10
[SwitchA-vlan10] quit
[SwitchA] interface gigabitethernet 2/0/0
[SwitchA-GigabitEthernet2/0/0] port hybrid pvid vlan 10
[SwitchA-GigabitEthernet2/0/0] port hybrid untagged vlan 10
[SwitchA-GigabitEthernet2/0/0] quit
[SwitchA] vlan 20
[SwitchA-vlan20] quit
[SwitchA] interface gigabitethernet 1/0/0
[SwitchA-GigabitEthernet1/0/0] port hybrid pvid vlan 20
[SwitchA-GigabitEthernet1/0/0] port hybrid untagged vlan 20
[SwitchA-GigabitEthernet1/0/0] quit
SwitchB、SwitchC 的配置同SwitchA 此处略。
步骤2 配置VLANIF 接口的IP 地址
[SwitchA] ipv6
[SwitchA] interface vlanif 10
[SwitchA-Vlanif10] ipv6 enable
[SwitchA-Vlanif10] ipv6 address 1::1/64
[SwitchA-Vlanif10] quit
[SwitchA] interface vlanif 20
[SwitchA-Vlanif20] ipv6 enable
[SwitchA-Vlanif20] ipv6 address auto link-local
[SwitchA-Vlanif20] quit
SwitchB、SwitchC 的配置同SwitchA 此处略。
步骤3 配置主机
配置主机PC1 的缺省网关为1.1.1.1,主机PC2 的缺省网关为1.1.2.1,主机PC3 的缺省
网关为1.1.3.1。
步骤4 配置IPv6 静态路由
# 在SwitchA 配置IPv6 缺省路由。
[SwitchA] ipv6 route-static :: 0 vlanif20 FE80::218:20FF:FE00:80
# 在SwitchB 配置两条IPv6 静态路由。
[SwitchB] ipv6 route-static 1:: 64 vlanif20 FE80::218:20FF:FE00:81
[SwitchB] ipv6 route-static 3:: 64 vlanif40 FE80::218:20FF:FE00:82
# 在SwitchC 配置IPv6 缺省路由。
[SwitchC] ipv6 route-static :: 0 vlanif40 FE80::218:20FF:FE00:83
步骤5 配置主机地址和网关
根据组网图配置好各主机的IPv6 地址,并将PC1 的缺省网关配置为1::1,PC2 的缺省
网关配置为2::1,主机3 的缺省网关配置为3::1。
步骤6 查看配置结果
# 查看SwitchA 的IPv6 路由表。
[SwitchA] display ipv6 routing-table
Routing Table :

Destinations : 5Routes : 5
Destination : ::
NextHop : FE80::218:20FF:FE00:80
Cost : 0
RelayNextHop : ::
Interface : Vlanif20
PrefixLength : 0
Preference : 60
Protocol : Static
TunnelID : 0x0
Flags : D
Destination : ::1
NextHop : ::1
Cost : 0
RelayNextHop : ::
Interface : InLoopBack0
PrefixLength : 128
Preference : 0
Protocol : Direct
TunnelID : 0x0
Flags : D
Destination : 1::
NextHop : 1::1
Cost : 0
RelayNextHop : ::
Interface : Vlanif10
PrefixLength : 64
Preference : 0
Protocol : Direct
TunnelID : 0x0
Flags : D
Destination : 1::1
NextHop : ::1
Cost : 0
RelayNextHop : ::
Interface : Vlanif10
PrefixLength : 128
Preference : 0
Protocol : Direct
TunnelID : 0x0
Flags : D
Destination : FE80::
NextHop : ::
Cost : 0
RelayNextHop : ::
Interface : NULL0
PrefixLength : 10
Preference : 0
Protocol : Direct
TunnelID : 0x0
Flags : D

# 使用Ping 进行验证。
[SwitchA] ping ipv6 3::1
PING 3::1 : 56 data bytes, press CTRL_C to break
Reply from 3::1
bytes=56 Sequence=1 hop limit=254 time = 63 ms
Reply from 3::1
bytes=56 Sequence=2 hop limit=254 time = 62 ms
Reply from 3::1
bytes=56 Sequence=3 hop limit=254 time = 62 ms
Reply from 3::1
bytes=56 Sequence=4 hop limit=254 time = 63 ms
Reply from 3::1
bytes=56 Sequence=5 hop limit=254 time = 63 ms
--- 3::1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 62/62/63 ms
# 使用Tracert 进行验证。
[SwitchA] tracert ipv6 3::1
traceroute to 3::1 30 hops max,60 bytes packet
1 2::1 31 ms 32 ms 31 ms
2 3::1 62 ms 63 ms 62 ms
----结束
配置文件
l SwitchA 的配置文件
#
sysname SwitchA
#
ipv6
#
vlan batch 10 20
#
interface Vlanif10
ipv6 enable
ipv6 address 1::1/64
#
interface Vlanif20
ipv6 enable
ipv6 address auto link-local
#
interface GigabitEthernet1/0/0
port hybrid pvid vlan 20
port hybrid untagged vlan 20
#
interface GigabitEthernet2/0/0
port hybrid pvid vlan 10
port hybrid untagged vlan 10
#
ipv6 route-static :: 0 vlanif20 FE80::218:20FF:FE00:80
#
return
l SwitchB 的配置文件
#
sysname SwitchB
#
ipv6
#
vlan batch 20 30 40
#
interface Vlanif20
ipv6 enable
ipv6 address auto link-local
#
interface Vlanif30
ipv6 enable
ipv6 address 2::1/64
#
interface Vlanif40
ipv6 enable
ipv6 address auto link-local
#
interface GigabitEthernet1/0/0
port hybrid pvid vlan 20
port hybrid untagged vlan 20
#
interface GigabitEthernet2/0/0
port hybrid pvid vlan 40
port hybrid untagged vlan 40
#
interface GigabitEthernet3/0/0
port hybrid pvid vlan 30
port hybrid untagged vlan 30
#
ipv6 route-static 1:: 64 Vlanif20 FE80::218:20FF:FE00:81
ipv6 route-static 3:: 64 Vlanif40 FE80::218:20FF:FE00:82
#
return
l SwitchC 的配置文件
#
sysname SwitchC
#
ipv6
#
vlan batch 40 50
#
interface Vlanif40
S9700 核心路由交换机
配置指南-IP 路由2 静态路由配置
ipv6 enable
ipv6 address auto link-local
#
interface Vlanif50
ipv6 enable
ipv6 address 3::1/64
#
interface GigabitEthernet1/0/0
port hybrid pvid vlan 40
port hybrid untagged vlan 40
#
interface GigabitEthernet2/0/0
port hybrid pvid vlan 50
port hybrid untagged vlan 50
#
ipv6 route-static :: 0 Vlanif40 FE80::218:20FF:FE00:83
#
return


本文链接:https://www.stephenwxf.com/post/46.html
原创文章如转载请注明:转载自王显璠的个人博客谢谢!

Copyright Your stephenwxf.com Rights Reserved.