IPv4网络用户访问IPv6网络服务器

NAT64静态映射为一对一的对应关系,通常应用在IPv4网络主动访问IPv6网络的场景中。

要求位于IPv4网络中的PC通过IPv4地址1.1.1.10能够直接访问位于IPv6网络中Server。

操作步骤

  1. 配置FW。

    配置接口GigabitEthernet 0/0/1的IPv4地址。

    <FW> system-view
    [FW] interface GigabitEthernet 0/0/1
    [FW-GigabitEthernet0/0/1] ip address 1.1.1.1 24
    [FW-GigabitEthernet0/0/1] quit

开启IPv6报文转发功能。

复制代码
[FW] ipv6

配置接口GigabitEthernet 0/0/2的IPv6地址。

复制代码
[FW] interface GigabitEthernet 0/0/2
[FW-GigabitEthernet0/0/2] ipv6 enable
[FW-GigabitEthernet0/0/2] ipv6 address 2001::2 64

开启接口GigabitEthernet 0/0/2的NAT64功能。

复制代码
[FW-GigabitEthernet0/0/2] nat64 enable
[FW-GigabitEthernet0/0/2] quit

将接口GigabitEthernet 0/0/1加入Trust安全区域。

复制代码
[FW] firewall zone trust
[FW-zone-trust] add interface GigabitEthernet 0/0/1
[FW-zone-trust] quit

将接口GigabitEthernet 0/0/2加入Untrust安全区域。

复制代码
[FW] firewall zone untrust
[FW-zone-untrust] add interface GigabitEthernet 0/0/2
[FW-zone-untrust] quit

配置NAT64前缀,PC访问Server的报文在IPv6网络中传输时使用的源地址由NAT64前缀和PC的IPv4地址组合而成。

复制代码
[FW] nat64 prefix 3001:: 96

此处NAT64前缀以3001:: 96为例,如果不配置,则默认为知名前缀。

配置NAT64静态映射关系,将Server的IPv6地址2001::1映射为IPv4地址1.1.1.10。

复制代码
[FW] nat64 static 2001::1 1.1.1.10 unr-route

开启NAT64报文受安全策略控制功能。

复制代码
[FW] nat64 security-policy enable

配置安全策略。

配置NAT64静态映射需要配置IPv6安全策略。

复制代码
[FW] security-policy
[FW-policy-security] rule name policy_sec_1
[FW-policy-security-rule-policy_sec_1] source-zone trust
[FW-policy-security-rule-policy_sec_1] destination-zone untrust
[FW-policy-security-rule-policy_sec_1] destination-address 2001::1 64
[FW-policy-security-rule-policy_sec_1] action permit
[FW-policy-security-rule-policy_sec_1] quit

配置PC的IPv4地址。(IPv4地址的配置方法与PC的操作系统有关,配置方法略。)

配置PC的IPv4地址为1.1.1.2/24,与FW的接口GigabitEthernet 0/0/1同一网段。

配置Server的IPv6地址和路由。(IPv6地址和路由的配置方法与Server的操作系统有关,配置方法略。)

配置Server的IPv6地址为2001::1/24,与FW的接口GigabitEthernet 0/0/2同一网段。

配置Server去往3001::/96网段的路由为2001::2。

结果验证

配置完成后,PC上执行ping 1.1.1.10

复制代码
C:\> ping 1.1.1.10
Pinging 1.1.1.10 with 32 bytes of data:

Reply from 1.1.1.10: time=69ms
Reply from 1.1.1.10: time=34ms
Reply from 1.1.1.10: time=17ms
Reply from 1.1.1.10: time=18ms

Ping statistics for 1.1.1.10:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 17ms, Maximum = 69ms, Average = 34ms

PC可以ping通Server的IPv4映射地址。

在FW任意视图下执行display firewall ipv6 session table,查看NAT64的会话表信息。

复制代码
<FW> display firewall ipv6 session table
 Current total IPv6 sessions: 1                                                 
 Slot: 6 CPU: 1                                                                 
NAT64: icmp6 VPN: public --> public  3001::101:102.44006[1.1.1.2:44006] --> 2001::1.2048[1.1.1.10:2048]

由NAT64会话表得知IPv6与IPv4地址的转换关系。

配置脚本

FW的配置脚本

html 复制代码
#                                                                               
 sysname FW                                      
#                                                                               
 ipv6
#                                                                               
interface GigabitEthernet0/0/1                                                  
 ip address 1.1.1.1 255.255.255.0                                               
#                                                                               
interface GigabitEthernet0/0/2                                                  
 ipv6 enable
 nat64 enable
 ipv6 address 2001::2/64                                              
#                                                                               
firewall zone trust                                                             
 set priority 85                                                                
 add interface GigabitEthernet0/0/1                                             
#                                                                               
firewall zone untrust                                                             
 set priority 5                                                                
 add interface GigabitEthernet0/0/2                                             
#  
 nat64 prefix 3001:: 96                                                        
 nat64 static 2001::1 1.1.1.10 unr-route                                                             
# 
nat64 security-policy enable
#                                                                          
security-policy                                                                 
  rule name policy_sec_1                                                        
    source-zone trust                                                           
    destination-zone untrust                                                    
    destination-address 2001::1 64                                               
    action permit                                                               
#                                                                                
return
相关推荐
草莓熊Lotso7 小时前
Linux 文件描述符与重定向实战:从原理到 minishell 实现
android·linux·运维·服务器·数据库·c++·人工智能
历程里程碑7 小时前
Linux22 文件系统
linux·运维·c语言·开发语言·数据结构·c++·算法
七夜zippoe15 小时前
CANN Runtime任务描述序列化与持久化源码深度解码
大数据·运维·服务器·cann
盟接之桥15 小时前
盟接之桥说制造:引流品 × 利润品,全球电商平台高效产品组合策略(供讨论)
大数据·linux·服务器·网络·人工智能·制造
Fcy64817 小时前
Linux下 进程(一)(冯诺依曼体系、操作系统、进程基本概念与基本操作)
linux·运维·服务器·进程
袁袁袁袁满17 小时前
Linux怎么查看最新下载的文件
linux·运维·服务器
代码游侠17 小时前
学习笔记——设备树基础
linux·运维·开发语言·单片机·算法
主机哥哥17 小时前
阿里云OpenClaw部署全攻略,五种方案助你快速部署!
服务器·阿里云·负载均衡
Harvey90317 小时前
通过 Helm 部署 Nginx 应用的完整标准化步骤
linux·运维·nginx·k8s
珠海西格电力科技18 小时前
微电网能量平衡理论的实现条件在不同场景下有哪些差异?
运维·服务器·网络·人工智能·云计算·智慧城市