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

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

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

操作步骤

  1. 配置FW。

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

    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
相关推荐
wang_shu_mo_ran7 分钟前
网络编程(一):网络编程初识
运维·服务器·网络
姚青&1 小时前
持续交付与 DevOps 体系
运维·devops
ton_tom1 小时前
设备驱动程序编程-Linux2.6.10-kdb安装-32位
linux·运维·服务器
Elastic 中国社区官方博客1 小时前
谁来评判评判者?在 Elasticsearch Workflows 中使用 LLM-as-a-Judge
大数据·运维·人工智能·elasticsearch·搜索引擎·ai·全文检索
坐望云起2 小时前
FFmpeg.wasm 纯浏览器端视频压缩与格式转换实战:零服务器、零上传、100% 隐私
服务器·ffmpeg·wasm
SSO_Crown2 小时前
AI 招聘管理系统深度评测与选型指南
大数据·运维·人工智能
cft56200_ln2 小时前
gPTP Master 报文目的 MAC 地址
运维·服务器·网络
AOwhisky4 小时前
Linux(CentOS)系统管理入门笔记(第四期)——文件系统(下篇):文件与目录操作实战——cpmvmkdirrmln
linux·运维·笔记·centos·云计算·文件系统
XTIOT6665 小时前
CRPT 诚实标识采集落地技术实践:分工况硬件选型与合规数据标准化解决方案
大数据·运维·人工智能·嵌入式硬件·物联网
weixin_505061455 小时前
线束中国探展专访|广东星坤:以高可靠互连突围,打造国产连接器全球化标杆
运维