Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 
 

NAT Protocol Translation

Configuring NAT-PT

To configure the translation type as basic-nat-pt, you must configure the DNS ALG application, the NAT pools and rules, a service set with a service interface, and trace options. Configuring NAT-PT is not supported if you are using MS-MPCs or MS-MICs. This topic includes the following tasks:

Configuring the DNS ALG Application

To configure the DNS ALG application:

  1. In configuration mode, go to the [edit applications] hierarchy level.
  2. Configure the ALG to which the DNS traffic is destined at the [edit applications] hierarchy level. Define the application name and specify the application protocol to use in match conditions in the first NAT rule or term.

    In the following example, the application name is dns-alg and application protocol is dns.

  3. Verify the configuration by using the show command at the [edit applications] hierarchy level.

Configuring the NAT Pool and NAT Rule

To configure the NAT pool and NAT rule:

  1. In configuration mode, go to the [edit services nat] hierarchy level.
  2. Configure the NAT pool and its address.

    In the following example, the name of the NAT pool is p1 and the address is 10.10.10.2/32.

  3. Configure the source pool and its address.

    In the following example, the name of the source pool is src_pool0 and the source pool address is 20.1.1.1/32.

  4. Configure the destination pool and its address.

    In the following example, the name of the destination pool is dst_pool0 and the destination pool address is 50.1.1.2/32.

  5. Configure the rule and the match direction.

    In the following example, the rule name is rule-basic-nat-pt and the match direction is input.

  6. Configure the term and the input conditions for the NAT term.

    In the following example, the term is t1 and the input conditions are source-address 2000::2/128, destination-address 4000::2/128, and applications dns_alg.

  7. Configure the NAT term action and the properties of the translated traffic.

    In the following example, the term action is translated and the properties of the translated traffic are source-pool src_pool0, destination-pool dst_pool0, and dns-alg-prefix 2001:db8:10::0/96.

  8. Configure the translation type.

    In the following example, the translation type is basic-nat-pt.

  9. Configure another term and the input conditions for the NAT term.

    In the following example, the term name is t2 and the input conditions are source-address 2000::2/128 and destination-address 2001:db8:10::0/96.

  10. Configure the NAT term action and the property of the translated traffic.

    In the following example, the term action is translated and the property of the translated traffic is source-prefix 19.19.19.1/32.

  11. Configure the translation type.

    In the following example, the translation type is basic-nat-pt.

  12. Verify the configuration by using the show command at the [edit services nat] hierarchy level.

Configuring the Service Set for NAT

To configure the service set for NAT:

  1. In configuration mode, go to the [edit services] hierarchy level.
  2. Configure the service set.

    In the following example, the name of the service set is ss_dns.

  3. Configure the service set with NAT rules. 

    In the following example, the rule name is rule-basic-nat-pt.

  4. Configure the service interface.

    In the following example, the name of service interface is sp-1/2/0.

  5. Verify the configuration by using the show services command from the [edit] hierarchy level.

Configuring Trace Options

To configure the trace options:

  1. In configuration mode, go to the [edit services adaptive-services-pics] hierarchy level.
  2. Configure the trace options.

    In the following example, the tracing parameter is all.

  3. Verify the configuration by using the show command at the [edit services] hierarchy level.

The following example configures the translation type as basic-nat-pt.

Example: Configuring NAT-PT

A Domain Name System application-level gateway (DNS ALG) is used with Network Address Translation-Protocol Translation (NAT-PT) to facilitate name-to-address mapping. You can configure the DNS ALG to map addresses returned in the DNS response to an IPv6 address. Configuring NAT-PT is not supported if you are using MS-MPCs or MS-MICs.

When you configure NAT-PT with DNS ALG support, you must configure two NAT rules or one rule with two terms. In this example, you configure two rules. The first NAT rule ensures that the DNS query and response packets are translated correctly. For this rule to work, you must configure a DNS ALG application and reference it in the rule. The second rule is required to ensure that NAT sessions are destined to the address mapped by the DNS ALG.

Then, you must configure a service set, and then apply the service set to the interfaces.

This example describes how to configure NAT-PT with DNS ALG:

Requirements

This example uses the following hardware and software components:

  • Junos OS Release 11.2

  • A multiservices interface (ms-)

Overview and Topology

The following scenario shows the process of NAT-PT with DNS ALG when a laptop in an IPv6-only domain requests access to a server in an IPv4-only domain.

Topology

Figure 1: Configuring DNS ALGs with NAT-PT Network TopologyConfiguring DNS ALGs with NAT-PT Network Topology

The Juniper Networks router in the center of the illustration performs address translation in two steps. When the laptop requests a session with the www.example.com server that is in an IPv4-only domain, the Juniper Networks router performs the following:

  • Translates the IPv6 laptop and DNS server addresses into IPv4 addresses.

  • Translates the AAAA request from the laptop into an A request so that the DNS server can provide the IPv4 address.

When the DNS server responds with the A request, the Juniper Networks router performs the following:

  • Translates the IPv4 DNS server address back into an IPv6 address.

  • Translates the A request back into a AAAA request so that the laptop now has the 96-bit IPv6 address of the www.example.com server.

After the laptop receives the IPv6 version of the www.example.com server address, the laptop initiates a second session using the 96-bit IPv6 address to access that server. The Juniper Networks router performs the following:

  • Translates the laptop IPv4 address directly into its IPv4 address.

  • Translates the 96-bit IPv6 www.example.com server address into its IPv4 address.

Configuration of NAT-PT with DNS ALGs

To configure NAT-PT with DNS ALG , perform the following tasks:

Configuring the Application-Level Gateway

Step-by-Step Procedure

Configure the DNS application as the ALG to which the DNS traffic is destined. The DNS application protocol closes the DNS flow as soon as the DNS response is received. When you configure the DNS application protocol, you must specify the UDP protocol as the network protocol to match in the application definition.

To configure the DNS application:

  1. In configuration mode, go to the [edit applications] hierarchy level.

  2. Define the application name and specify the application protocol to use in match conditions in the first NAT rule.

    For example:

  3. Specify the protocol to match, in this case UDP.

    For example:

  4. Define the UDP destination port for additional packet matching, in this case the domain port.

    For example:

Results

Configuring the NAT Pools

Step-by-Step Procedure

In this configuration, you configure two pools that define the addresses (or prefixes) used for NAT. These pools define the IPv4 addresses that are translated into IPv6 addresses. The first pool includes the IPv4 address of the source. The second pool defines the IPv4 address of the DNS server. To configure NAT pools:

  1. In configuration mode, go to the [edit services nat] hierarchy level.

  2. Specify the name of the first pool and the IPv4 source address (laptop).

    For example:

  3. Specify the name of the second pool and the IPv4 address of the DNS server.

    For example:

Results

The following sample output shows the configuration of NAT pools.

Configuring the DNS Server Session: First NAT Rule

Step-by-Step Procedure

The first NAT rule is applied to DNS traffic going to the DNS server. This rule ensures that the DNS query and response packets are translated correctly. For this rule to work, you must configure a DNS ALG application and reference it in the rule. The DNS application was configured in Configuring NAT-PT. In addition, you must specify the direction in which traffic is matched, the source address of the laptop, the destination address of the DNS server, and the actions to take when the match conditions are met.

To configure the first NAT rule:

  1. In configuration mode, go to the [edit services nat] hierarchy level.

  2. Specify the name of the NAT rule.

    For example:

  3. Specify the name of the NAT term.

    For example:

  4. Define the match conditions for this rule.

    • Specify the IPv6 source address of the device (laptop) attempting to access an IPv4 address.

      For example:

    • Specify the IPv6 destination address of the DNS server.

      For example:

    • Reference the DNS application to which the DNS traffic destined for port 53 is applied.

      In this example, the application name configured in the Configuring the DNS Application step is dns_alg:

  5. Define the actions to take when the match conditions are met. The source and destination pools you configured in Configuring the NAT Pools are applied here.

    • Apply the NAT pool configured for source translation.

      For example:

    • Apply the NAT pool configured for destination translation.

      For example:

  6. Define the DNS ALG 96-bit prefix for IPv4-to-IPv6 address mapping.

    For example:

  7. Specify the type of NAT used for source and destination traffic.

    For example:

    Note:

    In this example, since NAT is achieved using address-only translation, the basic-nat-pt translation type is used. To achieve NAT using address and port translation (NAPT), use the napt-pt translation type.

  8. Specify the direction in which to match traffic that meets the rule conditions.

    For example:

  9. Configure system logging to record information from the services interface to the /var/log directory.

    For example:

Results

The following sample output shows the configuration of the first NAT rule that goes to the DNS server.

Configuring the HTTP Session: Second NAT Rule

Step-by-Step Procedure

The second NAT rule is applied to destination traffic going to the IPv4 server (www.example.com). This rule ensures that NAT sessions are destined to the address mapped by the DNS ALG. For this rule to work, you must configure the DNS ALG address map that correlates the DNS query or response processing done by the first rule with the actual data sessions processed by the second rule. In addition, you must specify the direction in which traffic is matched: the IPv4 address for the IPv6 source address (laptop), the 96-bit prefix to prepend to the IPv4 destination address (www.example.com), and the translation type.

To configure the second NAT rule:

  1. In configuration mode, go to the following hierarchy level.

  2. Specify the name of the NAT rule and term.

    For example:

  3. Define the match conditions for this rule:

    • Specify the IPv6 address of the device attempting to access the IPv4 server.

      For example:

    • Specify the 96-bit IPv6 prefix to prepend to the IPv4 server address.

      For example:

  4. Define the actions to take when the match conditions are met.

    • Specify the prefix for the translation of the IPv6 source address.

      For example:

  5. Specify the type of NAT used for source and destination traffic.

    For example:

    Note:

    In this example, since NAT is achieved using address-only translation, the basic-nat-pt translation type is used. To achieve NAT using address and port translation (NAPT), you must use the napt-pt translation type.

  6. Specify the direction in which to match traffic that meets the conditions in the rule.

    For example:

Results

The following sample output shows the configuration of the second NAT rule.

Configuring the Service Set

Step-by-Step Procedure

This service set is an interface service set used as an action modifier across the entire services (ms-) interface. Stateful firewall and NAT rule sets are applied to traffic processed by the services interface.

To configure the service set:

  1. In configuration mode, go to the [edit services] hierarchy level.

  2. Define a service set.

    For example:

  3. Specify properties that control how system log messages are generated for the service set.

    The example below includes all severity levels.

  4. Specify the stateful firewall rule included in this service set.

    The example below references the stateful firewall rule defined in Configuring the Stateful Firewall Rule.

  5. Define the NAT rules included in this service set.

    The example below references the two rules defined in this configuration example.

  6. Configure an adaptive services interface on which the service is to be performed.

    For example:

    Only the device name is needed, because the router software manages logical unit numbers automatically. The services interface must be an adaptive services interface for which you have configured unit 0 family inet at the [edit interfaces interface-name] hierarchy level in Configuring Interfaces.

Results

The following sample output shows the configuration of the service set.

Configuring the Stateful Firewall Rule

Step-by-Step Procedure

This example uses a stateful firewall to inspect packets for state information derived from past communications and other applications. The NAT-PT router checks the traffic flow matching the direction specified by the rule, in this case both input and output. When a packet is sent to the services (ms-) interface, direction information is carried along with it.

To configure the stateful firewall rule:

  1. In configuration mode, go to the [edit services stateful firewall] hierarchy level.

  2. Specify the name of the stateful firewall rule.

    For example:

  3. Specify the direction in which traffic is to be matched.

    For example:

  4. Specify the name of the stateful firewall term.

    For example:

  5. Define the terms that make up this rule.

    For example:

Results

The following sample output shows the configuration of the services stateful firewall.

Configuring Interfaces

Step-by-Step Procedure

After you have defined the service set, you must apply services to one or more interfaces installed on the router. In this example, you configure one interface on which you apply the service set for input and output traffic. When you apply the service set to an interface, it automatically ensures that packets are directed to the services (ms-) interface.

To configure the interfaces:

  1. In configuration mode, go to the [edit interfaces] hierarchy level.

  2. Configure the interface on which the service set is applied to automatically ensure that packets are directed to the services (ms-) interface.

    • For IPv4 traffic, specify the IPv4 address.

    • Apply the service set defined in Configuring Interfaces.

    • For IPv6 traffic, specify the IPv6 address.

  3. Specify the interface properties for the services interface that performs the service.

Results

The following sample output shows the configuration of the interfaces for this example.