Forum Discussion

Filip_Verlaeckt's avatar
Filip_Verlaeckt
Historic F5 Account
Aug 09, 2007

"FOR" statement

Hi

 

 

I want to lookup the source ip of a connection in a list and then forward the connection to the corresponding address in that list.

 

 

Something like:

 

 

LIST

 

 

Source IP Destination IP

 

1 a

 

2 b

 

3 c

 

4 d

 

 

etc....

 

 

Can I do this with an iRule avoiding using too many if...elseif....elseif statements?

 

I would prefer to read the entries and mapping IPs from a list or file.

 

 

Anyone done this before?

 

 

Thanks

 

 

Filip

2 Replies

  • Hi Filip,

     

     

    You can create a datagroup (also known as a class in the config files) and then use the findclass command (Click here) to search the class for the source IP and return the destination IP. You could then use the pool or node command to set the destination IP.

     

     

    You can create a datagroup in the GUI under Local Traffic >> iRules >> Datagroup tab. You can check the wiki page or search for findclass to get some examples.

     

     

    Aaron