19-隧道典型配置举例
本章节下载: 19-隧道典型配置举例 (362.9 KB)
目 录
本章介绍了使用隧道技术实现利用一种网络协议来传输另一种网络协议的典型配置案例。
表1 配置适用的产品与软件版本关系
产品 |
软件版本 |
S10500系列以太网交换机 |
Release 1120系列,Release 1130系列,Release 1200系列 |
S5800&S5820X系列以太网交换机 |
Release 1808 |
S5830系列以太网交换机 |
Release 1115,Release 1118 |
S5500-EI系列以太网交换机 |
Release 2220 |
如图1所示,Switch A和Switch B之间路由可达,两台交换机下各连接一个IPv6网络,要求通过配置IPv6手动隧道实现两个IPv6网络互通。
图1 IPv6手动隧道典型配置组网图
配置Tunnel接口前,需要先创建业务类型为Tunnel的业务环回组,并将设备上未使用的二层以太网端口加入该业务环回组。
# 使能IPv6转发功能。
<SwitchA> system-view
[SwitchA] ipv6
# 配置接口Vlan-interface100的地址。
[SwitchA] interface vlan-interface 100
[SwitchA-Vlan-interface100] ip address 192.168.100.1 255.255.255.0
[SwitchA-Vlan-interface100] quit
# 配置接口Vlan-interface101的IPv6地址。
[SwitchA] interface vlan-interface 101
[SwitchA-Vlan-interface101] ipv6 address 3002::1 64
[SwitchA-Vlan-interface101] quit
# 配置手动隧道。
[SwitchA] interface tunnel 0
[SwitchA-Tunnel0] ipv6 address 3001::1/64
[SwitchA-Tunnel0] source vlan-interface 100
[SwitchA-Tunnel0] destination 192.168.50.1
[SwitchA-Tunnel0] tunnel-protocol ipv6-ipv4
[SwitchA-Tunnel0] quit
# 创建并配置业务环回组1,服务类型为tunnel。
[SwitchA] service-loopback group 1 type tunnel
# 将接口GigabitEthernet1/0/3加入业务环回组1,并在该端口上关闭STP、NDP和LLDP功能(S10500和S5830系列交换机不支持NDP,关闭NDP配置可省略)。
[SwitchA] interface GigabitEthernet 1/0/3
[SwitchA-GigabitEthernet1/0/3] undo stp enable
[SwitchA-GigabitEthernet1/0/3] undo ndp enable
[SwitchA-GigabitEthernet1/0/3] undo lldp enable
[SwitchA-GigabitEthernet1/0/3] port service-loopback group 1
[SwitchA-GigabitEthernet1/0/3] quit
# 在Tunnel接口视图下指定隧道引用的业务环回组1。
[SwitchA] interface tunnel 0
[SwitchA-Tunnel0] service-loopback-group 1
[SwitchA-Tunnel0] quit
# 配置从Switch A经过Tunnel0接口到Group 2的静态路由。
[SwitchA] ipv6 route-static 3003:: 64 tunnel 0
# 使能IPv6转发功能。
<SwitchB> system-view
[SwitchB] ipv6
# 配置接口Vlan-interface100的地址。
[SwitchB] interface vlan-interface 100
[SwitchB-Vlan-interface100] ip address 192.168.50.1 255.255.255.0
[SwitchB-Vlan-interface100] quit
# 配置接口Vlan-interface101的IPv6地址。
[SwitchB] interface vlan-interface 101
[SwitchB-Vlan-interface101] ipv6 address 3003::1 64
[SwitchB-Vlan-interface101] quit
# 配置手动隧道。
[SwitchB] interface tunnel 0
[SwitchB-Tunnel0] ipv6 address 3001::2/64
[SwitchB-Tunnel0] source vlan-interface 100
[SwitchB-Tunnel0] destination 192.168.100.1
[SwitchB-Tunnel0] tunnel-protocol ipv6-ipv4
[SwitchB-Tunnel0] quit
# 创建并配置业务环回组1,服务类型为tunnel。
[SwitchB] service-loopback group 1 type tunnel
# 将接口GigabitEthernet1/0/3加入业务环回组1,并在该端口上关闭STP、NDP和LLDP功能(S10500和S5830系列交换机不支持NDP,关闭NDP配置可省略)。
[SwitchB] interface GigabitEthernet 1/0/3
[SwitchB-GigabitEthernet1/0/3] undo stp enable
[SwitchB-GigabitEthernet1/0/3] undo ndp enable
[SwitchB-GigabitEthernet1/0/3] undo lldp enable
[SwitchB-GigabitEthernet1/0/3] port service-loopback group 1
[SwitchB-GigabitEthernet1/0/3] quit
# 在Tunnel接口视图下指定隧道引用的业务环回组1。
[SwitchB] interface tunnel 0
[SwitchB-Tunnel0] service-loopback-group 1
[SwitchB-Tunnel0] quit
# 配置从Switch B经过Tunnel0接口到Group 1的静态路由。
[SwitchB] ipv6 route-static 3002:: 64 tunnel 0
# 完成以上配置之后,分别查看Switch A和Switch B的Tunnel接口状态如下:
[SwitchA] display ipv6 interface tunnel 0 verbose
Tunnel0 current state :UP
Line protocol current state :UP
IPv6 is enabled, link-local address is FE80::C0A8:6401
Global unicast address(es):
3001::1, subnet is 3001::/64
Joined group address(es):
FF02::1:FF00:0
FF02::1:FF00:1
FF02::1:FFA8:6401
FF02::2
FF02::1
MTU is 1480 bytes
ND reachable time is 30000 milliseconds
ND retransmit interval is 1000 milliseconds
Hosts use stateless autoconfig for addresses
IPv6 Packet statistics:
InReceives: 55
……(略)
[SwitchB] display ipv6 interface tunnel 0 verbose
Tunnel0 current state :UP
Line protocol current state :UP
IPv6 is enabled, link-local address is FE80::C0A8:3201
Global unicast address(es):
3001::2, subnet is 3001::/64
Joined group address(es):
FF02::1:FF00:0
FF02::1:FF00:1
FF02::1:FFA8:3201
FF02::2
FF02::1
MTU is 1480 bytes
ND reachable time is 30000 milliseconds
ND retransmit interval is 1000 milliseconds
Hosts use stateless autoconfig for addresses
IPv6 Packet statistics:
InReceives: 55
……(略)
# 从Switch A上可以Ping通Switch B的Vlan-int101接口的IPv6地址:
[SwitchA] ping ipv6 3003::1
PING 3003::1 : 56 data bytes, press CTRL_C to break
Reply from 3003::1
bytes=56 Sequence=1 hop limit=64 time = 1 ms
Reply from 3003::1
bytes=56 Sequence=2 hop limit=64 time = 1 ms
Reply from 3003::1
bytes=56 Sequence=3 hop limit=64 time = 1 ms
Reply from 3003::1
bytes=56 Sequence=4 hop limit=64 time = 1 ms
Reply from 3003::1
bytes=56 Sequence=5 hop limit=64 time = 1 ms
--- 3003::1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 1/1/1 ms
· Switch A
#
ipv6
#
service-loopback group 1 type tunnel
#
vlan 100 to 101
#
interface Vlan-interface100
ip address 192.168.100.1 255.255.255.0
#
interface Vlan-interface101
ipv6 address 3002::1/64
#
interface GigabitEthernet1/0/3
stp disable
undo ndp enable
undo lldp enable
port service-loopback group 1
#
interface Tunnel0
ipv6 address 3001::1/64
tunnel-protocol ipv6-ipv4
source Vlan-interface100
destination 192.168.50.1
service-loopback-group 1
#
ipv6 route-static 3003:: 64 Tunnel0
#
· Switch B
#
ipv6
#
service-loopback group 1 type tunnel
#
vlan 100 to 101
#
interface Vlan-interface100
ip address 192.168.50.1 255.255.255.0
#
interface Vlan-interface101
ipv6 address 3003::1/64
#
interface GigabitEthernet1/0/3
stp disable
undo ndp enable
undo lldp enable
port service-loopback group 1
#
interface Tunnel0
ipv6 address 3001::2/64
tunnel-protocol ipv6-ipv4
source Vlan-interface100
destination 192.168.100.1
service-loopback-group 1
#
ipv6 route-static 3002:: 64 Tunnel0
#
表2 配置适用的产品与软件版本关系
产品 |
软件版本 |
S10500系列以太网交换机 |
Release 1120系列,Release 1130系列,Release 1200系列 |
S5800&S5820X系列以太网交换机 |
Release 1808 |
S5830系列以太网交换机 |
Release 1115,Release 1118 |
S5500-EI系列以太网交换机 |
Release 2220 |
如图2所示,Switch A和Switch B之间路由可达,两个6to4网络通过网络边缘6to4 switch(Switch A和Switch B)与IPv4网络相连,要求通过配置6to4隧道实现6to4网络中的主机Host A和Host B之间互通。
图2 6to4隧道典型配置组网图
配置Tunnel接口前,需要先创建业务类型为Tunnel的业务环回组,并将设备上未使用的二层以太网端口加入该业务环回组。
# 使能IPv6转发功能。
<SwitchA> system-view
[SwitchA] ipv6
# 配置接口Vlan-interface100的地址。
[SwitchA] interface vlan-interface 100
[SwitchA-Vlan-interface100] ip address 2.1.1.1 24
[SwitchA-Vlan-interface100] quit
# 配置接口Vlan-interface101的地址。
[SwitchA] interface vlan-interface 101
[SwitchA-Vlan-interface101] ipv6 address 2002:0201:0101:1::1/64
[SwitchA-Vlan-interface101] quit
# 配置6to4隧道。
[SwitchA] interface tunnel 0
[SwitchA-Tunnel0] ipv6 address 3001::1/64
[SwitchA-Tunnel0] source vlan-interface 100
[SwitchA-Tunnel0] tunnel-protocol ipv6-ipv4 6to4
[SwitchA-Tunnel0] quit
# 创建并配置业务环回组1,服务类型为tunnel。
[SwitchA] service-loopback group 1 type tunnel
# 将端口GigabitEthernet1/0/3加入业务环回组1,并在该端口上关闭STP、NDP和LLDP功能(S10500和S5830系列交换机不支持NDP,关闭NDP配置可省略)。
[SwitchA] interface GigabitEthernet 1/0/3
[SwitchA-GigabitEthernet1/0/3] undo stp enable
[SwitchA-GigabitEthernet1/0/3] undo ndp enable
[SwitchA-GigabitEthernet1/0/3] undo lldp enable
[SwitchA-GigabitEthernet1/0/3] port service-loopback group 1
[SwitchA-GigabitEthernet1/0/3] quit
# 在Tunnel接口视图下指定隧道引用的业务环回组1。
[SwitchA] interface tunnel 0
[SwitchA-Tunnel0] service-loopback-group 1
[SwitchA-Tunnel0] quit
# 配置到目的地址2002::/16,下一跳为Tunnel接口的静态路由。
[SwitchA] ipv6 route-static 2002:: 16 tunnel 0
# 使能IPv6转发功能。
<SwitchB> system-view
[SwitchB] ipv6
# 配置接口Vlan-interface100的地址。
[SwitchB] interface vlan-interface 100
[SwitchB-Vlan-interface100] ip address 5.1.1.1 24
[SwitchB-Vlan-interface100] quit
# 配置接口Vlan-interface101的地址。
[SwitchB] interface vlan-interface 101
[SwitchB-Vlan-interface101] ipv6 address 2002:0501:0101:1::1/64
[SwitchB-Vlan-interface101] quit
# 配置6to4隧道。
[SwitchB] interface tunnel 0
[SwitchB-Tunnel0] ipv6 address 3002::1/64
[SwitchB-Tunnel0] source vlan-interface 100
[SwitchB-Tunnel0] tunnel-protocol ipv6-ipv4 6to4
[SwitchB-Tunnel0] quit
# 创建并配置业务环回组1,服务类型为tunnel。
[SwitchB] service-loopback group 1 type tunnel
# 将端口GigabitEthernet1/0/3加入业务环回组1,并在该端口上关闭STP、NDP和LLDP功能(S10500和S5830系列交换机不支持NDP,关闭NDP配置可省略)。
[SwitchB] interface GigabitEthernet 1/0/3
[SwitchB-GigabitEthernet1/0/3] undo stp enable
[SwitchB-GigabitEthernet1/0/3] undo ndp enable
[SwitchB-GigabitEthernet1/0/3] undo lldp enable
[SwitchB-GigabitEthernet1/0/3] port service-loopback group 1
[SwitchB-GigabitEthernet1/0/3] quit
# 在Tunnel接口视图下指定隧道引用的业务环回组1。
[SwitchB] interface tunnel 0
[SwitchB-Tunnel0] service-loopback-group 1
[SwitchB-Tunnel0] quit
# 配置到目的地址2002::/16,下一跳为Tunnel接口的静态路由。
[SwitchB] ipv6 route-static 2002:: 16 tunnel 0
# 完成以上配置之后,Host A与Host B可以互相Ping通。
D:\>ping6 -s 2002:201:101:1::2 2002:501:101:1::2
Pinging 2002:501:101:1::2
from 2002:201:101:1::2 with 32 bytes of data:
Reply from 2002:501:101:1::2: bytes=32 time=13ms
Reply from 2002:501:101:1::2: bytes=32 time=1ms
Reply from 2002:501:101:1::2: bytes=32 time=1ms
Reply from 2002:501:101:1::2: bytes=32 time<1ms
Ping statistics for 2002:501:101:1::2:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 13ms, Average = 3ms
· Switch A
#
ipv6
#
service-loopback group 1 type tunnel
#
vlan 2
#
vlan 100 to 101
#
interface Vlan-interface100
ip address 2.1.1.1 255.255.255.0
#
interface Vlan-interface101
ipv6 address 2002:201:101:1::1/64
#
interface GigabitEthernet1/0/3
stp disable
undo ndp enable
undo lldp enable
port service-loopback group 1
#
interface Tunnel0
ipv6 address 3001::1/64
tunnel-protocol ipv6-ipv4 6to4
source Vlan-interface100
service-loopback-group 1
#
ipv6 route-static 2002:: 16 Tunnel0
#
· Switch B
#
ipv6
#
service-loopback group 1 type tunnel
#
vlan 2
#
vlan 100 to 101
#
interface Vlan-interface100
ip address 5.1.1.1 255.255.255.0
#
interface Vlan-interface101
ipv6 address 2002:0501:0101:1::1/64
#
interface GigabitEthernet1/0/3
stp disable
undo ndp enable
undo lldp enable
port service-loopback group 1
#
interface Tunnel0
ipv6 address 3002::1/64
tunnel-protocol ipv6-ipv4 6to4
source Vlan-interface100
service-loopback-group 1
#
ipv6 route-static 2002:: 16 Tunnel0
#
表3 配置适用的产品与软件版本关系
产品 |
软件版本 |
S10500系列以太网交换机 |
Release 1120系列,Release 1130系列,Release 1200系列 |
S5800&S5820X系列以太网交换机 |
Release 1808 |
S5830系列以太网交换机 |
Release 1115,Release 1118 |
S5500-EI系列以太网交换机 |
Release 2220 |
如图3所示,IPv6网络和IPv4网络通过ISATAP交换机相连,在IPv4网络侧分布着一些ISATAP主机,要求通过配置ISATAP隧道实现IPv4网络中的ISATAP主机能够访问IPv6网络。
图3 ISATAP隧道典型配置组网图
配置Tunnel接口前,需要先创建业务类型为Tunnel的业务环回组,并将设备上未使用的二层以太网端口加入该业务环回组。
# 使能IPv6转发功能。
<Switch> system-view
[Switch] ipv6
# 配置各接口地址。
[Switch] interface vlan-interface 100
[Switch-Vlan-interface100] ipv6 address 3001::1/64
[Switch-Vlan-interface100] quit
[Switch] interface vlan-interface 101
[Switch-Vlan-interface101] ip address 1.1.1.1 255.0.0.0
[Switch-Vlan-interface101] quit
# 配置ISATAP隧道。
[Switch] interface tunnel 0
[Switch-Tunnel0] ipv6 address 2001::/64 eui-64
[Switch-Tunnel0] source vlan-interface 101
[Switch-Tunnel0] tunnel-protocol ipv6-ipv4 isatap
# 取消对RA消息发布的抑制,使主机可以通过交换机发布的RA消息获取地址前缀等信息。
[Switch-Tunnel0] undo ipv6 nd ra halt
[Switch-Tunnel0] quit
# 创建并配置业务环回组1,服务类型为tunnel。
[Switch] service-loopback group 1 type tunnel
# 将接口GigabitEthernet1/0/3加入业务环回组1,并在该端口上关闭STP、NDP和LLDP功能(S10500和S5830系列交换机不支持NDP,关闭NDP配置可省略)。
[Switch] interface GigabitEthernet 1/0/3
[Switch-GigabitEthernet1/0/3] undo stp enable
[Switch-GigabitEthernet1/0/3] undo ndp enable
[Switch-GigabitEthernet1/0/3] undo lldp enable
[Switch-GigabitEthernet1/0/3] port service-loopback group 1
[Switch-GigabitEthernet1/0/3] quit
# 在Tunnel接口视图下指定隧道引用的业务环回组1。
[Switch] interface tunnel 0
[Switch-Tunnel0] service-loopback-group 1
[Switch-Tunnel0] quit
ISATAP主机上的具体配置与主机的操作系统有关,下面仅以Windows XP操作系统为例进行说明。
# 在主机上安装IPv6协议。
C:\>ipv6 install
# 在Windows XP上,ISATAP接口通常为接口2,查看ISATAP接口的信息:
C:\>ipv6 if 2
Interface 2: Automatic Tunneling Pseudo-Interface
Guid {48FCE3FC-EC30-E50E-F1A7-71172AEEE3AE}
does not use Neighbor Discovery
does not use Router Discovery
routing preference 1
EUI-64 embedded IPv4 address: 0.0.0.0
router link-layer address: 0.0.0.0
preferred link-local fe80::5efe:2.1.1.2, life infinite
link MTU 1280 (true link MTU 65515)
current hop limit 128
reachable time 42500ms (base 30000ms)
retransmission interval 1000ms
DAD transmits 0
default site prefix length 48
# 配置到ISATAP交换机的路由:
C:\>netsh interface ipv6 isatap set router 1.1.1.1
# 查看ISATAP接口的信息:
C:\>ipv6 if 2
Interface 2: Automatic Tunneling Pseudo-Interface
Guid {48FCE3FC-EC30-E50E-F1A7-71172AEEE3AE}
does not use Neighbor Discovery
uses Router Discovery
routing preference 1
EUI-64 embedded IPv4 address: 2.1.1.2
router link-layer address: 1.1.1.1
preferred global 2001::5efe:2.1.1.2, life 29d23h59m46s/6d23h59m46s (public)
preferred link-local fe80::5efe:2.1.1.2, life infinite
link MTU 1500 (true link MTU 65515)
current hop limit 255
reachable time 42500ms (base 30000ms)
retransmission interval 1000ms
DAD transmits 0
default site prefix length 48
# 在ISATAP主机上ping ISATAP交换机上隧道接口的IPv6地址,可以ping通,表明ISATAP隧道已经成功建立。
C:\>ping 2001::5efe:1.1.1.1
Pinging 2001::5efe:1.1.1.1 with 32 bytes of data:
Reply from 2001::5efe:1.1.1.1: time=1ms
Reply from 2001::5efe:1.1.1.1: time=1ms
Reply from 2001::5efe:1.1.1.1: time=1ms
Reply from 2001::5efe:1.1.1.1: time=1ms
Ping statistics for 2001::5efe:1.1.1.1:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 1ms, Maximum = 1ms, Average = 1ms
# 在ISATAP主机上ping IPv6网络中的主机地址,可以ping通。
C:\>ping 3002::2
Pinging 3002::2 with 32 bytes of data:
Reply from 3002::2: time=4ms
Reply from 3002::2: time=1ms
Reply from 3002::2: time=1ms
Reply from 3002::2: time=1ms
Ping statistics for 3002::2:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 1ms, Maximum = 4ms, Average = 1ms
#
ipv6
#
service-loopback group 1 type tunnel
#
vlan 100 to 101
#
interface Vlan-interface100
ipv6 address 3001::1/64
#
interface Vlan-interface101
ip address 1.1.1.1 255.0.0.0
#
interface GigabitEthernet1/0/3
stp disable
undo ndp enable
undo lldp enable
port service-loopback group 1
#
interface Tunnel0
ipv6 address 2001::/64 eui-64
undo ipv6 nd ra halt
tunnel-protocol ipv6-ipv4 isatap
source Vlan-interface101
service-loopback-group 1
#
表4 配置适用的产品与软件版本关系
产品 |
软件版本 |
S10500系列以太网交换机 |
Release 1120系列,Release 1130系列,Release 1200系列 |
S5800&S5820X系列以太网交换机 |
Release 1808 |
S5830系列以太网交换机 |
Release 1115,Release 1118 |
如图4所示,Switch A和Switch B之间路由可达,两台交换机下各连接一个子网,且这两个子网都采用私网地址。要求通过配置IPv4 over IPv4隧道实现子网内的主机通过私网地址相互通信。
图4 IPv4 over IPv4隧道典型配置组网图
配置Tunnel接口前,需要先创建业务类型为Tunnel的业务环回组,并将设备上未使用的二层以太网端口加入该业务环回组。
# 配置接口Vlan-interface100。
<SwitchA> system-view
[SwitchA] interface vlan-interface 100
[SwitchA-Vlan-interface100] ip address 10.1.1.1 255.255.255.0
[SwitchA-Vlan-interface100] quit
# 配置接口Vlan-interface101。
[SwitchA] interface vlan-interface 101
[SwitchA-Vlan-interface101] ip address 2.1.1.1 255.255.255.0
[SwitchA-Vlan-interface101] quit
# 创建Tunnel0接口。
[SwitchA] interface tunnel 0
# 配置Tunnel0接口的IP地址。
[SwitchA-Tunnel0] ip address 10.1.2.1 255.255.255.0
# 配置Tunnel封装模式。
[SwitchA-Tunnel0] tunnel-protocol ipv4-ipv4
# 配置Tunnel0接口的源地址(Vlan-interface101的IP地址)。
[SwitchA-Tunnel0] source 2.1.1.1
# 配置Tunnel0接口的目的地址(Switch B的Vlan-interface101的IP地址)。
[SwitchA-Tunnel0] destination 3.1.1.1
[SwitchA-Tunnel0] quit
# 创建并配置业务环回组1,服务类型为tunnel。
[SwitchA] service-loopback group 1 type tunnel
# 将接口GigabitEthernet1/0/3加入业务环回组1,并在该端口上关闭STP、NDP和LLDP功能(S10500和S5830系列交换机不支持NDP,关闭NDP配置可省略)。
[SwitchA] interface GigabitEthernet 1/0/3
[SwitchA-GigabitEthernet1/0/3] undo stp enable
[SwitchA-GigabitEthernet1/0/3] undo ndp enable
[SwitchA-GigabitEthernet1/0/3] undo lldp enable
[SwitchA-GigabitEthernet1/0/3] port service-loopback group 1
[SwitchA-GigabitEthernet1/0/3] quit
# 在Tunnel接口视图下指定隧道引用的业务环回组1。
[SwitchA] interface tunnel 0
[SwitchA-Tunnel0] service-loopback-group 1
[SwitchA-Tunnel0] quit
# 配置从Switch A经过Tunnel0接口到Group 2的静态路由。
[SwitchA] ip route-static 10.1.3.0 255.255.255.0 tunnel 0
# 配置接口Vlan-interface100。
<SwitchB> system-view
[SwitchB] interface vlan-interface 100
[SwitchB-Vlan-interface100] ip address 10.1.3.1 255.255.255.0
[SwitchB-Vlan-interface100] quit
# 配置接口Vlan-interface101。
[SwitchB] interface vlan-interface 101
[SwitchB-Vlan-interface101] ip address 3.1.1.1 255.255.255.0
[SwitchB-Vlan-interface101] quit
# 创建Tunnel0接口。
[SwitchB] interface tunnel 0
# 配置Tunnel0接口的IP地址。
[SwitchB-Tunnel0] ip address 10.1.2.2 255.255.255.0
# 配置Tunnel封装模式。
[SwitchB-Tunnel0] tunnel-protocol ipv4-ipv4
# 配置Tunnel0接口的源地址(Vlan-interface101的IP地址)。
[SwitchB-Tunnel0] source 3.1.1.1
# 配置Tunnel0接口的目的地址(SwitchA的Vlan-interface101的IP地址)。
[SwitchB-Tunnel0] destination 2.1.1.1
[SwitchB-Tunnel0] quit
# 创建并配置业务环回组1,服务类型为tunnel。
[SwitchB] service-loopback group 1 type tunnel
# 将接口GigabitEthernet1/0/3加入业务环回组1,并在该端口上关闭STP、NDP和LLDP功能(S10500和S5830系列交换机不支持NDP,关闭NDP配置可省略)。
[SwitchB] interface GigabitEthernet 1/0/3
[SwitchB-GigabitEthernet1/0/3] undo stp enable
[SwitchB-GigabitEthernet1/0/3] undo ndp enable
[SwitchB-GigabitEthernet1/0/3] undo lldp enable
[SwitchB-GigabitEthernet1/0/3] port service-loopback group 1
[SwitchB-GigabitEthernet1/0/3] quit
# 在Tunnel接口视图下指定隧道引用的业务环回组1。
[SwitchB] interface tunnel 0
[SwitchB-Tunnel0] service-loopback-group 1
[SwitchB-Tunnel0] quit
# 配置从Switch B经过Tunnel0接口到Group 1的静态路由。
[SwitchB] ip route-static 10.1.1.0 255.255.255.0 tunnel 0
# 完成以上配置之后,分别察看Switch A和Switch B的Tunnel接口状态如下:
<SwitchA> display interface tunnel 0
Tunnel0 current state: UP
Line protocol current state: UP
Description: Tunnel0 Interface
The Maximum Transmit Unit is 1480
Internet Address is 10.1.2.1/24 Primary
Encapsulation is TUNNEL, service-loopback-group ID is 1
Tunnel source 2.1.1.1, destination 3.1.1.1
Tunnel protocol/transport IP/IP
Last clearing of counters: Never
Last 300 seconds input: 0 bytes/sec, 0 packets/sec
Last 300 seconds output: 2 bytes/sec, 0 packets/sec
4 packets input, 256 bytes
0 input error
12 packets output, 768 bytes
0 output error
<SwitchB> display interface tunnel 0
Tunnel0 current state: UP
Line protocol current state: UP
Description: Tunnel0 Interface
The Maximum Transmit Unit is 1480
Internet Address is 10.1.2.2/24 Primary
Encapsulation is TUNNEL, service-loopback-group ID is 1
Tunnel source 3.1.1.1, destination 2.1.1.1
Tunnel protocol/transport IP/IP
Last clearing of counters: Never
Last 300 seconds input: 0 bytes/sec, 0 packets/sec
Last 300 seconds output: 0 bytes/sec, 0 packets/sec
5 packets input, 320 bytes
0 input error
9 packets output, 576 bytes
0 output error
# 从Switch A可以Ping通对端的Vlan-interface100接口的IPv4地址:
[SwitchA] ping 10.1.3.1
PING 10.1.3.1: 56 data bytes, press CTRL_C to break
Reply from 10.1.3.1: bytes=56 Sequence=0 ttl=255 time=15 ms
Reply from 10.1.3.1: bytes=56 Sequence=1 ttl=255 time=15 ms
Reply from 10.1.3.1: bytes=56 Sequence=2 ttl=255 time=16 ms
Reply from 10.1.3.1: bytes=56 Sequence=3 ttl=255 time=16 ms
Reply from 10.1.3.1: bytes=56 Sequence=4 ttl=255 time=15 ms
--- 10.1.3.1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 15/15/16 ms
· SwitchA
#
service-loopback group 1 type tunnel
#
vlan 100 to 101
#
interface Vlan-interface100
ip address 10.1.1.1 255.255.255.0
#
interface Vlan-interface101
ip address 2.1.1.1 255.255.255.0
#
interface GigabitEthernet1/0/3
stp disable
undo ndp enable
undo lldp enable
port service-loopback group 1
#
interface Tunnel0
ip address 10.1.2.1 255.255.255.0
tunnel-protocol ipv4-ipv4
source 2.1.1.1
destination 3.1.1.1
service-loopback-group 1
#
ip route-static 10.1.3.0 255.255.255.0 Tunnel0
#
· SwitchB
#
service-loopback group 1 type tunnel
#
vlan 100 to 101
#
interface Vlan-interface100
ip address 10.1.3.1 255.255.255.0
#
interface Vlan-interface101
ip address 3.1.1.1 255.255.255.0
#
interface GigabitEthernet1/0/3
stp disable
undo ndp enable
undo lldp enable
port service-loopback group 1
#
interface Tunnel0
ip address 10.1.2.2 255.255.255.0
tunnel-protocol ipv4-ipv4
source 3.1.1.1
destination 2.1.1.1
service-loopback-group 1
#
ip route-static 10.1.1.0 255.255.255.0 Tunnel0
#
表5 配置适用的产品与软件版本关系
产品 |
软件版本 |
S10500系列以太网交换机 |
Release 1120系列,Release 1130系列,Release 1200系列 |
S5800&S5820X系列以太网交换机 |
Release 1808 |
S5830系列以太网交换机 |
Release 1115,Release 1118 |
如图5所示,Switch A和Switch B之间路由可达,两台交换机下各连接一个IPv4网络孤岛,要求通过配置IPv4 over IPv6隧道实现两个IPv4网络的互通。
图5 IPv4 over IPv6隧道典型配置组网图
配置Tunnel接口前,需要先创建业务类型为Tunnel的业务环回组,并将设备上未使用的二层以太网端口加入该业务环回组。
# 使能IPv6转发功能。
<SwitchA> system-view
[SwitchA] ipv6
# 配置接口Vlan-interface100。
[SwitchA] interface vlan-interface 100
[SwitchA-Vlan-interface100] ip address 30.1.1.1 255.255.255.0
[SwitchA-Vlan-interface100] quit
# 配置接口Vlan-interface101。
[SwitchA] interface vlan-interface 101
[SwitchA-Vlan-interface101] ipv6 address 2001::1:1 64
[SwitchA-Vlan-interface101] quit
# 创建Tunnel0接口。
[SwitchA] interface tunnel 0
# 配置Tunnel0接口的IP地址。
[SwitchA-Tunnel0] ip address 30.1.2.1 255.255.255.0
# 配置Tunnel封装模式。
[SwitchA-Tunnel0] tunnel-protocol ipv4-ipv6
# 配置Tunnel0接口的源地址(Vlan-interface101的IP地址)。
[SwitchA-Tunnel0] source 2001::1:1
# 配置Tunnel0接口的目的地址(Switch B的Vlan-interface101的IP地址)。
[SwitchA-Tunnel0] destination 2002::2:1
[SwitchA-Tunnel0] quit
# 创建并配置业务环回组1,服务类型为tunnel。
[SwitchA] service-loopback group 1 type tunnel
# 将接口GigabitEthernet1/0/3加入业务环回组1,并在该端口上关闭STP、NDP和LLDP功能(S10500和S5830系列交换机不支持NDP,关闭NDP配置可省略)。
[SwitchA] interface GigabitEthernet 1/0/3
[SwitchA-GigabitEthernet1/0/3] undo stp enable
[SwitchA-GigabitEthernet1/0/3] undo ndp enable
[SwitchA-GigabitEthernet1/0/3] undo lldp enable
[SwitchA-GigabitEthernet1/0/3] port service-loopback group 1
[SwitchA-GigabitEthernet1/0/3] quit
# 在Tunnel接口视图下指定隧道引用的业务环回组1。
[SwitchA] interface tunnel 0
[SwitchA-Tunnel0] service-loopback-group 1
[SwitchA-Tunnel0] quit
# 配置从Switch A经过Tunnel0接口到Group 2的静态路由。
[SwitchA] ip route-static 30.1.3.0 255.255.255.0 tunnel 0
# 使能IPv6转发功能。
<SwitchB> system-view
[SwitchB] ipv6
# 配置接口Vlan-interface100。
[SwitchB] interface vlan-interface 100
[SwitchB-Vlan-interface100] ip address 30.1.3.1 255.255.255.0
[SwitchB-Vlan-interface100] quit
# 配置接口Vlan-interface101。
[SwitchB] interface vlan-interface 101
[SwitchB-Vlan-interface101] ipv6 address 2002::2:1 64
[SwitchB-Vlan-interface101] quit
# 创建Tunnel0接口。
[SwitchB] interface tunnel 0
# 配置Tunnel0接口的IP地址。
[SwitchB-Tunnel0] ip address 30.1.2.2 255.255.255.0
# 配置Tunnel封装模式。
[SwitchB-Tunnel0] tunnel-protocol ipv4-ipv6
# 配置Tunnel0接口的源地址(Vlan-interface101的IP地址)。
[SwitchB-Tunnel0] source 2002::2:1
# 配置Tunnel0接口的目的地址(Switch A的Vlan-interface101的IP地址)。
[SwitchB-Tunnel0] destination 2001::1:1
[SwitchB-Tunnel0] quit
# 创建并配置业务环回组1,服务类型为tunnel。
[SwitchB] service-loopback group 1 type tunnel
# 将接口GigabitEthernet1/0/3加入业务环回组1,并在该端口上关闭STP、NDP和LLDP功能(S10500和S5830系列交换机不支持NDP,关闭NDP配置可省略)。
[SwitchB] interface GigabitEthernet 1/0/3
[SwitchB-GigabitEthernet1/0/3] undo stp enable
[SwitchB-GigabitEthernet1/0/3] undo ndp enable
[SwitchB-GigabitEthernet1/0/3] undo lldp enable
[SwitchB-GigabitEthernet1/0/3] port service-loopback group 1
[SwitchB-GigabitEthernet1/0/3] quit
# 在Tunnel接口视图下指定隧道引用的业务环回组1。
[SwitchB] interface tunnel 0
[SwitchB-Tunnel0] service-loopback-group 1
[SwitchB-Tunnel0] quit
# 配置从Switch B经过Tunnel0接口到Group 1的静态路由。
[SwitchB] ip route-static 30.1.1.0 255.255.255.0 tunnel 0
# 完成以上配置之后,分别查看Switch A和Switch B的Tunnel接口状态如下:
<SwitchA> display interface tunnel 0
Tunnel0 current state: UP
Line protocol current state: UP
Description: Tunnel0 Interface
The Maximum Transmit Unit is 1460
Internet Address is 30.1.2.1/24 Primary
Encapsulation is TUNNEL, service-loopback-group ID is 1
Tunnel source 2001::1:1, destination 2002::2:1
Tunnel protocol/transport IP/IPv6
Last clearing of counters: Never
Last 300 seconds input: 0 bytes/sec, 0 packets/sec
Last 300 seconds output: 0 bytes/sec, 0 packets/sec
152 packets input, 9728 bytes
0 input error
168 packets output, 10752 bytes
0 output error
<SwitchB> display interface tunnel 0
Tunnel0 current state: UP
Line protocol current state: UP
Description: Tunnel0 Interface
The Maximum Transmit Unit is 1460
Internet Address is 30.1.2.2/24 Primary
Encapsulation is TUNNEL, service-loopback-group ID is 1
Tunnel source 2002::2:1, destination 2001::1:1
Tunnel protocol/transport IP/IPv6
Last clearing of counters: Never
Last 300 seconds input: 1 bytes/sec, 0 packets/sec
Last 300 seconds output: 1 bytes/sec, 0 packets/sec
167 packets input, 10688 bytes
0 input error
170 packets output, 10880 bytes
0 output error
# 从Switch A可以Ping通对端的Vlan-interface100接口的IPv4地址:
[SwitchA] ping 30.1.3.1
PING 30.1.3.1: 56 data bytes, press CTRL_C to break
Reply from 30.1.3.1: bytes=56 Sequence=0 ttl=255 time=46 ms
Reply from 30.1.3.1: bytes=56 Sequence=1 ttl=255 time=15 ms
Reply from 30.1.3.1: bytes=56 Sequence=2 ttl=255 time=16 ms
Reply from 30.1.3.1: bytes=56 Sequence=3 ttl=255 time=15 ms
Reply from 30.1.3.1: bytes=56 Sequence=4 ttl=255 time=16 ms
--- 30.1.3.1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 15/21/46 ms
· SwitchA
#
ipv6
#
service-loopback group 1 type tunnel
#
vlan 100 to 101
#
interface Vlan-interface100
ip address 30.1.1.1 255.255.255.0
#
interface Vlan-interface101
ipv6 address 2001::1:1/64
#
interface GigabitEthernet1/0/3
stp disable
undo ndp enable
undo lldp enable
port service-loopback group 1
#
interface Tunnel0
ip address 30.1.2.1 255.255.255.0
tunnel-protocol ipv4-ipv6
source 2001::1:1
destination 2002::2:1
service-loopback-group 1
#
ip route-static 30.1.3.0 255.255.255.0 Tunnel0
#
· SwitchB
#
ipv6
#
service-loopback group 1 type tunnel
#
vlan 100 to 101
#
interface Vlan-interface100
ip address 30.1.3.1 255.255.255.0
#
interface Vlan-interface101
ipv6 address 2002::2:1/64
#
interface GigabitEthernet1/0/3
stp disable
undo ndp enable
undo lldp enable
port service-loopback group 1
#
interface Tunnel0
ip address 30.1.2.2 255.255.255.0
tunnel-protocol ipv4-ipv6
source 2002::2:1
destination 2001::1:1
service-loopback-group 1
#
ip route-static 30.1.1.0 255.255.255.0 Tunnel0
#
表6 配置适用的产品与软件版本关系
产品 |
软件版本 |
S10500系列以太网交换机 |
Release 1120系列,Release 1130系列,Release 1200系列 |
S5800&S5820X系列以太网交换机 |
Release 1808 |
S5830系列以太网交换机 |
Release 1115,Release 1118 |
如图6所示,Switch A和Switch B之间路由可达,两台交换机下各连接一个IPv6 Group,要求通过配置IPv6 over IPv6隧道实现IPv6网络不能学习到IPv6 Group1 和IPv6 Group 2内的网络地址,但IPv6 Group1 和IPv6 Group2可以互通。
图6 IPv6 over IPv6隧道典型配置组网图
配置Tunnel接口前,需要先创建业务类型为Tunnel的业务环回组,并将设备上未使用的二层以太网端口加入该业务环回组。
# 使能IPv6转发功能。
<SwitchA> system-view
[SwitchA] ipv6
# 配置接口Vlan-interface100。
[SwitchA] interface vlan-interface 100
[SwitchA-Vlan-interface100] ipv6 address 2002:1::1 64
[SwitchA-Vlan-interface100] quit
# 配置接口Vlan-interface101。
[SwitchA] interface vlan-interface 101
[SwitchA-Vlan-interface101] ipv6 address 2001::11:1 64
[SwitchA-Vlan-interface101] quit
# 创建Tunnel0接口。
[SwitchA] interface tunnel 0
# 配置Tunnel0接口的IP地址。
[SwitchA-Tunnel0] ipv6 address 3001::1:1 64
# 配置Tunnel封装模式。
[SwitchA-Tunnel0] tunnel-protocol ipv6-ipv6
# 配置Tunnel0接口的源地址(Vlan-interface101的IP地址)。
[SwitchA-Tunnel0] source 2001::11:1
# 配置Tunnel0接口的目的地址(Switch B的Vlan-interface101的IP地址)。
[SwitchA-Tunnel0] destination 2002::22:1
[SwitchA-Tunnel0] quit
# 创建并配置业务环回组1,服务类型为tunnel。
[SwitchA] service-loopback group 1 type tunnel
# 将接口GigabitEthernet1/0/3加入业务环回组1,并在该端口上关闭STP、NDP和LLDP功能(S10500和S5830系列交换机不支持NDP,关闭NDP配置可省略)。
[SwitchA] interface GigabitEthernet 1/0/3
[SwitchA-GigabitEthernet1/0/3] undo stp enable
[SwitchA-GigabitEthernet1/0/3] undo ndp enable
[SwitchA-GigabitEthernet1/0/3] undo lldp enable
[SwitchA-GigabitEthernet1/0/3] port service-loopback group 1
[SwitchA-GigabitEthernet1/0/3] quit
# 在Tunnel接口视图下指定隧道引用的业务环回组1。
[SwitchA] interface tunnel 0
[SwitchA-Tunnel0] service-loopback-group 1
[SwitchA-Tunnel0] quit
# 配置从Switch A经过Tunnel0接口到Group 2的静态路由。
[SwitchA] ipv6 route-static 2002:3:: 64 tunnel 0
# 使能IPv6转发功能。
<SwitchB> system-view
[SwitchB] ipv6
# 配置接口Vlan-interface100。
[SwitchB] interface vlan-interface 100
[SwitchB-Vlan-interface100] ipv6 address 2002:3::1 64
[SwitchB-Vlan-interface100] quit
# 配置接口Vlan-interface101。
[SwitchB] interface vlan-interface 101
[SwitchB-Vlan-interface101] ipv6 address 2002::22:1 64
[SwitchB-Vlan-interface101] quit
# 创建Tunnel0接口。
[SwitchB] interface tunnel 0
# 配置Tunnel0接口的IP地址。
[SwitchB-Tunnel0] ipv6 address 3001::1:2 64
# 配置Tunnel封装模式。
[SwitchB-Tunnel0] tunnel-protocol ipv6-ipv6
# 配置Tunnel0接口的源地址(Vlan-interface101的IP地址)。
[SwitchB-Tunnel0] source 2002::22:1
# 配置Tunnel0接口的目的地址(Switch A的Vlan-interface101的IP地址)。
[SwitchB-Tunnel0] destination 2001::11:1
[SwitchB-Tunnel0] quit
# 创建并配置业务环回组1,服务类型为tunnel。
[SwitchB] service-loopback group 1 type tunnel
# 将接口GigabitEthernet1/0/3加入业务环回组1,并在该端口上关闭STP、NDP和LLDP功能(S10500和S5830系列交换机不支持NDP,关闭NDP配置可省略)。
[SwitchB] interface GigabitEthernet 1/0/3
[SwitchB-GigabitEthernet1/0/3] undo stp enable
[SwitchB-GigabitEthernet1/0/3] undo ndp enable
[SwitchB-GigabitEthernet1/0/3] undo lldp enable
[SwitchB-GigabitEthernet1/0/3] port service-loopback group 1
[SwitchB-GigabitEthernet1/0/3] quit
# 在Tunnel接口视图下指定隧道引用的业务环回组1。
[SwitchB] interface tunnel 0
[SwitchB-Tunnel0] service-loopback-group 1
[SwitchB-Tunnel0] quit
# 配置从Switch B经过Tunnel0接口到Group 1的静态路由。
[SwitchB] ipv6 route-static 2002:1:: 64 tunnel 0
# 完成以上配置之后,分别查看Switch A和Switch B的Tunnel接口状态如下:
<SwitchA> display ipv6 interface tunnel 0 verbose
Tunnel0 current state :UP
Line protocol current state :UP
IPv6 is enabled, link-local address is FE80::2013:1
Global unicast address(es):
3001::1:1, subnet is 3001::/64
Joined group address(es):
FF02::1:FF13:1
FF02::1:FF01:1
FF02::1:FF00:0
FF02::2
FF02::1
MTU is 1460 bytes
ND reachable time is 30000 milliseconds
ND retransmit interval is 1000 milliseconds
Hosts use stateless autoconfig for addresses
IPv6 Packet statistics:
……(略)
<SwitchB> display ipv6 interface tunnel 0 verbose
Tunnel0 current state :UP
Line protocol current state :UP
IPv6 is enabled, link-local address is FE80::2024:1
Global unicast address(es):
3001::1:2, subnet is 3001::/64
Joined group address(es):
FF02::1:FF24:1
FF02::1:FF01:2
FF02::1:FF00:0
FF02::2
FF02::1
MTU is 1460 bytes
ND reachable time is 30000 milliseconds
ND retransmit interval is 1000 milliseconds
Hosts use stateless autoconfig for addresses
IPv6 Packet statistics:
……(略)
# 从Switch A可以Ping通对端的Vlan-interface100接口的IPv6地址:
[SwitchA] ping ipv6 2002:3::1
PING 2002:3::1 : 56 data bytes, press CTRL_C to break
Reply from 2002:3::1
bytes=56 Sequence=1 hop limit=64 time = 31 ms
Reply from 2002:3::1
bytes=56 Sequence=2 hop limit=64 time = 1 ms
Reply from 2002:3::1
bytes=56 Sequence=3 hop limit=64 time = 16 ms
Reply from 2002:3::1
bytes=56 Sequence=4 hop limit=64 time = 16 ms
Reply from 2002:3::1
bytes=56 Sequence=5 hop limit=64 time = 31 ms
--- 2002:3::1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 1/19/31 ms
· SwitchA
#
ipv6
#
service-loopback group 1 type tunnel
#
vlan 100 to 101
#
interface Vlan-interface100
ipv6 address 2002:1::1/64
#
interface Vlan-interface101
ipv6 address 2001::11:1/64
#
interface GigabitEthernet1/0/3
stp disable
undo ndp enable
undo lldp enable
port service-loopback group 1
#
interface Tunnel0
ipv6 address 3001::1:1/64
tunnel-protocol ipv6-ipv6
source 2001::11:1
destination 2002::22:1
service-loopback-group 1
#
ipv6 route-static 2002:3:: 64 Tunnel0
#
· SwitchB
#
ipv6
#
service-loopback group 1 type tunnel
#
vlan 100 to 101
#
interface Vlan-interface100
ipv6 address 2002:3::1/64
#
interface Vlan-interface101
ipv6 address 2002::22:1/64
#
interface GigabitEthernet1/0/3
stp disable
undo ndp enable
undo lldp enable
port service-loopback group 1
#
interface Tunnel0
ipv6 address 3001::1:2/64
tunnel-protocol ipv6-ipv6
source 2002::2:1
destination 2001::11:1
service-loopback-group 1
#
ipv6 route-static 2002:1:: 64 Tunnel0
#
表7 配置适用的产品与软件版本关系
产品 |
软件版本 |
S10500系列以太网交换机 |
Release 1120系列,Release 1130系列,Release 1200系列 |
S5800&S5820X系列以太网交换机 |
Release 1808 |
S5830系列以太网交换机 |
Release 1115,Release 1118 |
如图7所示,Switch A和Switch B之间路由可达,两台交换机下各连接一个运行IP协议的私有网络,要求通过配置GRE over IPv4隧道实现两个私有网络的互通。
图7 GRE over IPv4隧道典型配置组网图
配置Tunnel接口前,需要先创建业务类型为Tunnel的业务环回组,并将设备上未使用的二层以太网端口加入该业务环回组。
# 配置接口IP地址。
<SwitchA> system-view
[SwitchA] interface vlan-interface 100
[SwitchA-Vlan-interface100] ip address 10.1.1.1 255.255.255.0
[SwitchA-Vlan-interface100] quit
[SwitchA] interface vlan-interface 101
[SwitchA-Vlan-interface101] ip address 1.1.1.1 255.255.255.0
[SwitchA-Vlan-interface101] quit
# 创建Tunnel1接口。
[SwitchA] interface tunnel 1
# 配置Tunnel1接口的IP地址。
[SwitchA-Tunnel1] ip address 10.1.2.1 255.255.255.0
# 配置Tunnel封装模式。
[SwitchA-Tunnel1] tunnel-protocol gre
# 配置Tunnel1接口的源地址。
[SwitchA-Tunnel1] source vlan-interface 101
# 配置Tunnel1接口的目的地址。
[SwitchA-Tunnel1] destination 2.2.2.2
[SwitchA-Tunnel1] quit
# 创建并配置业务环回组1,服务类型为tunnel。
[SwitchA] service-loopback group 1 type tunnel
# 将接口GigabitEthernet1/0/3加入业务环回组1,并在该端口上关闭STP、NDP和LLDP功能(S10500和S5830系列交换机不支持NDP,关闭NDP配置可省略)。
[SwitchA] interface GigabitEthernet 1/0/3
[SwitchA-GigabitEthernet1/0/3] undo stp enable
[SwitchA-GigabitEthernet1/0/3] undo ndp enable
[SwitchA-GigabitEthernet1/0/3] undo lldp enable
[SwitchA-GigabitEthernet1/0/3] port service-loopback group 1
[SwitchA-GigabitEthernet1/0/3] quit
# 在Tunnel接口视图下指定隧道引用的业务环回组1。
[SwitchA] interface tunnel 1
[SwitchA-Tunnel1] service-loopback-group 1
[SwitchA-Tunnel1] quit
# 配置从Switch A经过Tunnel1接口到Group 2的静态路由。
[SwitchA] ip route-static 10.1.3.0 255.255.255.0 tunnel 1
# 配置接口IP地址。
<SwitchB> system-view
[SwitchB] interface vlan-interface 100
[SwitchB-Vlan-interface100] ip address 10.1.3.1 255.255.255.0
[SwitchB-Vlan-interface100] quit
[SwitchB] interface vlan-interface 101
[SwitchB-Vlan-interface101] ip address 2.2.2.2 255.255.255.0
[SwitchB-Vlan-interface101] quit
# 创建Tunnel1接口。
[SwitchB] interface tunnel 1
# 配置Tunnel1接口的IP地址。
[SwitchB-Tunnel1] ip address 10.1.2.2 255.255.255.0
# 配置Tunnel封装模式。
[SwitchB-Tunnel1] tunnel-protocol gre
# 配置Tunnel1接口的源地址。
[SwitchB-Tunnel1] source vlan-interface 101
# 配置Tunnel1接口的目的地址。
[SwitchB-Tunnel1] destination 1.1.1.1
[SwitchB-Tunnel1] quit
# 创建并配置业务环回组1,服务类型为tunnel。
[SwitchB] service-loopback group 1 type tunnel
# 将接口GigabitEthernet1/0/3加入业务环回组1,并在该端口上关闭STP、NDP和LLDP功能(S10500和S5830系列交换机不支持NDP,关闭NDP配置可省略)。
[SwitchB] interface GigabitEthernet 1/0/3
[SwitchB-GigabitEthernet1/0/3] undo stp enable
[SwitchB-GigabitEthernet1/0/3] undo ndp enable
[SwitchB-GigabitEthernet1/0/3] undo lldp enable
[SwitchB-GigabitEthernet1/0/3] port service-loopback group 1
[SwitchB-GigabitEthernet1/0/3] quit
# 在Tunnel接口视图下指定隧道引用的业务环回组1。
[SwitchB] interface tunnel 1
[SwitchB-Tunnel1] service-loopback-group 1
[SwitchB-Tunnel1] quit
# 配置从Switch B经过Tunnel1接口到Group 1的静态路由。
[SwitchB] ip route-static 10.1.1.0 255.255.255.0 Tunnel 1
# 完成以上配置后,分别查看Switch A和Switch B的Tunnel接口状态。
[SwitchA] display interface tunnel 1
Tunnel1 current state: UP
Line protocol current state: UP
Description: Tunnel1 Interface
The Maximum Transmit Unit is 1476
Internet Address is 10.1.2.1/24 Primary
Encapsulation is TUNNEL, service-loopback-group ID is 1.
Tunnel source 1.1.1.1, destination 2.2.2.2
Tunnel bandwidth 64 (kbps)
Tunnel protocol/transport GRE/IP
GRE key disabled
Checksumming of GRE packets disabled
Last clearing of counters: Never
Last 300 seconds input: 0 bytes/sec, 0 packets/sec
Last 300 seconds output: 0 bytes/sec, 0 packets/sec
10 packets input, 840 bytes
0 input error
10 packets output, 840 bytes
0 output error
[SwitchB] display interface tunnel 1
Tunnel1 current state: UP
Line protocol current state: UP
Description: Tunnel1 Interface
The Maximum Transmit Unit is 1476
Internet Address is 10.1.2.2/24 Primary
Encapsulation is TUNNEL, service-loopback-group ID is 1.
Tunnel source 2.2.2.2, destination 1.1.1.1
Tunnel bandwidth 64 (kbps)
Tunnel protocol/transport GRE/IP
GRE key disabled
Checksumming of GRE packets disabled
Last clearing of counters: Never
Last 300 seconds input: 2 bytes/sec, 0 packets/sec
Last 300 seconds output: 2 bytes/sec, 0 packets/sec
10 packets input, 840 bytes
0 input error
10 packets output, 840 bytes
0 output error
# 从Switch B可以Ping通Switch A上VLAN接口100的地址。
[SwitchB] ping 10.1.1.1
PING 10.1.1.1: 56 data bytes, press CTRL_C to break
Reply from 10.1.1.1: bytes=56 Sequence=0 ttl=255 time=2 ms
Reply from 10.1.1.1: bytes=56 Sequence=1 ttl=255 time=2 ms
Reply from 10.1.1.1: bytes=56 Sequence=2 ttl=255 time=2 ms
Reply from 10.1.1.1: bytes=56 Sequence=3 ttl=255 time=2 ms
Reply from 10.1.1.1: bytes=56 Sequence=4 ttl=255 time=2 ms
--- 10.1.1.1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 2/2/2 ms
· SwitchA
#
service-loopback group 1 type tunnel
#
vlan 100 to 101
#
interface Vlan-interface100
ip address 10.1.1.1 255.255.255.0
#
interface Vlan-interface101
ip address 1.1.1.1 255.255.255.0
#
interface GigabitEthernet1/0/3
stp disable
undo ndp enable
undo lldp enable
port service-loopback group 1
#
interface Tunnel1
ip address 10.1.2.1 255.255.255.0
source Vlan-interface101
destination 2.2.2.2
service-loopback-group 1
#
ip route-static 10.1.3.0 255.255.255.0 Tunnel1
#
· Switch B
#
service-loopback group 1 type tunnel
#
vlan 100 to 101
#
interface Vlan-interface100
ip address 10.1.3.1 255.255.255.0
#
interface Vlan-interface101
ip address 2.2.2.2 255.255.255.0
#
interface GigabitEthernet1/0/3
stp disable
undo ndp enable
undo lldp enable
port service-loopback group 1
#
interface Tunnel1
ip address 10.1.2.2 255.255.255.0
source Vlan-interface101
destination 1.1.1.1
service-loopback-group 1
#
ip route-static 10.1.1.0 255.255.255.0 Tunnel1
#
表8 配置适用的产品与软件版本关系
产品 |
软件版本 |
S10500系列以太网交换机 |
Release 1120系列,Release 1130系列,Release 1200系列 |
S5800&S5820X系列以太网交换机 |
Release 1808 |
S5830系列以太网交换机 |
Release 1115,Release 1118 |
如图8所示,Switch A和Switch B之间路由可达,两台交换机下各连接一个IPv4网络孤岛,要求通过配置GRE over IPv6隧道实现两个IPv4网络的互通。
图8 GRE over IPv6隧道典型配置组网图
配置Tunnel接口前,需要先创建业务类型为Tunnel的业务环回组,并将设备上未使用的二层以太网端口加入该业务环回组。
# 使能IPv6。
<SwitchA> system-view
[SwitchA] ipv6
# 配置接口Vlan-interface100。
[SwitchA] vlan 100
[SwitchA] interface vlan-interface 100
[SwitchA-Vlan-interface100] ip address 10.1.1.1 255.255.255.0
[SwitchA-Vlan-interface100] quit
# 配置接口Vlan-interface101。
[SwitchA] vlan 101
[SwitchA] interface vlan-interface 101
[SwitchA-Vlan-interface101] ipv6 address 2002::1:1 64
[SwitchA-Vlan-interface101] quit
# 创建Tunnel0接口。
[SwitchA] interface tunnel 0
# 配置Tunnel0接口的IP地址。
[SwitchA-Tunnel0] ip address 10.1.2.1 255.255.255.0
# 配置Tunnel封装模式。
[SwitchA-Tunnel0] tunnel-protocol gre ipv6
# 配置Tunnel0接口的源地址(Vlan-interface101的IP地址)。
[SwitchA-Tunnel0] source 2002::1:1
# 配置Tunnel0接口的目的地址(Switch B的Vlan-interface101的IP地址)。
[SwitchA-Tunnel0] destination 2001::2:1
[SwitchA-Tunnel0] quit
# 创建并配置业务环回组1,服务类型为tunnel。
[SwitchA] service-loopback group 1 type tunnel
# 将接口GigabitEthernet1/0/3加入业务环回组1,并在该端口上关闭STP、NDP和LLDP功能(S10500和S5830系列交换机不支持NDP,关闭NDP配置可省略)。
[SwitchA] interface GigabitEthernet 1/0/3
[SwitchA-GigabitEthernet1/0/3] undo stp enable
[SwitchA-GigabitEthernet1/0/3] undo ndp enable
[SwitchA-GigabitEthernet1/0/3] undo lldp enable
[SwitchA-GigabitEthernet1/0/3] port service-loopback group 1
[SwitchA-GigabitEthernet1/0/3] quit
# 在Tunnel接口视图下指定隧道引用的业务环回组1。
[SwitchA] interface tunnel 0
[SwitchA-Tunnel0] service-loopback-group 1
[SwitchA-Tunnel0] quit
# 配置从Switch A经过Tunnel0接口到Group 2的静态路由。
[SwitchA] ip route-static 10.1.3.0 255.255.255.0 tunnel 0
# 使能IPv6。
<SwitchB> system-view
[SwitchB] ipv6
# 配置接口Vlan-interface100。
[SwitchB] vlan 100
[SwitchB] interface vlan-interface 100
[SwitchB-Vlan-interface100] ip address 10.1.3.1 255.255.255.0
[SwitchB-Vlan-interface100] quit
# 配置接口Vlan-interface101。
[SwitchB] vlan 101
[SwitchB] interface vlan-interface 101
[SwitchB-Vlan-interface101] ipv6 address 2001::2:1 64
[SwitchB-Vlan-interface101] quit
# 创建Tunnel0接口。
[SwitchB] interface tunnel 0
# 配置Tunnel0接口的IP地址。
[SwitchB-Tunnel0] ip address 10.1.2.2 255.255.255.0
# 配置Tunnel封装模式。
[SwitchB-Tunnel0] tunnel-protocol gre ipv6
# 配置Tunnel0接口的源地址(Vlan-interface101的IP地址)。
[SwitchB-Tunnel0] source 2001::2:1
# 配置Tunnel0接口的目的地址(Switch A的Vlan-interface101的IP地址)。
[SwitchB-Tunnel0] destination 2002::1:1
[SwitchB-Tunnel0] quit
# 创建并配置业务环回组1,服务类型为tunnel。
[SwitchB] service-loopback group 1 type tunnel
# 将接口GigabitEthernet1/0/3加入业务环回组1,并在该端口上关闭STP、NDP和LLDP功能(S10500和S5830系列交换机不支持NDP,关闭NDP配置可省略)。
[SwitchB] interface GigabitEthernet 1/0/3
[SwitchB-GigabitEthernet1/0/3] undo stp enable
[SwitchB-GigabitEthernet1/0/3] undo ndp enable
[SwitchB-GigabitEthernet1/0/3] undo lldp enable
[SwitchB-GigabitEthernet1/0/3] port service-loopback group 1
[SwitchB-GigabitEthernet1/0/3] quit
# 在Tunnel接口视图下指定隧道引用的业务环回组1。
[SwitchB] interface tunnel 0
[SwitchB-Tunnel0] service-loopback-group 1
[SwitchB-Tunnel0] quit
# 配置从Switch B经过Tunnel0接口到Group 1的静态路由。
[SwitchB] ip route-static 10.1.1.0 255.255.255.0 tunnel 0
# 完成以上配置后,分别查看Switch A和Switch B的Tunnel接口状态。
[SwitchA] display interface Tunnel 0
Tunnel0 current state: UP
Line protocol current state: UP
Description: Tunnel0 Interface
The Maximum Transmit Unit is 1456
Internet Address is 10.1.2.1/24 Primary
Encapsulation is TUNNEL, service-loopback-group ID is 1.
Tunnel source 2002::1:1, destination 2001::2:1
Tunnel protocol/transport GRE/IPv6
GRE key disabled
Checksumming of GRE packets disabled
Last clearing of counters: Never
Last 300 seconds input: 0 bytes/sec, 0 packets/sec
Last 300 seconds output: 0 bytes/sec, 0 packets/sec
10 packets input, 840 bytes
0 input error
10 packets output, 840 bytes
0 output error
[SwitchB] display interface Tunnel 0
Tunnel0 current state: UP
Line protocol current state: UP
Description: Tunnel0 Interface
The Maximum Transmit Unit is 1456
Internet Address is 10.1.2.2/24 Primary
Encapsulation is TUNNEL, service-loopback-group ID is 1.
Tunnel source 2001::2:1, destination 2002::1:1
Tunnel protocol/transport GRE/IPv6
GRE key disabled
Checksumming of GRE packets disabled
Last clearing of counters: Never
Last 300 seconds input: 0 bytes/sec, 0 packets/sec
Last 300 seconds output: 0 bytes/sec, 0 packets/sec
10 packets input, 840 bytes
0 input error
10 packets output, 840 bytes
0 output error
# 从Switch B可以Ping通Switch A上VLAN接口100的地址。
[SwitchB] ping 10.1.1.1
PING 10.1.1.1: 56 data bytes, press CTRL_C to break
Reply from 10.1.1.1: bytes=56 Sequence=0 ttl=255 time=3 ms
Reply from 10.1.1.1: bytes=56 Sequence=1 ttl=255 time=2 ms
Reply from 10.1.1.1: bytes=56 Sequence=2 ttl=255 time=2 ms
Reply from 10.1.1.1: bytes=56 Sequence=3 ttl=255 time=2 ms
Reply from 10.1.1.1: bytes=56 Sequence=4 ttl=255 time=3 ms
--- 10.1.1.1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 2/2/3 ms
· SwitchA
#
ipv6
#
service-loopback group 1 type tunnel
#
vlan 100 to 101
#
interface Vlan-interface100
ip address 10.1.1.1 255.255.255.0
#
interface Vlan-interface101
ipv6 address 2002::1:1/64
#
interface GigabitEthernet1/0/3
stp disable
undo ndp enable
undo lldp enable
port service-loopback group 1
#
interface Tunnel0
ip address 10.1.2.1 255.255.255.0
tunnel-protocol gre ipv6
source 2002::1:1
destination 2002::2:1
service-loopback-group 1
#
ip route-static 10.1.3.0 255.255.255.0 Tunnel0
#
· SwitchB
#
ipv6
#
service-loopback group 1 type tunnel
#
vlan 100 to 101
#
interface Vlan-interface100
ip address 10.1.3.1 255.255.255.0
#
interface Vlan-interface101
ipv6 address 2002::2:1/64
#
interface GigabitEthernet1/0/3
stp disable
undo ndp enable
undo lldp enable
port service-loopback group 1
#
interface Tunnel0
ip address 10.1.2.2 255.255.255.0
tunnel-protocol gre ipv6
source 2002::2:1
destination 2002::1:1
service-loopback-group 1
#
ip route-static 10.1.1.0 255.255.255.0 Tunnel0
#
不同款型规格的资料略有差异, 详细信息请向具体销售和400咨询。H3C保留在没有任何通知或提示的情况下对资料内容进行修改的权利!