cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
740
Views
5
Helpful
5
Replies

NAT to different inside locals based on source address

rrich
Level 1
Level 1

Hi,

I have a customer that is migrating a large number of their business partners through different releases of a B2B solution. While this migration happens, it is very important to the customer that the internet facing IP address of the service they are providing remain constant.

Because of existing requirements, they have the IP address ranges of every customer that is using this service. What they would like to do is forward traffic from, say, cust A, B and D to internal server X, cust C, E, and F to server Y, and the rest to Z.

Roughly, it would look like this:

cust A [11.11.11.11] -> internet addr [44.44.44.44] -> server X [10.1.1.1]

cust B [22.22.22.22] -> internet addr [44.44.44.44] -> server X [10.1.1.1]

cust C [8.80.180.88] -> internet addr [44.44.44.44] -> server Y [10.4.4.4]

cust D [201.2.44.14] -> internet addr [44.44.44.44] -> server X [10.1.1.1]

cust E [102.43.77.4] -> internet addr [44.44.44.44] -> server Y [10.4.4.4]

cust F [99.10.107.3] -> internet addr [44.44.44.44] -> server Y [10.4.4.4]

I was going to try this using the new inside source static feature that uses route-maps, but this doesn't allow me to setup multiple translations with the same inside global.

I was also going to try inside source using pools and lists

thoughts?

thanks

5 Replies 5

stierb
Level 1
Level 1

Is this traffic TCP? If so, inside destination NAT may work for you (as long as your IOS version supports it). I can provide a config example if needed.

Yes,

The traffic is TCP (HTTP)

Any examples would be greatly appreciated!!!!

Thanks

Bob

try something like:

(z.z.z.z is the public address you want translated to your different web servers based on source address)

ip nat pool serverX x.x.x.x x.x.x.x prefix-length 24 type rotary

ip nat pool serverY y.y.y.y y.y.y.y prefix-length 24 type rotary

(note: start address is same as end address - the router will probably warn you of strange behavior)

ip nat inside destination list 101 pool serverX

ip nat inside destination list 102 pool serverY

access-list 101 remark permit lines here nat hosts to serverX

access-list 101 permit tcp host a.a.a.a host z.z.z.z eq http

access-list 101 permit tcp host b.b.b.b host z.z.z.z eq http

access-list 102 remark permit lines here nat hosts to serverY

access-list 102 permit tcp host c.c.c.c host z.z.z.z eq http

access-list 102 permit tcp host d.d.d.d host z.z.z.z eq http

using the above example, all your customers connect to ip address z.z.z.z, TCP port 80. This traffic should enter the interface on your router that is configured as 'ip nat outside'. The interface facing your servers is configured 'ip nat inside'. The source ip address (the customer's server) will match a permit statement in an access list (if it matches none, it is not translated). Whichever ip nat inside destination statement that access-list is used on will do the translation. You may also want to watch your translation table - and lower the relevant translation timeouts if necessary.

Let me know if you need more details.

This looks great!

Is there any issue if the pool address ranges overlap? ie:

ip nat pool serverX 10.0.0.1 10.0.0.1 prefix-length 24 type rotary

ip nat pool serverY 10.0.0.5 10.0.0.5 prefix-length 24 type rotary

The ranges in the two pools don't overlap, but they do share a network given the /24 prefix. Should i make sure that the prefixes don't overlap as well? ie:

ip nat pool serverX 10.0.0.1 10.0.0.1 prefix-length 30 type rotary

ip nat pool serverY 10.0.0.5 10.0.0.5 prefix-length 30 type rotary

(i also read something about the all-zeroes subnet being problematic, but that's easy enough to work around)

Thanks again for all of your help!!!

Bob

Hey,

Just wanted to thank you again for the input. We've got a working config up and running...

Thanks again!

Bob