NAT Question

Unanswered Question
Oct 17th, 2007

Im am setting up a static NAT with route-map for a client. I want this address to be NAT'd to a specific address based on destination. Now, I know how to setup the NAT and the Route-Map but my question is will this work backwards? So for example say I have this configuration.

int fa0/1

ip address

ip nat inside

int s0/1

ip address

ip nat outside

ip nat inside source static route-map MYMAP

route-map MYMAP permit 10

match ip address 101

access-list 101 permit ip host

Will this only work for translation going from inside to outside? Or will I need to make a reverse config for outside to inside?

  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 4 (2 ratings)
Kevin Dorrell Wed, 10/17/2007 - 07:12

It is a strange thing about ip nat inside source, that it is also the command you use to translate the destination address for packets coming in from the outside. So yes, it should work.

I am struggling with the access-list at the moment. I would try starting with an "any any" access list, get the translation working, and experiment from there.

I believe the access list needs to pair the outside global source address with the outside global destination address. In other words, access-list 101 permit ip any host Which actually is not really needed since your translation command is 1-to-1 anyway.

But please correct me if I am wrong, someone with more familiarity with NAT.

Kevin Dorrell


thefindjack Wed, 10/17/2007 - 07:37

Really what Im trying to do is to use this like you would use Policy NAT (based on destination) on a PIX. So Im trying to NAT an address only based on destination. Would this work this way? And also you think that I need to used the global outside address in my access-list?


Kevin Dorrell Wed, 10/17/2007 - 07:42

Even without the route-map, it would only translate for packets addressed to

If you want, you can go even further without the route map, to restrict it to packets addressed to a certain port of, and even translate them into a different port number on

Kevin Dorrell


thefindjack Wed, 10/17/2007 - 07:50

But without the route-map wouldnt that be a static 1 to 1 translation for the inside interface to the outside interface? I only want it to nat if Im trying to hit a certain outside subnet...thanks for you continued help

Kevin Dorrell Wed, 10/17/2007 - 10:09

OK, I think I begin to understand what you are trying to do. Let me paraphrase it to see if I got it right.

There is some remote network with address You want them to be able to send you packets to address When they do so, you want them to be redirected to your inside server at And of course, for the return packets to be translated correspondingly.

If that is so, then I think your access-list is correct because it has to be seen from the point of view of the outgoing packets. My only doubt is whether the host part should be or

I would like to try it in the lab.

Kevin Dorrell


Kevin Dorrell Wed, 10/17/2007 - 10:32

Oh, I just started to try it in the lab, and I noticed the mask in your access-list is upside down. PIX uses subnet masks, but router access lists use wildcard masks. It should be

I'll let you know when I have results.

Kevin Dorrell


Kevin Dorrell Wed, 10/17/2007 - 11:07

I am learning! I set up something like your scenario, but with the addresses changed to fit in with a lab I happened to have loaded on my rack. It set up exactly your configuration, but with the mask in the access list changed to I shall translate addresses into your scenario for clarity.

I put ICMP debug on the source and destination (routers), and pinged your address. A ping from to arrived at the destination looking like it came from to The reply packet was translated in the other direction, i.e. it was S=, D= So far so good - the translation was working.

I then pinged from an address that was off the access list: (S=, D= It arrived at the destination looking like S=, D= That is, although the source was off the route map, the translation still took place. The destination reply in the normal way. But when the reply packet got back, it was S=, D= So in other words, the route map did not prevent the translation of the incoming ping, but did prevent the translation of the reply.

IOS 12.2(15)T17 throughout.

That is not really what you want. I shall go back to the drawing board. Sorry.

Going the other way, generating the ping from inside, work perfectly. If I pinged something covered by the route map, then my source address was translated OK, and the destination of the reply accordingly. If I pinged something off the access-list, then no translation took place in either direction.

(Thinking about it, maybe that was what you were after in the first place!)

Kevin Dorrell


thefindjack Thu, 10/18/2007 - 07:19

That is exactly what I was looking for....only translation based on the access-list. I did notice I put the mask in incorrectly, Im used to PIX! I did get this working for the client. Thanks for your diligent work on this, I guess though you were doing it for the same reason I was asking, to learn something new, thats what keeps this interesting. Thanks Again



This Discussion