Example: Configuring Inline Network Address Translation - Interface-Service Service Set
Requirements
This example uses the following hardware and software components:
- MX-series router
- Modular Port Concentrator (MPC) Type 1, 2, or 3
- Junos OS Release 11.4R1 or higher
Overview
This example is configured for the network of a large financial services firm. This Application Service Provider (ASP) has an IP/MPLS-based backbone and provides L3VPN connectivity. In our example, the ASP acts like an Internet Service Provider (ISP) and its servers have public IPv4 addresses.
A large subscriber base relies heavily on the market data feeds that the ASP provides. Like many of the enterprise networks today, a private addressing scheme has been in place for majority of ASP’s customers. NAT is required to maintain access to ASP’s shared services.
Requirements for the solution include:
- Ease subscriber addressing challenges of their by providing NAT services in ASP’s network.
- Support access to common services by a large number of customers, even when these are hosted across in different VRFs and use overlapping addresses.
- Provide high throughput, low latency packet forwarding with NAT enabled.
- Provide operational simplicity and efficiency.
- Reduce cost of operations.
By deploying Juniper’s MX’s inline NAT service, the ASP can offer scalable solutions with uncompromised performance that fit the requirements of financial markets customers. Operational cost can be dramatically reduced by eliminating the need for a dedicated services PIC. Enabling subscribers to keep their existing addressing scheme by outsourcing the address translation function to the ASP greatly simplifies their network operations.
Topology
The topology for this application is show in Figure 1
The ASP’s shared services are located on LAN segment 101.1.1.0/24 behind PE3. PE1 and PE2 are used to connect subscribers. Traditional MPLS-VPN is deployed between provider edge routers. In the case of PE1, subscriber A and B have overlapping addressing schemes of 10.1.1.0/24; NAT is needed so the subscribers can access the same server. NAT pools 192.168.1.0/24 and 192.168.2.0/24 have been allocated to customer A and B respectively.
We will use host 10.1.1.2 from customer A to illustrate packet flow at a high level, as shown in Figure 1
Figure 1: Deploy Inline NAT within L3VPN

- CE1 forwards request from host 10.1.1.2 with a server destination of 101.1.1.2
- With configured service set on PE1 for VRF_A, source address of 10.1.1.2 will be translated into 192.168.1.2. VPN label and IGP label will be imposed after the translation.
- Packets will then be forwarded to PE3 using IGP label
- PE3 receives the packet and performs a lookup in its VPN routing table. It then forwards the packets to server 101.1.1.2 after label disposition.
- The server returns the packet with destination address of 192.168.1.2.
- PE3 imposes VPN and IGP labels for the above destination and label switched the packets to PE1.
- PE1 sends the packet to VRF_A after a FIB lookup. Destination address 192.168.1.2 will be translated 10.1.1.2.
- CE1 receives the packets for host 10.1.1.2 and forwards them on.
Configuration
By using a si- (service-inline) interface, the operator can configure both interface-service and next-hop service-sets to perform inline NAT. This example uses the interface-service service set.
To configure inline NAT, perform these tasks:
- Configure Interfaces
- Configuring Bandwidth for the Service Inline (si-) Interface
- Configuring NAT Pool and Rule
- Configuring the Service Set
CLI Quick Configuration
To quickly configure this example, copy the following commands, paste them into a text file, remove any line breaks, change any details necessary to match your network configuration, and then copy and paste the commands into the CLI at the [edit] hierarchy level.
Configure Interfaces
Step-by-Step Procedure
To configure interfaces required for inline NAT:
- Configure the inline interface for NAT services.user@host# edit interfaces si-0/0/0[edit interfaces si-0/0/0]user@host# set unit 0 family inet
- Configure the interface for traffic to be handled by service
set nat1user@host# edit interfaces ge-1/0/0[edit interfaces ge-1/0/0]user@host# edit unit 0 family inet service[edit unit 0 family inet service]user@host# set input service-set nat1 output service-set nat1user@host# set address 10.1.1.1/24
- Configure the interface for traffic to be handled by service
set nat2user@host# edit interfaces ge-1/0/1[edit interfaces ge-1/0/0]user@host# edit unit 0 family inet service input service[edit unit 0 family inet service]user@host# set input service-set nat2 output service-set nat2user@host# set address 192.168.1.1/24
- Configure the interface for traffic to be handled by service
set nat3user@host# edit interfaces ge-1/0/2[edit interfaces ge-1/0/0]user@host# edit unit 0 family inet service input service[edit unit 0 family inet service]user@host# set input service-set nat3 output service-set nat3user@host# set address 10.1.1.100/24
Results
si-0/0/0 {
unit 0 {
family inet;
}
}
ge-1/0/0 {
unit 0 {
family inet {
service {
input {
service-set nat1;
}
output {
service-set nat1;
}
}
address 10.1.1.1/24;
}
}
}
ge-1/0/1 {
unit 0 {
family inet {
service {
input {
service-set nat2;
}
output {
service-set nat2;
}
}
address 192.168.1.1/24;
}
}
}
ge-1/0/2 {
unit 0 {
family inet {
service {
input {
service-set nat3;
}
output {
service-set nat3;
}
}
address 10.1.1.1/24;
}
}
}
Configuring Bandwidth for the Service Inline (si-) Interface
Step-by-Step Procedure
- Go to the configuration hierarchy for the fpc and pic
used for inline NAT services.
user@host# edit chassis fpc 0 pic 0[edit chassis fpc - pic 0] - Set the bandwidth for inline services.[edit chassis fpc 0 pic 0]user@host# set inline-services bandwidth 10g
Configuring NAT Pool and Rule
Step-by-Step Procedure
- Go to the services NAT hierarchy.user@host# edit services nat
- Configure three NAT pools.[edit services nat]user@host# set pool p1 address 20.1.1.0/24user@host# set pool p2 address 21.1.1.2/32user@host# set pool p3 address 120.1.1.1/32
- Configure NAT rule for source pool p1.[edit services nat]user@host# set rule r1 match-direction inputuser@host# set rule r1 term t1 from source-address 10.1.1.0/24user@host# set rule r1 term t1 then translated source-pool p1 translation-type basic-nat44
- Configure NAT rule for source pool p2.[edit services nat]user@host# set rule r2 match-direction inputuser@host# set rule r2 term t1 from source-address 192.168.1.2/32user@host# set rule r2 term t1 then translated source-pool p2 translation-type basic-nat44
- Configure NAT rule for source pool p3.[edit services nat]user@host# set rule r3 match-direction inputuser@host# set rule r3 term t1 from source-address 10.1.1.8/32user@host# set rule r3 term t1 then translated source-pool p3 translation-type basic-nat44
Results
user@host# edit services natuser@host# show
pool p1 {
address 20.1.1.0/24;
}
pool p2 {
address 21.1.1.2/32;
}
pool p3 {
address 120.1.1.1/32;
}
rule r1 {
match-direction input;
term t1 {
from {
source-address {
10.1.1.0/24;
}
}
then {
translated {
source-pool p1;
translation-type {
basic-nat44;
}
}
}
}
}
rule r2 {
match-direction input;
term t1 {
from {
source-address {
192.168.1.2/32;
}
}
then {
translated {
source-pool p2;
translation-type {
basic-nat44;
}
}
}
}
}
rule r3 {
match-direction input;
term t1 {
from {
source-address {
10.1.1.8/32;
}
}
then {
translated {
source-pool p3;
translation-type {
basic-nat44;
}
}
}
}
}Configuring the Service Set
Step-by-Step Procedure
- Configure a service set using NAT rule r1, associated
with NAT pool p1.user@host# edit services service-set nat1[edit services service-set nat1]user@host# set nat rules r1user@host# set interface-service service-interface si-0/0/0.0
- Configure a service set using NAT rule r2, associated
with NAT pool p2.user@host# edit services service-set nat2[edit services service-set nat1]user@host# set nat rules r2user@host# set inerface-service service-interface si-0/0/0.0
- Configure a service set using NAT rule r3, associated
with NAT pool p3.user@host# edit services service-set nat3[edit services service-set nat1]user@host# set nat rules r3user@host# set interface-service service-interface si-0/0/0.0
Results
user@host# edit services service-set nat1user@host# shownat-rules r1;
interface-service {
service-interface si-0/0/0.0;
}
user@host# edit services service-set nat2user@host# shownat-rules r2;
interface-service {
service-interface si-0/0/0.0;
}
user@host# edit services service-set nat3user@host# shownat-rules r3;
interface-service {
service-interface si-0/0/0.0;
}