If you want to perform destination address translation, you can enable address translation on the VIP. LTM will then translate the destination address to the selected pool member’s IP address. If you want to do this dynamically in an iRule, you can use the node command (Click here). LTM will undo the translation for responses back to the client using its connection table to track the original IP address.
First of all, IP::remote_addr is a command, not a variable, so you can’t change it this way. Secondly, it would return your client IP address (source), not the destination. You need to use the “pool” command in order to change the destination of the packet, with or without destination NAT.
when CLIENT_ACCEPTED {
set firstIP [IP::local_addr]
pool pool_172.16.49.70
}
I don´t think you can insert the old IP in the packet. If we’re talking about HTTP, you could insert an HTTP header containing it, like an “X-forwarded-for” header
when HTTP_REQUEST {
HTTP::header First_IP [IP::local_addr]
pool pool_172.16.49.70
}
However, maybe it is a lot easier than you think. It seems that you need to reroute traffic through the second LTM, right? So you need to forward traffic to 172.16.49.70 and let this one make the routing decisions based on destination IP address.
Maybe you can make it by selecting this IP as the pool and disabling the destination NAT.
To change destination IP, you need to enable address translation in virtual configuration, assign pool or use node command in iRule. (I believe it is what hoolio and mgabaldon point out earlier.)