Cisco Support Community
Community Member

Changed source address based on destination IP



Suppose I had the following configuration in an IOS router


interface <interface type/number>

 ip address secondary

 ip address


ip route


access-list standard INTERNET_BOUND_ACL

 permit <lan subnet-id> <lan wildcard>


ip nat inside source list INTERNET_BOUND_ACL interface <interface type/number> overload



I need to change the source inside global IP address based on the destination outside global IP address.


Example: I need our source IP to be when I ping


How would i accomplish this?


You could do this with NAT.

You could do this with NAT. You may need PBR as well if there are only certain destinations you would to NAT and not all destinations.
Cisco Employee

Hi,You would need to use two


You would need to use two NAT pools and two different ACLs to separate your internal clients depending on the destination they want to communicate with, and to subsequently NAT them using a selected NAT pool. For example:

ip access-list extended NAT_2
  permit ip <LAN Network> <Wildcard> <DestinationX> <WildcardX>
ip access-list extended NAT_3
  permit ip <LAN Network> <Wildcard> <DestinationY> <WildcardY>
ip nat pool NATPOOL_2 netmask
ip nat pool NATPOOL_3 netmask
ip nat inside source list NAT_2 pool NATPOOL_2 overload
ip nat inside source list NAT_3 pool NATPOOL_3 overload

Exactly one of the ACLs should actually contain an entry saying

permit ip <LAN Network> <Wildcard> any

to make sure that the internal network gets translated to some of the two public addresses even if itt does not communicate with any specific destination IP.

Do you believe this could be a workable solution for you?

Best regards,

CreatePlease to create content