The present disclosure relates to the communication field, and in particular, to a method for enabling an Internet Protocol version 6 (IPv6) host to access an Internet Protocol version 4 (IPv4) host, a method for obtaining an IPv6 address prefix, and a translation apparatus.
Network Address Translation-Protocol Translation (NAT-PT) [RFC 2766] is a technology for translating packet headers and semantics between IPv4 packets and IPv6 packets during IPv4/IPv6 Network Address Translation (NAT), and is applicable to communication between IPv4-only sites and IPv6-only sites. For some upper-layer protocols embedded with address information such as the File Transfer Protocol (FTP), a NAT-PT device needs to collaborate with an application-layer gateway to complete translation. The NAPT-PT function can be implemented by using port information on the basis of the NAT-PT device.
In the NAT-PT device, a solution for enabling an IPv6 host to access an IPv4 host is: An IPv6 host sends a Domain Name System (DNS) Query request for the IPv4 or IPv6 address corresponding to the Fully Qualified Domain Name (FQDN) of the destination host. The DNS Query request passes through the NAT-PT device and then is sent to a DNS server in an IPv4 domain. The DNS server carries in a DNS response the IPv4 address corresponding to the destination host, for example, carries the IPv4 address in the A record of the DNS. When the DNS response passes through the NAT-PT device, the IPv4 address (the A record) in the DNS response is translated by the DNS-ALG into an IPv6 address (an A6/AAAA record) unconditionally because a DNS Application Level Gateway (DNS-ALG) on the NAT-PT device does not record the DNS query status.
However, in some application scenarios, the IPv6 host in the IPV6 domain may expect to obtain the IPv4 address of the destination host or has obtained the IPv4 address of the destination host. For example, the IPv6 host is a dual-stack host (supporting both IPv4 and IPv6), and expects to learn the real address of the destination host (regardless of an IPv4 address or an IPv6 address). If the real address of the destination host is an IPv4 address, a session is set up through IPv4; if the real address of the destination host is an IPv6 address, a session is set up through IPv6. However, when the DNS-ALG is adopted, the DNS-ALG translates the IPv4 address (the A record) in the DNS response into an IPv6 address (the A6/AAAA record) by default, which means that the destination host is disguised by the DNS-ALG as an IPv6 host. That is, even if the destination host is an IPv4 host, the source host may only communicate with the destination host through IPv6., In this case, when a protocol packet arrives at the NAT-PT device for translation, some information may be lost because the formats of IPv4 and IPv6 packet headers are incompatible.
In another case, the IPv6 host in the IPv6 domain may already obtain the IPv4 address of the destination host by other means, and not via the DNS-ALG. In this case, the host cannot obtain the IPv6 address of the destination host. For example, seed address information provided by a Peer-To-Peer (P2P) system for the IPv6 host in the IPv6 domain is transmitted over the P2P protocol. If the seed information provided by the P2P system for the IPv6 host is an IPv4 address, the DNS-ALG cannot capture the information, and thus cannot perform address translation. For another example, the IPv6 host in the IPv6 domain obtains the IPv4 address of the destination host from the local DNS server, and the DNS message does not pass through the DNS-ALG.
Embodiments of the present disclosure provide a method for enabling an IPv6 host to access an IPv4 host, a method for obtaining an IPv6 address prefix, and a translation apparatus to solve the problem that it is difficult to enable an IPv6 host to completely access an IPv4 host without the DNS-ALG.
An implementation of an embodiment of the present disclosure is as follows: A method for enabling an IPv6 host to access an IPv4 host includes: obtaining, by a source host, an address prefix used for translating an IPv4 address into an IPv6 address; and translating, by a source host, an IPv4 address of a destination IPv4 host into an IPv6 address locally, where the obtaining of the address prefix used for translating an IPv4 address into an IPv6 address includes statically configuring an address prefix used for translating an IPv4 address into an IPv6 address on the source host, or receiving a message that carries an address prefix used for translating an IPv4 address into an IPv6 address.
Another implementation of an embodiment of the present disclosure is a translation apparatus. The translation apparatus includes a prefix obtaining unit and an address translating unit. to the prefix obtaining unit is configured to obtain an address prefix used for translating an IPv4 address into an IPv6 address. The address translating unit is configured to perform translation between an IPv4 address and an IPv6 address according to the address prefix obtained by the prefix obtaining unit. The obtaining of the address prefix used for translating an IPv4 address into an IPv6 address includes: statically configuring, on a source host, an address prefix used for translating an IPv4 address into an IPv6 address; or receiving a message that carries an address prefix used for translating an IPv4 address into an IPv6 address.
Another implementation of an embodiment of the present disclosure is as follows: A method for obtaining an address prefix used for translating an IPv4 address into an IPv6 address includes: extending an option field of a Router Advertisement (RA) packet, storing the address prefix used for translating an IPv4 address into an IPv6 address in the extended option field of the RA packet, and sending, by a router, the address prefix to a source host.
With the method and apparatus provided in embodiments of the present disclosure, the DNS-ALG is not required to translate an IPv4 address into an IPv6 address, and the translation process is completed by the IPv6 host. When the IPv6 host in the IPv6 domain is a dual-stack host, the IPv6 host may obtain the IPv4 address of the destination host and directly use the IPv4 address to communicate with the destination host. For the IPv6-only host, translation from the IPv4 address to the IPv6 address can be implemented locally by using the above methods, thus avoiding a series of problems caused by address translation through the DNS-ALG.
The implementation process of the present disclosure is described below with reference to exemplary embodiments.
During the research, the inventor finds that, in view of the above technical problem, a mechanism, rather than a DNS-ALG on a NAT-PT device, is required to enable an IPv6 host to locally translate the IPv4 address of a destination host into an IPv6 address. For example, if the source host is an IPv6-only host, and the destination host is an IPv4-only host, the source host may locally translate the IPv4 address of the destination IPv4 host into an IPv6 address. However, the source host needs to learn the prefix configured on the NAT-PT device and used for translating an IPv6 address into an IPv4 address (or translating an IPv4 address into an IPv6 address), and add the prefix used for translating an IPv4 address into an IPv6 address in front of the IPv4 address of the destination host to form an IPv6 address. In embodiments of the present disclosure, the prefix may be a 96-bit prefix (96/prefix) or any other IPv6 address prefix, such as a 32-bit prefix (32/prefix) or a 64-bit prefix (64/prefix), or any prefix shorter than 96 bits, or any other prefix of random length.
The solution of the embodiments of the present disclosure enables the IPv6 host in the IPv6 domain to obtain the address prefix used for translating the IPv4 address of a destination IPv4-only host into an IPv6 address, so that the translation from the IPv4 address of the destination IPv4-only host into the IPv6 address is implemented on the host, thus avoiding a series of problems caused by use of the DNS-ALG.
As shown in
In step S100, the source host obtains a 96/prefix used for translating an IPv4 address into an IPv6 address.
Specifically, the prefix may be obtained in static configuration mode or may be obtained by receiving a message that carries a 96/prefix used for translating an IPv4 address into an IPv6 address, where the static configuration mode includes manually configuring, on the source host, a 96/prefix used for translating an IPv4 address into an IPv6 address.
In step S102, the source host translates the IPv4 address into the IPv6 address.
The source host, according to the obtained 96/prefix used for translating an IPv4 address into an IPv6 address, adds the 96/prefix in front of the IPv4 address of the destination host to form an IPv6 address96/prefix.
In step S100, by receiving a message that carries a 96/prefix used for translating an IPv4 address into an IPv6 address, the source host may also obtain the 96/prefix used for translating an IPv4 address into an IPv6 address96/prefix. The prefix may be obtained in the following ways:
(1) In an embodiment of the present disclosure, by receiving an extended RA packet, the source host obtains a 96/prefix used for translating an IPv4 address into an IPv6 address The RA packet carries a 96/prefix used for translating an IPv4 address into an IPv6 address. An option is added to the RA packet, and the option carries a 96/prefix. The newly defined option may be named as “Address Translation Prefix (ATP) option”, which transmits the prefix, which is configured on the NAT-PT device and used for translating an IPv6 address into an IPv4 address, to the source host. The new option (ATP option) is stored in a variable field of the RA packet.
Type: 8-bit unsigned integer, indicating the ATP option type.
Length: 8-bit unsigned integer. The length (including Type and Length fields) of the option is variable because the option may transmit one or more pieces of ATP information and each piece of ATP information includes two elements <IPv6 Address, Lifetime>.
IPv6 Address: 128-bit unsigned integer, indicating an IPv6 address prefix used for translating an IPv4 address into an IPv6 address. The IPv6 address and the subnet mask determine a unique IPv6 address prefix. If the prefix is a 96/prefix, the AND operation result of the IPv6 address and a 96-bit mask (FFFF:FFFF:FFFF:FFFF::FFFF:FFFF::0) indicates an IPv6 address 96/prefix.
Lifetime: 32-bit unsigned integer, indicating valid time of an ATP. Within the valid time, the ATP may be used for automatic translation from an IPv4 address into an IPv6 address. Before the ATP expires, the host may send a Router Solicitation (RS) to ensure validity of the ATP information. When the value of the field is 0xffffffff, it indicates the lifetime of the ATP is not limited. When the value is 0, it indicates the ATP is invalid and cannot be used any longer.
Another method for extending the RA packet is to use a DHCP Container (DHCPC) option. The DHCPC option is an RA option specially used for transmitting a DHCP option, and may include multiple DHCP options. In this way, the DHCPC option may be used for transmitting a DHCP option that carries an address prefix used for translating an IPv4 address into an IPv6 address.
The router obtains 96/prefix information used for translating an IPv4 address into an IPv6 address. The 96/prefix information used for translating an IPv4 address into an IPv6 address may be configured statically on the IPv6 router that supports the option. The 96/prefix is the prefix configured on the NAT-PT device and used for translating an IPv6 address into an IPv4 address. The NAT-PT device may also extend dynamic routing protocols to advertise the 96/prefix, for example, Open Shortest Path First (OSPF) and Intermediate System to Intermediate System (IS-IS). The router that receives the extended information may dynamically obtain the /96ATP used on the NAT-PT device. The router sends an RA message to the host periodically, where the message carries the above 96/prefix information, and the source host stores the prefix information after receiving the prefix information.
Extension of OSPFv2:
A new Type/Length/Value (TLV) may be defined for the Router Information Link State Advertisement (RI LSA) (RFC 4970), such as TLV_AFT_PREFIX_OSPFv2, to transfer the address prefix.
The format of the newly defined TLV_AFT_PREFIX_OSPFv2 is shown in
Type: TLV_AFT_PREFIX_OSPFv2.
Length: Length of the Value field, in bytes.
Value: The value is an 8-bit prefix-len field and an IPv6 prefix field. The length of the value field depends on the prefix length.
Extension of OSPFv3:
A new TLV TLV_AFT_PREFIX_OSPFv3 is defined for the RI LSA (RFC 4970) to transfer the address prefix.
The format of the newly defined TLV_AFT_PREFIX_OSPFv3 is shown in
Type: TLV_AFT_PREFIX_OSPFv3.
Length: Length of the value field, in bytes.
Value: The value is an 8-bit prefix-len field and an IPv6 prefix field. The length of the value field depends on the prefix length.
Extension of ISIS:
A new TLV type may be defined to add features for ISIS, and a new TLV TLV _AFT_PREFIX_ISIS may be defined to transfer the address prefix. The format of the newly defined TLV_AFT_PREFIX_ISIS is shown in
Type: TLV_AFT_PREFIX_ISIS.
Length: Length of the value field, in bytes.
Value: The value is an 8-bit prefix-len field and an IPv6 prefix field. The length of the value field depends on the prefix length.
(2) On a Dynamic Host Configuration Protocol (DHCP) server, 96/prefix information is configured statically for translating an IPv4 address into an IPv6 address. The 96/prefix is a prefix configured on the NAT-PT device and used for translating an IPv6 address into an IPv4 address. When the IPv6 host obtains the IP address and network configurations dynamically through the DHCP server, the DHCP server stores the 96/prefix in the option field of the DHCP REPLY packet and sends the 96/prefix to the IPv6 host. After receiving the packet, the IPv6 host stores the 96/prefix.
When the IPv6 host needs to access an IPv4 host, the IPv6 host may obtain the IPv4 address of the destination host by other means, for example, through the DNS or P2P, and then add the 96/prefix obtained from the DHCP server in front of the IPv4 address of the destination host. In this way, the IPv4 address of the destination host is translated into the IPv6 address which serves as the destination IPv6 address of the IPv6 packet sent by the IPv6 host. When the IPv6 packet sent by the IPv6 host arrives at the NAT-PT device, the last 32 bits of the IPv6 address are used as the destination IPv4 address of the IPv4 packet after protocol translation because the 96/prefix is the prefix configured on the NAT-PT device and used for translating an IPv6 address into an IPv4 address. The obtained 96/prefix used for translating an IPv4 address into an IPv6 address is added in front of the IPv4 address of the destination host to form an IPv6 address.
The DHCP REPLY packet carries the 96/prefix, or a new ATP option may be defined in the option field of the DHCP REPLY packet to transmit the prefix configured on the NAT-PT device and used for translating an IPv6 address into an IPv4 address to the source host. The format of the ATP option in the option field of the DHCP REPLY packet may be the same as that of the ATP option in the above RA packet.
In the above embodiments of the present disclosure, when the IPv6 host needs to access an IPv4 host, the IPv6 host may obtain the IPv4 address of the destination host through a DNS or by other means. If the IPv4 address needs to be translated into an IPv6 address, the IPv6 host adds the obtained 96/prefix in front of the IPv4 address of the destination host. In this way, the IPv4 address of the destination host is translated into an IPv6 address, which serves as the destination IPv6 address of the IPv6 packet. When the packet arrives at the NAT-PT device, the last 32 bits of the IPv6 address are used as the destination IPv4 address of the IPv4 packet after protocol translation because the 96/prefix is the prefix configured on the NAT-PT device and used for translating an IPv6 address into an IPv4 address.
With the method provided in embodiments of the present disclosure, the DNS-ALG is not required to translate an IPv4 address into an IPv6 address, and the translation is completed by the IPv6 host. When the IPv6 host in the IPv6 domain is a dual-stack host, the IPv6 host can obtain the IPv4 address of the destination host and directly use the IPv4 address to communicate with the destination host. For the IPv6-only host, translation from the IPv4 address to the IPv6 address can be implemented locally on the source host by using the above methods, thus avoiding a series of problems caused by address translation through the DNS-ALG.
The above method for enabling an IPv6 host to access an IPv4 host is described by taking the 96/prefix as an example. The address prefix may be of any length, for example, 32 bits or 64 bits, and is not limited to the described example. Accordingly, the option format may be shown in
Type: 8-bit unsigned integer, indicating the ATP option type.
Length: 8-bit unsigned integer. The length (including Type and Length fields) of the option is variable because the option may transfer one or more pieces of ATP information, and each piece of ATP information includes two elements <IPv6 Address, Lifetime>.
prefix-len: 8-bit unsigned integer, indicating the length of the IPv6 prefix.
IPv6 prefix: 128-bit unsigned integer, indicating an IPv6 address prefix used for translating an IPv4 address into an IPv6 address.
When the address prefix is of any length, a method for enabling an IPv6 host to access an IPv4 host is shown in
In step S70, the source host obtains an address prefix used for translating an IPv4 address into an IPv6 address.
Specifically, the prefix can be obtained in static configuration mode or by receiving a message that carries an address prefix used for translating an IPv4 address into an IPv6 address. The static configuration mode includes manually configuring an address prefix used for translating an IPv4 address into an IPv6 address on the source host.
In step S71, the source host translates the IPv4 address into the IPv6 address.
The source host adds the obtained address prefix, used for translating an IPv4 address into an IPv6 address, in front of the IPv4 address of the destination host to form an IPv6 address.
a prefix obtaining unit 802, configured to obtain an address prefix used for translating an IPv4 address into an IPv6 address; and
an address translating unit 804, configured to perform translation between an IPv4 address and an IPv6 address according to the address prefix obtained by the prefix obtaining unit 802.
Preferably, the address translating unit 804 is located on the host.
Preferably, as shown in
Preferably, the address translation unit obtains the address prefix in static configuration mode or by receiving, by a host, a message that carries an address prefix used for translating an IPv4 address into an IPv6 address. The static configuration mode of obtaining the address prefix includes manually configuring, on the source host, an address prefix used for translating an IPv4 address into an IPv6 address. The method of receiving a message that carries an address prefix used for translating an IPv4 address into an IPv6 address is as follows: carrying the address prefix in the RA packet sent by the router, or pre-configuring, on the DHCP server, the address prefix used for translating an IPv4 address into an IPv6 address. When the host dynamically obtains network configuration information such as the IP address through DHCP, the DHCP server sends the address prefix in the new option field of the DHCP REPLY packet to the host that sends a request. After receiving the packet, the host stores the address prefix.
Before carrying the address prefix in the RA packet sent by the router, the method may further include: statically configuring, on the router, an address prefix used for translating an IPv4 address into an IPv6 address, or extending dynamic routing protocols (such as OSPF and IS-IS) to advertise the address prefix. The router that receives the extended information dynamically obtains the address prefix used on the NAT-PT device. The router sends an RA message that carries the above mentioned address prefix to the host periodically, and the host stores the address prefix after receiving the message.
Preferably, the above mentioned method embodiments and apparatus embodiments are not limited to the translation between IPv6 address and IPv4 address, and may also be applicable to translation between other protocol addresses.
The method embodiments for enabling an IPv6 host to access an IPv4 host with a 96/prefix or a prefix of any other length, for example, a 32/prefix or a 64/prefix, or any prefix shorter than 96 bits, or any other prefix of random length are similar to the method embodiments mentioned above. For details, refer to the method embodiments described above.
After reading the above mentioned embodiments, those skilled in the art may clearly learn that the embodiments of the present disclosure may be implemented through hardware, or, preferably in most circumstances, through software in addition to a necessary universal hardware platform. Based on such understandings, the essence of the present disclosure or the contributions to the prior art may be embodied in the form of a software product. The software product may be stored in a storage medium. The software product includes a number of instructions that enable a computer device (such as a personal computer, a server, or a network device) to execute the methods provided in the embodiments of the present disclosure.
The above descriptions are merely exemplary embodiments of the present disclosure, but not intended to limit the protection scope of the present disclosure. Any modifications, variations, or replacements that can be easily derived by those skilled in the art without departing from the technical conception shall fall within the scope of the present disclosure. Therefore, the protection scope of the present disclosure is subject to the appended claims.
Number | Date | Country | Kind |
---|---|---|---|
200910106354.3 | Mar 2009 | CN | national |
200910204110.9 | Sep 2009 | CN | national |
This application is a continuation of International Application No. PCT/CN2010/071246, filed on Mar. 24, 2010, which claims priorities to Chinese Patent Application No. 200910106354.3, filed on Mar. 26, 2009 and Chinese Patent Application No. 200910204110.9, filed on Sep. 29, 2009, all of which are hereby incorporated by reference in their entireties.
Number | Date | Country | |
---|---|---|---|
Parent | PCT/CN2010/071246 | Mar 2010 | US |
Child | 13240612 | US |