NAT - ip nat inside destination
When implementing Network Address Translation (NAT) it is possible to use the following command:
ip nat inside destination
The ip nat inside destination
command is used to translate the destination IP address of incoming packets. This is typically used for scenarios like server load balancing or to redirect traffic to internal hosts. The command maps an external destination IP address to a specific internal IP address based on a configured mapping. It is often used with static NAT to handle cases where multiple public IP addresses point to different internal servers or services.
This command is often used to implement TCP load balancing by performing destination address rotary translation.
Example configuration using rotary translation
The following configuration example demonstrates defining a virtual IP address that balances traffic among multiple internal hosts. The rotary pool
specifies the actual internal server addresses, while an access list identifies the virtual address. When traffic arrives on the outside interface (e.g., GigabitEthernet 0/0/0) and matches the access list, the router translates the destination address to one of the internal hosts' addresses from the rotary pool, provided no existing translation is already established.
ip nat pool my_pool 192.168.15.2 192.168.15.15 prefix-length 28 type rotary ip nat inside destination list 2 pool my_pool ! interface GigabitEthernet 0/0/0 ip address 192.168.15.129 255.255.255.240 ip nat outside ! interface GigabitEthernet 0/0/1 ip address 192.168.15.17 255.255.255.240 ip nat inside ! access-list 2 permit 192.168.15.1