IP Prefix NAT
The NetScaler appliance supports translating a part of the source IP address instead of the complete address of packets received on the appliance. IP prefix NAT includes changing one or more octets or bits of the source IP address.
The NetScaler appliance supports IP prefix NAT for traffic related to virtual servers and services for which the NetScaler does not maintain any session information. For example, virtual servers and services of type ANY, UDP, and DNS.
Use Case: Zonification of Clients for a Deployment of a NetScaler appliance and an Optimization Device
IP prefix NAT is very useful in a deployment that includes a NetScaler appliance and an optimization device (for example, Citrix ByteMobile). This type of deployment has different geographically located client networks, which share the same network address. The NetScaler appliance must send the traffic received from each of the client networks to the optimization device before forwarding to the destination.
The device sends the optimized traffic back to the NetScaler appliance. Because the optimization requirement is different for traffic from each client network, the optimization device must recognize the client network of each packet that it receives. The solution is to segregate traffic from each client network into a different zone by using VLANs. IP prefix NAT with a different setting is configured for each zone. The NetScaler appliance translates the last octet of the source IP address of every packet, and the translated octet value is different for each zone.
Consider an example of two zones, Z1 and Z2, sharing network address 192.0.2.0/24. On the NetScaler appliance, IP prefix NAT entities named natrule-1 and natrule-2 are configured for these two zones. Before the appliance forwards a packet from Z1, natrule-1 translates the last octet of the packet’s source IP address to 100. Similarly, for packets from Z2, natrule-2 translates the last octet of the source IP address to 200. For two clients, CL1-Z1 in zone Z1 and CL1-Z2 in zone Z2, each with IP address 192.0.2.30, the NetScaler appliance translates the source IP address of CL1-Z1’s packets to 188.8.131.52 and of CL1-Z2’s packets to 184.108.40.206. The optimization device to which the NetScaler appliance sends the translated packets is configured to use a packet’s source IP address to recognize the zone, so it applies the appropriate optimization configured for the zone from which the packet originated.
Configuring IP prefix NAT consists of the following steps:
Create a net profile and set the NAT Rule parameter of a net profile. A NAT rule specifies two IP addresses and a net mask. The first IP address (specified by IP Address parameter) is the source IP address that is to be translated with the second one (specified by IP Rewrite parameter). The net mask specifies the part of the source IP address that is to be translated with the same part of the second IP address.
Bind the net profile to load balancing virtual servers or services. A net profile with NAT rule setting can be bound to a virtual server or service of only type ANY, UDP, or DNS. After binding a net profile to a virtual server or service, the NetScaler appliance matches the source IP address of the incoming packets related to the virtual server or service with the NAT rule setting. The NetScaler then performs IP prefix NAT for packets that match the NAT rule.
To configure IP prefix NAT translation by using the command line:
At the command prompt, type:
- bind netProfile <name> (-natRule <ip_addr> <netmask> <rewriteIp>)
- show netprofile <name>
To configure IP prefix NAT by using the NetScaler GUI:
Navigate to System > Network > Net Profiles.
Set the following parameters under NAT Rules while adding or modifying NetProfiles.
- IP Address
- Rewrite IP
In the following sample configuration, net profile PARTIAL-NAT-1 has IP prefix NAT settings and is bound to load balancing virtual server LBVS-1, which is of type ANY. For packets received on LBVS-1 from 192.0.0.0/8, the NetScaler appliance translates the last octet of the packet’s source IP address to 100. For example, a packet with source IP address 192.0.2.30 received on LBVS-1, the NetScaler appliance translates the source IP address to 220.127.116.11 before sending it one of the bound servers.
> add netprofile PARTIAL-NAT-1 Done > bind netprofile PARTIAL-NAT-1 –natrule 192.0.0.0 255.0.0.0 18.104.22.168 Done > add lb vserver LBVS-1 ANY 203.0.113. 61 * -netprofile PARTIAL-NAT-1 Done <!--NeedCopy-->