cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
750
Views
8
Helpful
8
Replies

NAT Question

thefindjack
Level 1
Level 1

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 10.10.2.1 255.255.255.0

ip nat inside

int s0/1

ip address 172.25.20.1 255.255.255.0

ip nat outside

ip nat inside source static 10.10.2.140 172.25.20.10 route-map MYMAP

route-map MYMAP permit 10

match ip address 101

access-list 101 permit ip host 10.10.2.140 172.25.19.0 255.255.255.0

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

8 Replies 8

Kevin Dorrell
Level 10
Level 10

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 172.25.20.10. 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

Luxembourg

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?

Thanks

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

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

Kevin Dorrell

Luxembourg

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

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 172.25.19.0/24. You want them to be able to send you packets to address 172.25.20.10. When they do so, you want them to be redirected to your inside server at 10.10.2.140. 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 10.10.2.140 or 172.25.20.10.

I would like to try it in the lab.

Kevin Dorrell

Luxembourg

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 0.0.0.255.

I'll let you know when I have results.

Kevin Dorrell

Luxembourg

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 0.0.0.127. I shall translate addresses into your scenario for clarity.

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

I then pinged from an address that was off the access list: (S=172.25.19.164, D= 172.25.20.10). It arrived at the destination looking like S=172.25.19.164, D=10.10.2.140. 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=10.10.2.140, D=172.25.19.164. 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

Luxembourg

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

David

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Review Cisco Networking products for a $25 gift card