Cisco IOS NAT – Inside Static NAT Mapping for Multiple External IPs

cisco-iosnat;

Will the following work?

ip nat inside source static 1.1.1.1 2.2.2.2 route-map x
ip nat inside source static 1.1.1.1 2.2.2.3 route-map x

(say the remote net is 20.20.20.0 in both cases)

What I'm not sure about is if the reply to an access from outside can be translated properly.

Client 20.20.20.1:1234 sends a packet to Server 2.2.2.2:5678 which internally becomes 1.1.1.1:5678.

Server 1.1.1.1:5678 then sends a reply packet to 20.20.20.1:1234.

What does the router do with this?

Will it translate the reply's source address to 2.2.2.2 or 2.2.2.3?
From the above, at first sight both are possible.
Does it take the initial socket into account and reply using the address on which it was contacted in the first place?

Best Answer

The router looks at the complete socket (protocol, source/destination ip and port) which allows it to have a 1:1 relationship for any connection.

So yes, it does work.