# Redirect traffic based on Destination IP

**URL:** <https://community.a10networks.com/t/redirect-traffic-based-on-destination-ip/823>\
**Category:** aFleX\
**Tags:** redirect, aflex, slb-adc\
**Created:** [January 31, 2024, 4:12pm UTC](https://community.a10networks.com/t/redirect-traffic-based-on-destination-ip/823 "2024-01-31T16:12:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![anfovar](https://avatars.discourse-cdn.com/v4/letter/a/bc79bd/32.png) [@anfovar](https://community.a10networks.com/u/anfovar)\
**Post date:** [January 31, 2024, 4:12pm UTC](https://community.a10networks.com/t/redirect-traffic-based-on-destination-ip/823/1 "2024-01-31T16:12:13Z")

</div>

Hi guys  
I´m trying to redirect traffic based on destination IP using an Aflex, for example if a internal user sends traffic to 20.20.20.20 the A10 will redirect the traffic to a specified service group

Aflex:

Test #1

when CLIENT\_ACCEPTED {  
if { [IP::addr [IP::remote\_addr] equals 20.20.20.20] } {  
pool APACHE  
}  
}

Test #2&nbsp;  
when CLIENT\_ACCEPTED {  
if { [IP::addr [clientside {IP::remote\_addr}] equals 20.20.20.20 ] } {  
pool APACHE  
}  
}

Virtual Server config:

slb virtual-server WILDCARD 0.0.0.0  
&nbsp;port 0 others  
&nbsp;&nbsp;aflex RED  
&nbsp;&nbsp;service-group ISP-2-TCP  
&nbsp;&nbsp;use-rcv-hop-for-resp  
&nbsp;port 0 tcp  
&nbsp;&nbsp;aflex RED  
&nbsp;&nbsp;service-group ISP-2-TCP  
&nbsp;&nbsp;use-rcv-hop-for-resp  
&nbsp;port 0 udp  
&nbsp;&nbsp;aflex RED  
&nbsp;&nbsp;service-group ISP-2-UDP  
&nbsp;&nbsp;use-rcv-hop-for-resp  
Traffic Debugged  
@4335587800 i( 2,&nbsp;&nbsp;1)\> ip 172.16.30.100 \> 20.20.20.20 tcp&nbsp;64987 \> 443 S 7281f5f5:0(0) \<msw, m=1460,w=8\>  
@4335587800 o( 4,&nbsp;&nbsp;0)\> ip 172.16.30.100 \> 20.20.20.20 tcp&nbsp;64987 \> 443 S 7281f5f5:0(0) \<msw, m=1460,w=8\>  
@4335587807 i( 2,&nbsp;&nbsp;1)\> ip 172.16.30.100 \> 20.20.20.20 tcp&nbsp;64988 \> 443 S d0ce6dba:0(0) \<msw, m=1460,w=8\>  
@4335587807 o( 4,&nbsp;&nbsp;0)\> ip 172.16.30.100 \> 20.20.20.20 tcp&nbsp;64988 \> 443 S d0ce6dba:0(0) \<msw, m=1460,w=8\>

---

<div class="post-metadata">

**Author:** ![mdunn](https://avatars.discourse-cdn.com/v4/letter/m/87869e/32.png) [@mdunn](https://community.a10networks.com/u/mdunn)\
**Post date:** [February 8, 2024, 8:48pm UTC](https://community.a10networks.com/t/redirect-traffic-based-on-destination-ip/823/2 "2024-02-08T20:48:28Z")

</div>

I suspect the IP returned with IP::remote\_addr is not the expected value. Note the usage of this statement:

> [@](#):
>
> This command will return the IP address of the host at the far end of the connection. From the clientside position, this is the client IP address. From the serverside position, this is the node IP address. The IP::client\_addr and IP::server\_addr commands can also be specified.

1. This may be simpler to implement with one of these approaches:  
Configure a VIP with IP address 20.20.20.20 with your APACHE service-group
2. Configure an additional wildcard VIP with an ACL to match destination 20.20.20.20. Set the APACHE service-group to this wildcard VIP

One other thought is that traditionally wildcard VIPs, especially those used for NHLD, have “no-dest-nat” configured, so selecting a different pool will not perform a DNAT on the traffic. Would one of the above approaches work for your use-case?
