Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

header-navigation
keyboard_arrow_up
close
keyboard_arrow_left
list Table of Contents
file_download PDF
{ "lLangCode": "en", "lName": "English", "lCountryCode": "us", "transcode": "en_US" }
English
keyboard_arrow_right

NAT Protocol Translation

date_range 24-Nov-23

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.
    content_copy zoom_out_map
     [edit]
    user@host# edit applications
    
  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.
    content_copy zoom_out_map
     [edit applications]
    user@host# set application application-name application-protocol application-protocol
    

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

    content_copy zoom_out_map
     [edit applications]
    user@host# set application dns-alg application-protocol dns
    
  3. Verify the configuration by using the show command at the [edit applications] hierarchy level.
    content_copy zoom_out_map
    [edit applications]
    user@host# show 
    application dns-alg {
        application-protocol dns;
    }

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.
    content_copy zoom_out_map
     [edit]
    user@host# edit services nat
    
  2. Configure the NAT pool and its address.
    content_copy zoom_out_map
     [edit services nat]
    user@host# set pool pool-name address address
    

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

    content_copy zoom_out_map
     [edit services nat]
    user@host# set pool p1 address 10.10.10.2/32
    
  3. Configure the source pool and its address.
    content_copy zoom_out_map
     [edit services nat]
    user@host# set pool source-pool-name address 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.

    content_copy zoom_out_map
     [edit services nat]
    user@host# set pool src_pool0 address 20.1.1.1/32
    
  4. Configure the destination pool and its address.
    content_copy zoom_out_map
     [edit services nat]
    user@host# set pool destination-pool-name address 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.

    content_copy zoom_out_map
     [edit services nat]
    user@host# set pool dst_pool0 address 50.1.1.2/32
    
  5. Configure the rule and the match direction.
    content_copy zoom_out_map
     [edit services nat]
    user@host# set rule rule-name match-direction match-direction
    

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

    content_copy zoom_out_map
     [edit services nat]
    user@host# set rule basic-nat-pt match-direction input
    
  6. Configure the term and the input conditions for the NAT term.
    content_copy zoom_out_map
     [edit services nat]
    user@host# set rule rule-basic-nat-pt term term from from
    

    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.

    content_copy zoom_out_map
     [edit services nat]
    user@host# set rule rule-basic-nat-pt term t1 from source-address 2000::2/128
     [edit services nat]
    user@host# set rule rule-basic-nat-pt term t1 from destination-address 4000::2/128
     [edit services nat]
    user@host# set rule rule-basic-nat-pt term t1 from applications dns_alg
    
  7. Configure the NAT term action and the properties of the translated traffic.
    content_copy zoom_out_map
     [edit services nat]
    user@host# set rule rule-basic-nat-pt term t1 then term-action translated-property
    

    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.

    content_copy zoom_out_map
     [edit services nat]
    user@host# set rule rule-basic-nat-pt term t1 then translated source-pool src_pool0
     [edit services nat]
    user@host# set rule rule-basic-nat-pt term t1 then translated destination-pool dst_pool0
     [edit services nat]
    user@host# set rule rule-basic-nat-pt term t1 then translated dns-alg-prefix 2001:db8:10::0/96
    
  8. Configure the translation type.
    content_copy zoom_out_map
     [edit services nat]
    user@host# set rule rule-basic-nat-pt term t1 then translated translation-type translation-type
    

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

    content_copy zoom_out_map
     [edit services nat]
    user@host# set rule rule-basic-nat-pt term t1 then translated translation-type basic-nat-pt
    
  9. Configure another term and the input conditions for the NAT term.
    content_copy zoom_out_map
     [edit services nat]
    user@host# set rule rule-basic-nat-pt term term-name from from
    

    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.

    content_copy zoom_out_map
     [edit services nat]
    user@host# set rule rule-basic-nat-pt term t2 from source-address 2000::2/128
     [edit services nat]
    user@host# set rule rule-basic-nat-pt term t2 from destination-address 2001:db8:10::0/96
    
  10. Configure the NAT term action and the property of the translated traffic.
    content_copy zoom_out_map
     [edit services nat]
    user@host# set rule rule-basic-nat-pt term t2 then term-action translated-property
    

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

    content_copy zoom_out_map
     [edit services nat]
    user@host# set rule rule-basic-nat-pt term t2 then translated source-prefix 19.19.19.1/32
    
  11. Configure the translation type.
    content_copy zoom_out_map
     [edit services nat]
    user@host# set rule rule-basic-nat-pt term t2 then translated translation-type translation-type
    

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

    content_copy zoom_out_map
     [edit services nat]
    user@host# set rule rule-basic-nat-pt term t2 then translated translation-type basic-nat-pt
    
  12. Verify the configuration by using the show command at the [edit services nat] hierarchy level.
    content_copy zoom_out_map
    [edit services nat]
    user@host# show 
    pool p1 {
        address 10.10.10.2/32;
    }
    pool src_pool0 {
        address 20.1.1.1/32;
    }
    pool dst_pool0 {
        address 50.1.1.2/32;
    }
    rule rule-basic-nat-pt {
        match-direction input;
        term t1 {
            from {
                source-address {
                    2000::2/128;
                }
                destination-address {
                    4000::2/128;
                }
                applications dns_alg; 
            }
            then {
                translated {
                    source-pool src_pool0;
                    destination-pool dst_pool0;
                    dns-alg-prefix 2001:db8:10::0/96;
                    translation-type {
                        basic-nat-pt;
                    }
                }
            }
        }
        term t2 {
            from {
                source-address {
                    2000::2/128;
                }
                destination-address {
                    2001:db8:10::0/96;
                }
            }
            then {
                translated {
                    source-prefix 19.19.19.1/32;
                    translation-type {
                        basic-nat-pt;
                    }
                }
            }
        }
    }

Configuring the Service Set for NAT

To configure the service set for NAT:

  1. In configuration mode, go to the [edit services] hierarchy level.
    content_copy zoom_out_map
     [edit]
    user@host# edit services
    
  2. Configure the service set.
    content_copy zoom_out_map
     [edit services]
    user@host# edit service-set service-set-name
    

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

    content_copy zoom_out_map
     [edit services]
    user@host# edit service-set ss_dns
    
  3. Configure the service set with NAT rules. 
    content_copy zoom_out_map
     [edit services service-set ss_dns]
    user@host# set nat-rules rule-name
    

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

    content_copy zoom_out_map
     [edit services service-set ss_dns]
    user@host# set nat-rules rule-basic-nat-pt
    
  4. Configure the service interface.
    content_copy zoom_out_map
     [edit services service-set ss_dns]
    user@host# set interface-service service-interface service-interface-name
    

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

    content_copy zoom_out_map
     [edit services service-set ss_dns]
    user@host# set interface-service service-interface sp-1/2/0
    
  5. Verify the configuration by using the show services command from the [edit] hierarchy level.
    content_copy zoom_out_map
    [edit]
    user@host# show services 
        service-set ss_dns {                
            nat-rules rule-basic-nat-pt;         
            interface-service {             
                service-interface sp-1/2/0; 
            }                               
        }

Configuring Trace Options

To configure the trace options:

  1. In configuration mode, go to the [edit services adaptive-services-pics] hierarchy level.
    content_copy zoom_out_map
    [edit]
    user@host# edit services adaptive-services-pics
    
  2. Configure the trace options.
    content_copy zoom_out_map
    [edit services adaptive-services-pics]
    user@host# set traceoptions flag tracing parameter
    

    In the following example, the tracing parameter is all.

    content_copy zoom_out_map
    [edit services adaptive-services-pics]
    user@host# set traceoptions flag all
    
  3. Verify the configuration by using the show command at the [edit services] hierarchy level.
    content_copy zoom_out_map
    [edit services]
    user@host# show
    adaptive-services-pics {                
        traceoptions {                      
            flag all;                       
        }                                   
    }

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

content_copy zoom_out_map
[edit]
user@host# show services
service-set ss_dns {
    nat-rules rule-basic-nat-pt;
    interface-service {
        service-interface sp-1/2/0;
    }
}
nat {
    pool p1 {
        address 10.10.10.2/32;
    }
    pool src_pool0 {
        address 20.1.1.1/32;
    }
    pool dst_pool0 {
        address 50.1.1.2/32;
    }
    rule rule-basic-nat-pt {
        match-direction input;
        term t1 {
            from {
                source-address {
                    2000::2/128;
                }
                destination-address {
                    4000::2/128;
                }
                applications dns_alg;
            }
            then {
                translated {
                    source-pool src_pool0;
                    destination-pool dst_pool0;
                    dns-alg-prefix 2001:db8:10::0/96;
                    translation-type {
                        basic-nat-pt;
                    }
                }
            }
        }
        term t2 {
            from {
                source-address {
                    2000::2/128;
                }
                destination-address {
                    2001:db8:10::0/96;
                }
            }
            then {
                translated {
                    source-prefix 19.19.19.1/32;
                    translation-type {
                        basic-nat-pt;
                    }
                }
            }
        }                               
    }                                   
}                                       
adaptive-services-pics {                
    traceoptions {                      
        flag all;                       
    }                                   
}

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.

    content_copy zoom_out_map
    user@host# edit applications
    
  2. Define the application name and specify the application protocol to use in match conditions in the first NAT rule.

    content_copy zoom_out_map
     [edit applications]
    user@host#  set application application-name application-protocol protocol-name
    

    For example:

    content_copy zoom_out_map
     [edit applications]
    user@host#  set application dns_alg application-protocol dns 
    
  3. Specify the protocol to match, in this case UDP.

    content_copy zoom_out_map
     [edit applications]
    user@host#  set application application-name protocol type
    

    For example:

    content_copy zoom_out_map
    [edit applications]
    user@host# set application dns_alg protocol udp
    
  4. Define the UDP destination port for additional packet matching, in this case the domain port.

    content_copy zoom_out_map
     [edit applications]
    user@host#  set application application-name destination-port value
    

    For example:

    content_copy zoom_out_map
    [edit applications]
    user@host# set application dns_alg destination-port 53 
    
Results
content_copy zoom_out_map
[edit applications]
user@host# show 
application dns_alg {
    application-protocol dns;
    protocol udp;
    destination-port 53;
}

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.

    content_copy zoom_out_map
    user@host# edit services nat
    
  2. Specify the name of the first pool and the IPv4 source address (laptop).

    content_copy zoom_out_map
    [edit services nat] 
    user@host# set pool nat-pool-name address ip-prefix
    

    For example:

    content_copy zoom_out_map
    [edit services nat] 
    user@host# set pool pool1 address 40.1.1.1/32
    
  3. Specify the name of the second pool and the IPv4 address of the DNS server.

    content_copy zoom_out_map
    [edit services nat] 
    user@host# set pool nat-pool-name address ip-prefix
    

    For example:

    content_copy zoom_out_map
    [edit services nat] 
    user@host# set pool pool2 address 50.1.1.1/32
    
Results

The following sample output shows the configuration of NAT pools.

content_copy zoom_out_map
[edit services nat]
user@host# show 
pool pool1 {
    address 40.1.1.1/32;
}
pool pool2 {
    address 50.1.1.1/32;
}

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.

    content_copy zoom_out_map
    user@host# edit services nat
    
  2. Specify the name of the NAT rule.

    content_copy zoom_out_map
    [edit services nat] 
    user@host# edit rule rule-name
    

    For example:

    content_copy zoom_out_map
    [edit services nat] 
    user@host# edit rule rule1
    
  3. Specify the name of the NAT term.

    content_copy zoom_out_map
    [edit services nat rule rule-name] 
     user@host# edit term term-name
    

    For example:

    content_copy zoom_out_map
    [edit services nat rule rule1] 
     user@host# edit term term1
    
  4. Define the match conditions for this rule.

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

      content_copy zoom_out_map
      [edit services nat rule rule-name term term-name]
      user@host# set from source-address source-address
      

      For example:

      content_copy zoom_out_map
      [edit services nat rule rule1 term term1]
      user@host# set from source-address 2000::2/128 
      
    • Specify the IPv6 destination address of the DNS server.

      content_copy zoom_out_map
      [edit services nat rule rule-name term term-name]
      user@host# set from destination-address prefix
      

      For example:

      content_copy zoom_out_map
      [edit services nat rule rule1 term term1] 
       user@host# set from destination-address 4000::2/128
      
    • Reference the DNS application to which the DNS traffic destined for port 53 is applied.

      content_copy zoom_out_map
      [edit services nat rule rule1 term term1] 
      user@host# set from applications application-name
      

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

      content_copy zoom_out_map
      [edit services nat rule rule1 term term1] 
      user@host# set from applications 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.

      content_copy zoom_out_map
      [edit services nat rule rule-name term term-name]
      user@host# set then translated source-pool nat-pool-name
      

      For example:

      content_copy zoom_out_map
      [edit services nat rule rule1 term term1] 
       user@host# set then translated source-pool pool1 
      
    • Apply the NAT pool configured for destination translation.

      content_copy zoom_out_map
      [edit services nat rule rule-name term term-name]
      user@host# set then translated destination-pool nat-pool-name
      

      For example:

      content_copy zoom_out_map
      [edit services nat rule rule1 term term1] 
       user@host# set then translated source-pool pool2 
      
  6. Define the DNS ALG 96-bit prefix for IPv4-to-IPv6 address mapping.

    content_copy zoom_out_map
    [edit services nat rule rule-name term term-name]
    user@host# set then translated dns-alg-prefix dns-alg-prefix
    

    For example:

    content_copy zoom_out_map
    [edit services nat rule rule1 term term1] 
     user@host# set then translated dns-alg-prefix 10:10:10::0/96 
    
  7. Specify the type of NAT used for source and destination traffic.

    content_copy zoom_out_map
    [edit services nat rule rule-name term term-name]
    user@host# set then translated translation-type basic-nat-pt
    

    For example:

    content_copy zoom_out_map
    [edit services nat rule rule1 term term1] 
    user@host# set then translated translation-type basic-nat-pt
    
    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.

    content_copy zoom_out_map
    [edit services nat rule rule-name]
    user@host# set match-direction (input | output)
    

    For example:

    content_copy zoom_out_map
    [edit services nat rule rule1] 
    user@host# set match-direction input
    
  9. Configure system logging to record information from the services interface to the /var/log directory.

    content_copy zoom_out_map
    [edit services nat rule rule-name term term-name]
    user@host# set then syslog 
    

    For example:

    content_copy zoom_out_map
     [edit services nat rule rule1 term term1]
    user@host# set then syslog 
    
Results

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

content_copy zoom_out_map
[edit services nat]
user@host# show 
rule rule1 {
    match-direction input;
    term term1 {
        from {
            source-address {
                2000::2/128;
            }
            destination-address {
                4000::2/128;
            }
            applications dns_alg;
        }
        then {
            translated {
                source-pool pool1;
                destination-pool pool2;
                dns-alg-prefix 10:10:10::0/96;
                translation-type {
                    basic-nat-pt;

                }
            }
            syslog;
        }
    }
}

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.

    content_copy zoom_out_map
    user@host# edit services nat
    
  2. Specify the name of the NAT rule and term.

    content_copy zoom_out_map
    [edit services nat] 
    user@host# edit rule rule-name term term-name
    

    For example:

    content_copy zoom_out_map
    [edit services nat] 
    user@host# edit rule rule2 term term1
    
  3. Define the match conditions for this rule:

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

      content_copy zoom_out_map
      [edit services nat rule rule-name term term-name]
      user@host# set from source-address source-address
      

      For example:

      content_copy zoom_out_map
      [edit services nat rule rule2 term term1]
      user@host# set from source-address 2000::2/128 
      
    • Specify the 96-bit IPv6 prefix to prepend to the IPv4 server address.

      content_copy zoom_out_map
      [edit services nat rule rule-name term term-name]
      user@host# set from destination-address prefix
      

      For example:

      content_copy zoom_out_map
      [edit services nat rule rule2 term term1] 
       user@host# set from destination-address 10:10:10::c0a8:108/128
      
  4. Define the actions to take when the match conditions are met.

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

      content_copy zoom_out_map
      [edit services nat rule rule-name term term-name]
      user@host# set then translated source-prefix source-prefix
      

      For example:

      content_copy zoom_out_map
      [edit services nat rule rule2 term term1] 
       user@host# set then translated source-prefix 19.19.19.1/32
      
  5. Specify the type of NAT used for source and destination traffic.

    content_copy zoom_out_map
    [edit services nat rule rule-name term term-name]
    user@host# set then translated translation-type basic-nat-pt
    

    For example:

    content_copy zoom_out_map
    [edit services nat rule rule2 term term1] 
    user@host# set then translated translation-type basic-nat-pt
    
    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.

    content_copy zoom_out_map
    [edit services nat rule rule-name]
    user@host# set match-direction (input | output)
    

    For example:

    content_copy zoom_out_map
    [edit services nat rule rule2] 
    user@host# set match-direction input
    
Results

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

content_copy zoom_out_map
[edit services nat]
user@host# show 
rule rule2 {
    match-direction input;
    term term1 {
        from {
            source-address {
                2000::2/128;
            }
            destination-address {
                10:10:10::c0a8:108/128;
            }
        }
        then {
            translated {
                source-prefix 19.19.19.1/32;
                translation-type {
                    basic-nat-pt;
                }
            }
        }
    }
}

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.

    content_copy zoom_out_map
    user@host# edit services
    
  2. Define a service set.

    content_copy zoom_out_map
    [edit services]
    user@host# edit service-set service-set-name
    

    For example:

    content_copy zoom_out_map
    [edit services]
    user@host# edit service-set ss
    
  3. Specify properties that control how system log messages are generated for the service set.

    content_copy zoom_out_map
    [edit services service-set ss]
    user@host# set syslog host local services severity-level
    

    The example below includes all severity levels.

    content_copy zoom_out_map
    [edit services service-set ss]
    user@host# set syslog host local services any
    
  4. Specify the stateful firewall rule included in this service set.

    content_copy zoom_out_map
    [edit services service-set ss]
    user@host# set stateful-firewall-rules rule1 severity-level
    

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

    content_copy zoom_out_map
    [edit services service-set ss]
    user@host# set stateful-firewall-rules rule1
    
  5. Define the NAT rules included in this service set.

    content_copy zoom_out_map
    [edit services service-set ss]
    user@host# set nat-rules rule-name
    

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

    content_copy zoom_out_map
    [edit services service-set ss
    user@host# set nat-rules rule1
    user@host# set nat-rules rule2
    
  6. Configure an adaptive services interface on which the service is to be performed.

    content_copy zoom_out_map
    [edit services service-set ss]
    user@host# set interface-service service-interface interface-name
    

    For example:

    content_copy zoom_out_map
    [edit services service-set ss
    user@host# interface-service service-interface ms-2/0/0
    

    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.

content_copy zoom_out_map
[edit services]
user@host# show 
service-set ss {
    syslog {
        host local {
            services any;
        }
    }
    stateful-firewall-rules rule1;
    nat-rules rule1;
    nat-rules rule2;
    interface-service {
        service-interface ms-2/0/0;
    }
}

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.

    content_copy zoom_out_map
    user@host# edit services stateful firewall
    
  2. Specify the name of the stateful firewall rule.

    content_copy zoom_out_map
     [edit services stateful-firewall]
    user@host# edit rule rule-name
    

    For example:

    content_copy zoom_out_map
     [edit services stateful-firewall] 
    user@host# edit rule rule1
    
  3. Specify the direction in which traffic is to be matched.

    content_copy zoom_out_map
    [edit services stateful-firewall rule rule-name]
    user@host# set match-direction (input | input-output | output)
    

    For example:

    content_copy zoom_out_map
     [edit services stateful-firewall rule rule1] 
    user@host# set match-direction input-output
    
  4. Specify the name of the stateful firewall term.

    content_copy zoom_out_map
     [edit services stateful-firewall rule rule-name] 
    user@host# edit term  term-name
    

    For example:

    content_copy zoom_out_map
     [edit services stateful-firewall rule rule1] 
    user@host# edit term term1 
    
  5. Define the terms that make up this rule.

    content_copy zoom_out_map
     [edit services stateful-firewall rule rule-name term term-name] 
    user@host# set then accept 
    

    For example:

    content_copy zoom_out_map
     [edit services stateful-firewall rule rule1 term term1]
    user@host# set then accept 
    
Results

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

content_copy zoom_out_map
[edit services]
user@host# show 
stateful-firewall {
    rule rule1 {
        match-direction input-output;
        term term1 {
            then {
                accept;
            }
        }
    }
}

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.

    content_copy zoom_out_map
    user@host# edit interfaces
    
  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.

      content_copy zoom_out_map
      [edit interfaces]
      user@host# set ge-1/0/9 unit 0 family inet address 30.1.1.1/24 
      
    • Apply the service set defined in Configuring Interfaces.

      content_copy zoom_out_map
      [edit interfaces]
      user@host# set ge-1/0/9 unit 0 family inet6 service input service-set ss
      user@host# set ge-1/0/9 unit 0 family inet6 service output service-set ss 
      
    • For IPv6 traffic, specify the IPv6 address.

      content_copy zoom_out_map
      [edit interfaces]
      user@host# set ge-1/0/9 unit 0 family inet6 address 2000::1/64
      
  3. Specify the interface properties for the services interface that performs the service.

    content_copy zoom_out_map
    [edit interfaces]
    user@host# set ms-2/0/0 services-options syslog host local services any
    user@host# set ms-2/0/0 unit 0 family inet
    user@host# set ms-2/0/0 unit 0 family inet6
    
Results

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

content_copy zoom_out_map
[edit interfaces]
user@host# show 

ge-1/0/9 {
    unit 0 {
        family inet {
            address 30.1.1.1/24;
        }
        family inet6 {
            service {
                input {
                    service-set ss;
                }
                output {
                    service-set ss;     
                }
            }
            address 2000::1/64;
        }
    }
}

ms-2/0/0 {
    services-options {
        syslog {
            host local {
                services any;
            }
        }
    }
    unit 0 {
        family inet;
        family inet6;
    }
}
footer-navigation