目录
方法一、普通的GRE将V6基于V4通讯
方法二、6to4的tunnel
方法三、双栈
方法一、普通的GRE将V6基于V4通讯
//方法一和方法二的前提,搭个简单的V4网络就行
[r1]int g0/0/0
[r1-GigabitEthernet0/0/0]ip address 12.1.1.1 24
[r1]router id 1.1.1.1
[r1-GigabitEthernet0/0/0]ospf 1
[r1-ospf-1]area 0
[r1-ospf-1-area-0.0.0.0]network 12.1.1.1 0.0.0.0
[r2]int g0/0/1
[r2-GigabitEthernet0/0/1]ip address 12.1.1.2 24
[r2-GigabitEthernet0/0/1]int g0/0/0
[r2-GigabitEthernet0/0/0]ip address 23.1.1.1 24
[r2]router id 2.2.2.2
[r2]ospf 1
[r2-ospf-1]area 0
[r2-ospf-1-area-0.0.0.0]network 12.1.1.2 0.0.0.0
[r2-ospf-1-area-0.0.0.0]network 23.1.1.1 0.0.0.0
[r3]int g0/0/1
[r3-GigabitEthernet0/0/1]ip address 23.1.1.2 24
[r3]router id 3.3.3.3
[r3]ospf 1
[r3-ospf-1]area 0
[r3-ospf-1-area-0.0.0.0]network 23.1.1.2 0.0.0.0
Begin......
[r1]ipv6
[r1-Tunnel0/0/0]int lo 0
[r1-LoopBack0]ipv6 enable
[r1-LoopBack0]ipv6 address 10::1 64
[r3]ipv6
[r3-Tunnel0/0/0]int lo0
[r3-LoopBack0]ipv6 enable
[r3-LoopBack0]ipv6 address 30::1 64
【R1上】
#
interface Tunnel0/0/0
ipv6 enable
ipv6 address 55::1/64
tunnel-protocol gre
source 12.1.1.1
destination 23.1.1.2
#
【R3上】
#
interface Tunnel0/0/0
ipv6 enable
ipv6 address 55::2/64
tunnel-protocol gre
source 23.1.1.2
destination 12.1.1.1
#
//ping一下看tunnel口接通没
[r1]ipv6 route-static 30:: 64 55::2
//静态一写
[r3]ipv6 route-static 10:: 64 55::1
【验证】
方法二、6to4的tunnel
原理:
普通tunnel在多个V6网络构建为一个V6网络时,存在地址规划,指数的定义tunnel链路和路由信息,工程量巨大,极难维护;
6 to 4 tunnle可以让用于自行定义IPV6地址,均需要配置一条tunnel和一条路由即可;
****2002::/16 6to4 tunnel 专用地址****
IPV4兼容地址--- 每一个IPV4地址都可以转换为一段IPV6地址;
本地V4网络地址为12.1.1.1 对应的V4兼容地址
12.1.1.1
0c01:0101=12.1.1.1
2002:c01:101::/64
本地V4网络地址为23.1.1.2 对应的V4兼容地址
23.1.1.2
1701:0102=23.1.1.2
2002:1701:102::/64
【记得把方法一搞那些IP undo掉(tunnel协议等等)】
【路由器上ipv6记得开,进无论哪个接口以后记得ipv6 enable】
//注意看我环回和tunnel上的ip可不一样嗷
固定的占48位,我设掩码64,细看这俩网络号不一样
【R1上】
#
interface LoopBack0
ipv6 enable
ipv6 address 2002:C01:101::1/64
#
#
interface Tunnel0/0/0
ipv6 enable
ipv6 address 2002:C01:101:1::1/64
tunnel-protocol ipv6-ipv4 6to4
source 12.1.1.1
#
【R3上】
#
interface LoopBack0
ipv6 enable
ipv6 address 2002:1701:102::1/64
#
#
interface Tunnel0/0/0
ipv6 enable
ipv6 address 2002:1701:102:1::1/64
tunnel-protocol ipv6-ipv4 6to4
source 23.1.1.2
#
[r1]ipv6 route-static 2002:: 16 Tunnel 0/0/0
[r3]ipv6 route-static 2002:: 16 Tunnel 0/0/0
【验证】
方法三、双栈
原理:
一台设备同时连接IPV4/IPV6网络,若目标IP为V6地址使用V6的源ip,通过V6的路由表传递;V4同理;
[Huawei]sysname r1
[r1]ipv6
[r1]int g0/0/0
[r1-GigabitEthernet0/0/0]ip address 12.1.1.1 24
[r1-GigabitEthernet0/0/0]int g0/0/1
[r1-GigabitEthernet0/0/1]ipv6 enable
[r1-GigabitEthernet0/0/1]ipv6 address 13::1 64
[r1-GigabitEthernet0/0/1]int g0/0/2
[r1-GigabitEthernet0/0/2]ipv6 enable
[r1-GigabitEthernet0/0/2]ip address 1.1.1.1 24
[r1-GigabitEthernet0/0/2]ipv6 address 1::1 64
[Huawei]sysname r2
[r2]int g0/0/1
[r2-GigabitEthernet0/0/1]ip address 12.1.1.2 24
[r2-GigabitEthernet0/0/1]int g0/0/0
[r2-GigabitEthernet0/0/0]ip address 24.1.1.1 24
[Huawei]sysname r3
[r3]ipv6
[r3-GigabitEthernet0/0/1]int g0/0/0
[r3-GigabitEthernet0/0/0]ipv6 enable
[r3-GigabitEthernet0/0/0]ipv6 address 13::2 64
[r3-GigabitEthernet0/0/0]int g0/0/1
[r3-GigabitEthernet0/0/1]ipv6 enable
[r3-GigabitEthernet0/0/1]ipv6 address 34::1 64
[Huawei]sysname r4
[r4]ipv6
[r4]int g0/0/1
[r4-GigabitEthernet0/0/1]ip address 24.1.1.2 24
[r4-GigabitEthernet0/0/1]int g0/0/0
[r4-GigabitEthernet0/0/0]ipv6 enable
[r4-GigabitEthernet0/0/0]ipv6 address 34::2 64
[r4-GigabitEthernet0/0/0]int g0/0/2
[r4-GigabitEthernet0/0/2]ipv6 enable
[r4-GigabitEthernet0/0/2]ipv6 address 2::1 64
[r4-GigabitEthernet0/0/2]ip address 2.2.2.1 24
👇RIP......
【注:上边是ipv4下的ripv2,下边是ipv6下的ripng】
[r1]rip 1
[r1-rip-1]version 2
[r1-rip-1]network 12.0.0.0
[r1-rip-1]network 1.0.0.0
[r1]ripng 1
[r1-ripng-1]int g0/0/1
[r1-GigabitEthernet0/0/1]ripng 1 en
[r1-GigabitEthernet0/0/1]ripng 1 enable
[r1-GigabitEthernet0/0/1]int g0/0/2
[r1-GigabitEthernet0/0/2]ripng 1 enable
[r2]rip 1
[r2-rip-1]version 2
[r2-rip-1]network 12.0.0.0
[r2-rip-1]network 24.0.0.0
[r3]ripng 1
[r3-ripng-1]int g0/0/0
[r3-GigabitEthernet0/0/0]ripng 1 enable
[r3-GigabitEthernet0/0/0]int g0/0/1
[r3-GigabitEthernet0/0/1]ripng 1 enable
[r4]rip 1
[r4-rip-1]version 2
[r4-rip-1]network 24.0.0.0
[r4-rip-1]network 2.0.0.0
[r4-rip-1]q
[r4]ripng 1
[r4-ripng-1]int g0/0/0
[r4-GigabitEthernet0/0/0]ripng 1 enable
[r4-GigabitEthernet0/0/0]int g0/0/2
[r4-GigabitEthernet0/0/2]ripng 1 enable
//两个PC配IP
【验证】
PC1在IPV4下pingPC2
PC1在IPV6下pingPC2
总结 :
第一种方式基本不太行,只能说能通,但是不实用,第二种好用且现在确实一直在用,然后第三种方式就是未来ipv6取代v4必须这样,到最后基本不用第二种方式了全用第三种基本就全取代了