IPv6 6to4隧道配置和验证实验

IPv6 6to4隧道配置和验证实验

【实验目的】

熟悉IPv6 6to4隧道的概念。

掌握IPv6和IPv4共存的实现方法。

掌握IPv6 6to4地址编址规则。

掌握IPv6 6to4隧道的配置。

验证配置。

【实验拓扑】

设备参数如下表所示。

设备

接口

IP地址

子网掩码

默认网关

R1

S0/0

192.168.12.1

24

N/A

Loopback 0

2000:F106:F208:1::1

64

N/A

R2

S0/0

192.168.12.2

24

N/A

Loopback 0

2000:F106:F208:2::1

64

N/A

实验步骤:

在 R1 上进行的配置:

  • 配置串口 S0/0 的IPv4地址为 192.168.12.1/24。
  • 配置 Loopback0 的IPv6地址为 2000:F106:F208:1::1/64。
  • 创建一个名为 Tunnel0 的隧道接口。
  • 为隧道接口配置IPv6地址为 2002:C0A8:C01::1/64。
  • 指定隧道的源接口为 S0/0。
  • 设置隧道模式为 ipv6ip 6to4。
  • 配置两个IPv6路由,将目标网络 2000:F106:F208:2::/64 路由到下一跳地址 2002:C0A8:C02::2,并将目标网络 2002::/16 路由到隧道接口 Tunnel0。

在 R2 上进行的配置:

  • 配置串口 S0/0 的IPv4地址为 192.168.12.2/24。
  • 配置 Loopback0 的IPv6地址为 2000:F106:F208:2::1/64。
  • 创建一个名为 Tunnel0 的隧道接口。
  • 为隧道接口配置IPv6地址为 2002:C0A8:C02::2/64。
  • 指定隧道的源接口为 S0/0。
  • 设置隧道模式为 ipv6ip 6to4。
  • 配置两个IPv6路由,将目标网络 2000:F106:F208:1::/64 路由到下一跳地址 2002:C0A8:C01::1,并将目标网络 2002::/16 路由到隧道接口 Tunnel0。

实验脚本:

//R1

interface Serial0/0

ip address 192.168.12.1 255.255.255.0

clock rate 2000000

interface Loopback0

no ip address

ipv6 address 2000:F106:F208:1::1/64

ipv6 enable



interface Tunnel0

ipv6 address 2002:C0A8:C01::1/64

ipv6 enable

tunnel source Serial0/0

tunnel mode ipv6ip 6to4



ipv6 route 2000:F106:F208:2::/64 2002:C0A8:C02::2

ipv6 route 2002::/16 Tunnel0

//R2

interface Serial0/0

ip address 192.168.12.2 255.255.255.0

clock rate 2000000

interface Loopback0

ipv6 address 2000:F106:F208:2::1/64

ipv6 enable

interface Tunnel0

ipv6 address 2002:C0A8:C02::2/64

ipv6 enable

tunnel source Serial0/0

tunnel mode ipv6ip 6to4



ipv6 route 2000:F106:F208:1::/64 2002:C0A8:C01::1

ipv6 route 2002::/16 Tunnel0

【实验调试】

  1. 查看隧道信息

R1#show interfaces tunnel 0

Tunnel0 is up, line protocol is up

  Hardware is Tunnel

  MTU 1514 bytes, BW 9 Kbit/sec, DLY 500000 usec,

     reliability 255/255, txload 1/255, rxload 1/255

  Encapsulation TUNNEL, loopback not set

  Keepalive not set

  Tunnel source 192.168.12.1 (Serial0/0), destination UNKNOWN

  Tunnel protocol/transport IPv6 6to4

  Fast tunneling enabled

  Tunnel transmit bandwidth 8000 (kbps)

  Tunnel receive bandwidth 8000 (kbps)

  Last input 00:17:48, output 00:17:48, output hang never

  Last clearing of "show interface" counters never

  Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0

  Queueing strategy: fifo

  Output queue: 0/0 (size/max)

  5 minute input rate 0 bits/sec, 0 packets/sec

  5 minute output rate 0 bits/sec, 0 packets/sec

     10 packets input, 1400 bytes, 0 no buffer

     Received 0 broadcasts, 0 runts, 0 giants, 0 throttles

     0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored, 0 abort

     27 packets output, 2832 bytes, 0 underruns

     0 output errors, 0 collisions, 0 interface resets

     0 unknown protocol drops

     0 output buffer failures, 0 output buffers swapped out

R1#

  1. Ping测试

R1#ping ipv6 2000:F106:F208:2::1

Type escape sequence to abort.

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

!!!!!

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

R1#

R2# ping ipv6 2000:F106:F208:1::1

Type escape sequence to abort.

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

!!!!!

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

R2#

【实验原理】

这个实验中使用的原理是IPv6 6to4隧道技术。

下面是这种技术的基本原理:

1.IPv6地址编址规则:

  • 6to4隧道使用了IPv4地址的一部分来生成IPv6地址。IPv4地址被转换为IPv6的前缀,形式为2002:IPv4地址::/48。
  • 例如,对于IPv4地址192.0.2.1,生成的IPv6前缀就是2002:c000:0201::/48。

2.隧道配置:

  • 在6to4隧道配置中,两个IPv6路由器通过IPv4网络进行通信。
  • 每个路由器都有一个公共的IPv4地址,这个地址被用作隧道的源地址。
  • 隧道的源接口是路由器连接到IPv4网络的接口。
  • 隧道接口的IPv6地址由生成的IPv6前缀和路由器的IPv4地址组成。

3.路由配置:

  • 路由器需要配置路由表,以将目标IPv6网络转发到隧道接口。
  • 在6to4隧道中,目标IPv6网络的前缀由目标IPv6地址的前缀部分确定。
  • 下一跳地址是隧道接口的IPv6地址。

4.通信验证:

  • 通过在两台路由器上进行ping测试,可以验证隧道配置的正确性。
  • 发送从一个路由器的IPv6地址到另一个路由器的IPv6地址的ping包,以测试两个路由器之间的IPv6通信是否正常。
  • 综上所述,IPv6 6to4隧道通过利用IPv4网络进行IPv6通信。它将IPv6数据包封装在IPv4数据包中,通过隧道在IPv4网络上传输,并在目的地路由器上解封装IPv6数据包,实现IPv6网络的扩展和互联。

注意:此实验可在GNS3或EVE-NG里面进行模拟配置。

猜你喜欢

转载自blog.csdn.net/m0_63624418/article/details/130993572