CLI方式:IPv6 Internet访问IPv4网络典型配置

使用版本

本举例是在F1090R8660P33版本上进行配置和验证的。

组网需求

如下图所示,Internet已经升级到了IPv6,但是某公司内部网络仍然是IPv4网络。而该公司仍希望为IPv6 Internet内的用户提供FTP服务。该公司访问IPv6 Internet使用的IPv6地址为2012::1

为满足上述要求,实现方式如下:

图-1 IPv6 Internet访问IPv4网络配置组网图

配置步骤

  1. 配置接口IP地址

# 根据组网图中规划的信息,配置各接口的IP地址,具体配置步骤如下。

<Device> system-view

[Device] interface gigabitethernet 1/0/1

[Device-GigabitEthernet1/0/1] ipv6 address 2014::1 96

[Device-GigabitEthernet1/0/1] quit

请参考以上步骤配置其他接口的IP地址,具体配置步骤略。

  1. 将接口加入安全域

# 请根据组网图中规划的信息,将接口加入对应的安全域,具体配置步骤如下。

[Device] security-zone name trust

[Device-security-zone-Trust] import interface gigabitethernet 1/0/2

[Device-security-zone-Trust] quit

[Device] security-zone name untrust

[Device-security-zone-Untrust] import interface gigabitethernet 1/0/1

[Device-security-zone-Untrust] quit

  1. 配置安全策略

# 配置名称为aftlocalin的安全策略,使Device能对Host访问Server的报文进行AFT转换,具体配置步骤如下。

[Device] security-policy ipv6

[Device-security-policy-ipv6] rule name aftlocalin

[Device-security-policy-ipv6-1-aftlocalin] source-zone untrust

[Device-security-policy-ipv6-1-aftlocalin] destination-zone local

[Device-security-policy-ipv6-1-aftlocalin] destination-ip-host 2012::1

[Device-security-policy-ipv6-1-aftlocalin] action pass

[Device-security-policy-ipv6-1-aftlocalin] quit

[Device-security-policy-ipv6] quit

# 配置名称为aftlocalout的安全策略,允许将AFT转换后的报文转发至Server,具体配置步骤如下。

[Device] security-policy ip

[Device-security-policy-ip] rule name aftlocalout

[Device-security-policy-ip-1-aftlocalout] source-zone local

[Device-security-policy-ip-1-aftlocalout] destination-zone trust

[Device-security-policy-ip-1-aftlocalout] source-ip-host 30.1.1.1

[Device-security-policy-ip-1-aftlocalout] source-ip-host 30.1.1.2

[Device-security-policy-ip-1-aftlocalout] destination-ip-host 20.1.1.1

[Device-security-policy-ip-1-aftlocalout] action pass

[Device-security-policy-ip-1-aftlocalout] quit

[Device-security-policy-ip] quit

  1. 配置AFT功能

# 配置IPv4IPv6源地址静态转换策略,手动指定IPv4IPv6地址一一对应的转换关系,此策略可将报文的目的地址转换为对应的IPv4地址。

[Device] aft v4tov6 source 20.1.1.1 2012::1

# 配置地址组0包含2IPv4地址:30.1.1.130.1.1.2

[Device] aft address-group 0

[Device-aft-address-group-0] address 30.1.1.1 30.1.1.2

[Device-aft-address-group-0] quit

# 配置IPv6 ACL 2000,匹配IPv6网络到IPv4网络的报文。此处允许所有IPv6网络内主机访问IPv4 FTP Server

[Device] acl ipv6 basic 2000

[Device-acl-ipv6-basic-2000] rule permit

[Device-acl-ipv6-basic-2000] quit

# 配置IPv6IPv4的源地址动态转换策略,将匹配ACL 2000IPv6报文源地址转换为地址组0中的IPv4地址30.1.1.130.1.1.2

[Device] aft v6tov4 source acl ipv6 number 2000 address-group 0

# 在设备IPv6侧和IPv4侧接口GigabitEthernet1/0/1开启AFT

[Device] interface gigabitethernet 1/0/1

[Device-GigabitEthernet1/0/1] aft enable

[Device-GigabitEthernet1/0/1] quit

[Device] interface gigabitethernet 1/0/2

[Device-GigabitEthernet1/0/2] aft enable

[Device-GigabitEthernet1/0/2] quit

验证配置

# 以上配置完成后,检查IPv6 hostIPv4 FTP server的连通性。以IPv6 host A ping IPv4 FTP server为例:

D:\>ping 2012::1

Pinging 2012::1 with 32 bytes of data:

Reply from 2012::1: time=3ms

Reply from 2012::1: time=3ms

Reply from 2012::1: time=3ms

Reply from 2012::1: time=3ms

# 通过查看AFT会话,可以看到创建了一个IPv6会话和IPv4会话,分别对应转换前和转换后的报文。

[Device] display aft session ipv6 verbose

Initiator:

  Source      IP/port: 2013:0:FF0A:0101:0100::/1029

  Destination IP/port: 2012::1/21

  VPN instance/VLAN ID/Inline ID: -/-/-

  Protocol: IPV6-ICMP(58)

  Inbound interface: GigabitEthernet1/0/1

  Source security zone: Untrust

Responder:

  Source      IP/port: 2012::1/21

  Destination IP/port: 2013:0:FF0A:0101:0100::/1029

  VPN instance/VLAN ID/Inline ID: -/-/-

  Protocol: IPV6-ICMP(58)

  Inbound interface: GigabitEthernet1/0/2

  Source security zone: Local

State: ICMPV6_REPLY

Application: ICMP

Rule ID: -/-/-

Rule name:

Start time: 2014-03-13 09:07:30  TTL: 3582s

Initiator->Responder:            3 packets        184 bytes

Responder->Initiator:            2 packets        148 bytes

 

Total sessions found: 1

 

[Device] display aft session ipv4 verbose

Initiator:

  Source      IP/port: 30.1.1.1/11025

  Destination IP/port: 20.1.1.1/21

  DS-Lite tunnel peer: -

  VPN instance/VLAN ID/Inline ID: -/-/-

  Protocol: ICMP(1)

  Inbound interface: GigabitEthernet1/0/1

  Source security zone: Local

Responder:

  Source      IP/port: 20.1.1.1/21

  Destination IP/port: 30.1.1.1/11025

  DS-Lite tunnel peer: -

  VPN instance/VLAN ID/Inline ID: -/-/-

  Protocol: ICMP(1)

  Inbound interface: GigabitEthernet1/0/2

  Source security zone: Trust

State: ICMP_REPLY

Application: ICMP

Rule ID: 0

Rule name: aftlocalout

Start time: 2014-03-13 09:07:30  TTL: 3577s

Initiator->Responder:            3 packets        124 bytes

Responder->Initiator:            2 packets        108 bytes

 

Total sessions found: 1

配置文件

#

interface GigabitEthernet1/0/1

 aft enable

 ipv6 address 2014::1/96

#

interface GigabitEthernet1/0/2

 ip address 20.1.1.2 255.255.255.0

 aft enable

#

security-zone name Trust

 import interface GigabitEthernet1/0/2

#

security-zone name Untrust

 import interface GigabitEthernet1/0/1

#

acl ipv6 basic 2000

 rule 0 permit

#

aft address-group 0

 address 30.1.1.1 30.1.1.2

#

 aft v6tov4 source acl ipv6 number 2000 address-group 0

 aft v4tov6 source 20.1.1.1 2012::1

#

security-policy ip

 rule 0 name aftlocalout

  action pass

  source-zone local

  destination-zone trust

  source-ip-host 30.1.1.1

  source-ip-host 30.1.1.2

  destination-ip-host 20.1.1.1

#

security-policy ipv6

 rule 0 name aftlocalin

  action pass

  source-zone untrust

  destination-zone local

  destination-ip-host 2012::1

#