Forum Discussion

jkotsay_44216's avatar
jkotsay_44216
Icon for Nimbostratus rankNimbostratus
Sep 09, 2008

Using IRule to direct traffic from specific source to VIP on another LTM

Hi, just wondering if anyone might have a sample of an irule that routes traffic to a certain vip based on source address criteria. In my case, I'd actully like to direct traffic to a vip on another ltm.

 

 

Something like...

 

 

if source = 10.1.2.0/24 then forward to vip address = 10.0.1.1

 

 

The irule would be running on one ltm and the vip address 10.0.1.1 would running on a different ltm (they can route to one another).

 

 

Thanks,

 

John

1 Reply

  • Hi John,

    Which LTM version are you running? Is it 9.4.0 or higher? Do you want the destination address translated when you forward it to the second LTM's virtual server? Or are you trying to forward the connection request to the second VIP with the client's original destination IP? If the latter, you could use something like this:

     
     when CLIENT_ACCEPTED { 
      
        log local0. "[IP::client_addr]:[TCP::client_port] -> [IP::local_addr]:[TCP::local_port]" 
      
         Check the source IP 
        if {[IP::addr [IP::client_addr] mask 255.255.255.0 equals 10.1.2.0]}{ 
      
           log local0. "[IP::client_addr]:[TCP::client_port]: matched IP check.  Routing to 10.0.1.1." 
      
           node 10.0.1.1 
        } 
     } 
     

    IP::addr (Click here)

    node (Click here)

    Aaron