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

10 篇文章 0 订阅

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的配置脚本

#                                                                               
 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

  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值