欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 教育 > 幼教 > 【思科】IPv6 过渡技术 - IPv6 in IPv4隧道

【思科】IPv6 过渡技术 - IPv6 in IPv4隧道

2024/10/24 9:25:07 来源:https://blog.csdn.net/2301_77161465/article/details/139873997  浏览:    关键词:【思科】IPv6 过渡技术 - IPv6 in IPv4隧道

【思科】IPv6 过渡技术 - IPv6 in IPv4隧道

  • 实验要求
  • 实现思路
  • IPv6 in IPv4 与 GRE 不同点
  • 注意点
  • 配置
    • R1
      • 基础配置
      • OSPFv3 局域网可达
    • R2
      • 基础配置
      • 局域网环境(OSPFv3):IPv6 网络
      • IPv6 in IPv4隧道
    • R3
    • R4
      • 基础配置
      • 局域网环境(OSPFv3):IPv6 网络
      • IPv6 in IPv4隧道
    • R5
      • 基础配置
      • OSPFv3 局域网可达
    • 检查
      • R1 的路由表
      • R5 的路由表
      • R1 Ping R5
  • 抓包分析
  • 配置文档
    • R1
    • R2
    • R3
    • R4
    • R5

在这里插入图片描述

实验要求

实验环境 : EVE

实验需求:
实现双方站点的IPv6网络 可以跨 IPv4 网络进行通信

实现思路

① IPv6网络用OSPFv3来实现互通
② IPv4网络用OSPF来实现互通
③ 使用IPv6 in IPv4隧道实现Pv6网络 可以跨 IPv4 网络进行通信

隧道可以在原有的IPv6头部,再加上Pv4头部,就可以帮助IPv6跨IPv4网络进行通信了

IPv6 in IPv4 与 GRE 不同点

GRE隧道的报文结构:IPv4 — GRE — IPv6
IPv6 in IPv4来说,它的报文结构发生了变化:IPv4 — IPv6

这个时候,我们可以观察到GRE的报文
Protocol协议字段:记录内层协议字段是什么

在IPv4头部中,我们可以看到,有个Protocol协议字段,里面指向了GRE
当找到了GRE这里,才说去再IPv6,这样子有点脱裤子放屁了
IPv4 → GRE → IPv6

那我就这样子,将IPv6的Protocol协议字段,直接指向IPv6头部:IPv4 → IPv6
那这样子就不会浪费空间了,大大的提高了传输效率
所以就有了IPv6 in IPv4

*GRE隧道*
在这里插入图片描述

注意点

OSPFv3 只能通过接口下宣告,不能使用Network!!!

配置

在这里插入图片描述

R1

基础配置

R1(config)#int e0/0
R1(config-if)#no shutdown
R1(config-if)#ipv6 address 2001:12::1/64
R1(config-if)#exitR1(config)#int loopback 1
R1(config-if)#ipv6 address 2000:1:1::1/64
R1(config-if)#exitR1(config)#int loopback 2
R1(config-if)#ipv6 address 2000:1:2::1/64
R1(config-if)#exitR1(config)#int loopback 3
R1(config-if)#ipv6 address 2000:1:3::1/64
R1(config-if)#exit===================================   查看接口IPv6地址 =================================
R1(config)#do show ipv6 int brief
Ethernet0/0            [up/up]FE80::A8BB:CCFF:FE00:10002001:12::1
Ethernet0/1            [administratively down/down]unassigned
Ethernet0/2            [administratively down/down]unassigned
Ethernet0/3            [administratively down/down]unassigned
Loopback1              [up/up]FE80::A8BB:CCFF:FE00:10002000:1:1::1
Loopback2              [up/up]FE80::A8BB:CCFF:FE00:10002000:1:2::1
Loopback3              [up/up]FE80::A8BB:CCFF:FE00:10002000:1:3::1

OSPFv3 局域网可达

## 记得要启用IPv6单播路由,才能去配置动态路由
R1(config)#ipv6 unicast-routing  ## 进入OSPFv3 IPv6 地址族,设置RID为 1.1.1.1
R1(config)#router ospfv3 1
R1(config-router)#address-family ipv6
R1(config-router-af)#router-id 1.1.1.1
R1(config-router-af)#exit
R1(config-router)#exit## 接口下宣告
R1(config)#int range e0/0,lo1,lo2,lo3
R1(config-if-range)#ospfv3 1 ipv6 area 0
R1(config-if-range)#exit

R2

基础配置

R2(config)#int e0/0
R2(config-if)#no shutdown 
R2(config-if)#ipv6 address 2001:12::2/64
R2(config-if)#exitR2(config)#int e0/1
R2(config-if)#no shutdown 
R2(config-if)#ip address 172.16.23.2 255.255.255.0 
R2(config-if)#exit

局域网环境(OSPFv3):IPv6 网络

## 需要开启IPv6单播功能
R2(config)#ipv6 unicast-routing ## 进入OSPFv3 IPv6 地址族,设置RID为 2.2.2.2
R2(config)#router ospfv3 1
R2(config-router)#address-family ipv6
R2(config-router-af)#router-id 2.2.2.2
R2(config-router-af)#exit## 接口下宣告
R2(config)#int range e0/0
R2(config-if-range)#ospfv3 1 ipv6 area 0
R2(config-if-range)#exit==============================   查看 R2 学到IPv6 路由条目  ============================
R2(config)#do show ipv6 route
IPv6 Routing Table - default - 6 entries
Codes: C - Connected, L - Local, S - Static, U - Per-user Static routeB - BGP, HA - Home Agent, MR - Mobile Router, R - RIPH - NHRP, I1 - ISIS L1, I2 - ISIS L2, IA - ISIS interareaIS - ISIS summary, D - EIGRP, EX - EIGRP external, NM - NEMOND - ND Default, NDp - ND Prefix, DCE - Destination, NDr - RedirectRL - RPL, O - OSPF Intra, OI - OSPF Inter, OE1 - OSPF ext 1OE2 - OSPF ext 2, ON1 - OSPF NSSA ext 1, ON2 - OSPF NSSA ext 2la - LISP alt, lr - LISP site-registrations, ld - LISP dyn-eidlA - LISP away, a - Application
O   2000:1:1::1/128 [110/10]via FE80::A8BB:CCFF:FE00:1000, Ethernet0/0
O   2000:1:2::1/128 [110/10]via FE80::A8BB:CCFF:FE00:1000, Ethernet0/0
O   2000:1:3::1/128 [110/10]via FE80::A8BB:CCFF:FE00:1000, Ethernet0/0
C   2001:12::/64 [0/0]via Ethernet0/0, directly connected
L   2001:12::2/128 [0/0]via Ethernet0/0, receive
L   FF00::/8 [0/0]via Null0, receive

IPv6 in IPv4隧道

## 目的:IPv4网络内部互通
R2(config)#router ospf 110
R2(config-router)#router-id 2.2.2.2
R2(config-router)#network 172.16.23.0 0.0.0.255 area 0
R2(config-router)#exit## 建立IPv6 in IPv4 隧道
R2(config)#int tunnel 24
R2(config-if)#tunnel mode ipv6ip            ## 把Tunnel隧道模式改为Ipv6 in Ipv4 模式
R2(config-if)#ipv6 address 2001:24::2/64    ## IPv6 接口地址
R2(config-if)#tunnel source e0/1
R2(config-if)#tunnel destination 172.16.34.4
R2(config-if)#ospfv3 1 ipv6 area 0          ## 将tunnel24 宣告进OSPFv3当中,从而达到双方内部可达
R2(config-if)#exit==================================   查看到接口状态   ====================================
R2(config)#do show ipv6 int br
Ethernet0/0            [up/up]FE80::A8BB:CCFF:FE00:20002001:12::2
Ethernet0/1            [up/up]unassigned
Ethernet0/2            [administratively down/down]unassigned
Ethernet0/3            [administratively down/down]unassigned
Tunnel24               [up/up]FE80::A8BB:CCFF:FE00:20002001:24::2==================================   此时查看到IPv6路由表   ====================================
## 可以看到我R2已经学习到R5内部的路由了R2(config)#do show ipv6 route
IPv6 Routing Table - default - 12 entries
Codes: C - Connected, L - Local, S - Static, U - Per-user Static routeB - BGP, HA - Home Agent, MR - Mobile Router, R - RIPH - NHRP, I1 - ISIS L1, I2 - ISIS L2, IA - ISIS interareaIS - ISIS summary, D - EIGRP, EX - EIGRP external, NM - NEMOND - ND Default, NDp - ND Prefix, DCE - Destination, NDr - RedirectRL - RPL, O - OSPF Intra, OI - OSPF Inter, OE1 - OSPF ext 1OE2 - OSPF ext 2, ON1 - OSPF NSSA ext 1, ON2 - OSPF NSSA ext 2la - LISP alt, lr - LISP site-registrations, ld - LISP dyn-eidlA - LISP away, a - Application
O   2000:1:1::1/128 [110/10]via FE80::A8BB:CCFF:FE00:1000, Ethernet0/0
O   2000:1:2::1/128 [110/10]via FE80::A8BB:CCFF:FE00:1000, Ethernet0/0
O   2000:1:3::1/128 [110/10]via FE80::A8BB:CCFF:FE00:1000, Ethernet0/0
==================================================
O   2000:5:1::1/128 [110/1010]via FE80::A8BB:CCFF:FE00:4000, Tunnel24
O   2000:5:2::1/128 [110/1010]via FE80::A8BB:CCFF:FE00:4000, Tunnel24
O   2000:5:3::1/128 [110/1010]via FE80::A8BB:CCFF:FE00:4000, Tunnel24
==================================================
C   2001:12::/64 [0/0]via Ethernet0/0, directly connected
L   2001:12::2/128 [0/0]via Ethernet0/0, receive
C   2001:24::/64 [0/0]via Tunnel24, directly connected
L   2001:24::2/128 [0/0]via Tunnel24, receive
O   2001:45::/64 [110/1010]via FE80::A8BB:CCFF:FE00:4000, Tunnel24
L   FF00::/8 [0/0]via Null0, receive
R2(config)#

R3

R3(config)#int e0/0
R3(config-if)#no shutdown 
R3(config-if)#ip address 172.16.23.3 255.255.255.0
R3(config-if)#exitR3(config)#int e0/1
R3(config-if)#no shutdown 
R3(config-if)#ip address 172.16.34.3 255.255.255.0
R3(config-if)#exitR3(config)#router ospf 110
R3(config-router)#router-id 3.3.3.3
R3(config-router)#network 172.16.0.0 0.0.255.255 area 0
R3(config-router)#exit

R4

基础配置

R4(config)#int e0/0
R4(config-if)#no shutdown 
R4(config-if)#ip address 172.16.34.4 255.255.255.0
R4(config-if)#exitR4(config)#int e0/1
R4(config-if)#no shutdown 
R4(config-if)#ipv6 address 2001:45::4/64
R4(config-if)#exit

局域网环境(OSPFv3):IPv6 网络

## 需要开启IPv6单播功能
R4(config)#ipv6 unicast-routing ## 进入OSPFv3 IPv6 地址族,设置RID为 4.4.4.4
R4(config)#router ospfv3 1
R4(config-router)#address-family ipv6
R4(config-router-af)#router-id 4.4.4.4
R4(config-router-af)#exit
R4(config-router)#exit## 接口下宣告
R4(config)#int e0/1
R4(config-if)#ospfv3 1 ipv6 area 0
R4(config-if)#exit

IPv6 in IPv4隧道

## 目的:IPv4网络内部互通
R4(config)#router ospf 110 
R4(config-router)#router-id 4.4.4.4
R4(config-router)#network 172.16.34.0 0.0.0.255 area 0
R4(config-router)#exit## 建立IPv6 in IPv4 隧道
R4(config)#int tunnel 24
R4(config-if)#tunnel mode ipv6ip            ## 把Tunnel隧道模式改为IPv6 in IPv4 模式
R4(config-if)#ipv6 address 2001:24::4/64    ## IPv6 地址
R4(config-if)#tunnel source e0/0
R4(config-if)#tunnel destination 172.16.23.2
R4(config-if)#ospfv3 1 ipv6 area 0          ## 将tunnel24 宣告进OSPFv3当中,从而达到双方站点IPv6网络可达
R4(config-if)#exit

R5

基础配置

R5(config)#int e0/0
R5(config-if)#no shutdown 
R5(config-if)#ipv6 address 2001:45::5/64
R5(config-if)#exitR5(config)#int loopback 1
R5(config-if)#ipv6 address 2000:5:1::1/64
R5(config-if)#exitR5(config)#int loopback 2
R5(config-if)#ipv6 address 2000:5:2::1/64
R5(config-if)#exitR5(config)#int loopback 3
R5(config-if)#ipv6 address 2000:5:3::1/64
R5(config-if)#exit===================================   查看接口IPv6地址 =================================
R5#show ipv6 int br
Ethernet0/0            [up/up]FE80::A8BB:CCFF:FE00:50002001:45::5
Ethernet0/1            [administratively down/down]unassigned
Ethernet0/2            [administratively down/down]unassigned
Ethernet0/3            [administratively down/down]unassigned
Loopback1              [up/up]FE80::A8BB:CCFF:FE00:50002000:5:1::1
Loopback2              [up/up]FE80::A8BB:CCFF:FE00:50002000:5:2::1
Loopback3              [up/up]FE80::A8BB:CCFF:FE00:50002000:5:3::1

OSPFv3 局域网可达

## 记得要启用IPv6单播路由,才能去配置动态路由
R5(config)#ipv6 unicast-routing  ## 进入OSPFv3 IPv6 地址族,设置RID为 5.5.5.5
R5(config)#router ospfv3 1
R5(config-router)#address-family ipv6 
R5(config-router-af)#router-id 5.5.5.5
R5(config-router-af)#exit
R5(config-router)#exit## 接口下宣告
R5(config)#int range e0/0,lo1,lo2,lo3
R5(config-if-range)#ospfv3 1 ipv6 area 0
R5(config-if-range)#exit

检查

R1 的路由表

在这里插入图片描述

R5 的路由表

在这里插入图片描述

R1 Ping R5

R1#ping 2000:5:1::1 source lo 1
在这里插入图片描述

抓包分析

抓的是 R2的e0/1口
其实这个时候就可以看到,数据包发送的时候
此时就只新增了IPv4报文头这样子就比GRE少了一个封装字段,提高了传输效率

Ping包
在这里插入图片描述
在这里插入图片描述

配置文档

R1

! 
ipv6 unicast-routing 
!
interface Loopback1ipv6 address 2000:1:1::1/64ospfv3 1 ipv6 area 0
!
interface Loopback2ipv6 address 2000:1:2::1/64ospfv3 1 ipv6 area 0
!
interface Loopback3ipv6 address 2000:1:3::1/64ospfv3 1 ipv6 area 0
!
interface Ethernet0/0ipv6 address 2001:12::1/64ospfv3 1 ipv6 area 0
!
router ospfv3 1!address-family ipv6 unicastrouter-id 1.1.1.1
!

R2

!
ipv6 unicast-routing 
!
interface Tunnel24tunnel mode ipv6ipipv6 address 2001:24::2/64ospfv3 1 ipv6 area 0tunnel source Ethernet0/1tunnel destination 172.16.34.4
!
interface Ethernet0/0no shutdownipv6 address 2001:12::2/64ospfv3 1 ipv6 area 0
!
interface Ethernet0/1no shutdownip address 172.16.23.2 255.255.255.0
! 
router ospfv3 1!address-family ipv6 unicastrouter-id 2.2.2.2
!
router ospf 110router-id 2.2.2.2network 172.16.23.0 0.0.0.255 area 0
!

R3

!
interface Ethernet0/0no shutdownip address 172.16.23.3 255.255.255.0
!
interface Ethernet0/1no shutdownip address 172.16.34.3 255.255.255.0
!         
router ospf 110router-id 3.3.3.3network 172.16.0.0 0.0.255.255 area 0
!

R4

!
ipv6 unicast-routing
!
interface Tunnel24tunnel mode ipv6ipipv6 address 2001:24::4/64ospfv3 1 ipv6 area 0tunnel source Ethernet0/0tunnel destination 172.16.23.2
!
interface Ethernet0/0no shutdownip address 172.16.34.4 255.255.255.0
!
interface Ethernet0/1no shutdownipv6 address 2001:45::4/64ospfv3 1 ipv6 area 0
!
router ospfv3 1!address-family ipv6 unicastrouter-id 4.4.4.4
!
router ospf 110router-id 4.4.4.4network 172.16.34.0 0.0.0.255 area 0
!

R5

!
ipv6 unicast-routing
!
interface Loopback1ipv6 address 2000:5:1::1/64ospfv3 1 ipv6 area 0
!
interface Loopback2ipv6 address 2000:5:2::1/64ospfv3 1 ipv6 area 0
!
interface Loopback3ipv6 address 2000:5:3::1/64ospfv3 1 ipv6 area 0
!
interface Ethernet0/0 no shutdownipv6 address 2001:45::5/64ospfv3 1 ipv6 area 0
!
router ospfv3 1!address-family ipv6 unicastrouter-id 5.5.5.5
!

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com