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?

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.

| improve this answer | |
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.
| improve this answer | |
  • 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 '15 at 21:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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