4

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?

2
  • Cisco NAT Order of Operations: cisco.com/c/en/us/support/docs/ip/…
    – Ricky
    Mar 27, 2015 at 22:45
  • Depends on what the route-map(s) apply. As long as routing brings the traffic back to the same path, the existing NAT translation will match.
    – Ricky
    Mar 27, 2015 at 22:47

2 Answers 2

3

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.

2

You are correct. The device will respond with a source address of the original request.

  • If the client contacts 2.2.2.2, the reply will be from 2.2.2.2.
  • If the client contacts 2.2.2.3, the reply will be from 2.2.2.3.
1
  • Can you elaborate why? Finally, I think this works correctly because 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.
    – Marki
    Mar 27, 2015 at 21:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.