Forum Discussion

S__Wang_111752's avatar
S__Wang_111752
Icon for Nimbostratus rankNimbostratus
Jan 10, 2012

How to obtain obtain member IP from a VIP > Pool

Is it possible to obtain IP address of an active member in any defined pool? I need to obtain and pass the information for the URI. here is my setup -

 

 

VIP1 & vip1-irule

 

VIP2 with associate pool and members

 

 

In vip1-irule, I need to obtain a member IP from VIP2's pool.

 

 

Thanks.

 

6 Replies

  • Hi,

     

     

    Here are two related commands you can use to get the members and active members for an arbitrary pool:

     

     

    http://devcentral.f5.com/wiki/iRules.members.ashx

     

    http://devcentral.f5.com/wiki/iRules.active_members.ashx

     

     

    If you want to get the current VS's default pool name you can use [LB::server pool] in CLIENT_ACCEPTED.

     

    http://devcentral.f5.com/wiki/iRules.lb__server.ashx

     

     

    Aaron
  • Hello Aaron,

     

     

    Thanks. The links are very helpful. Is it possible to obtain (in the vip1-irule) a member from VS2/VIP2 according to the persistence rule defined for VS2?

     

     

    Best,

     

  • Can you clarify the scenario? Do you want to look up a persistence record from an iRule on VS1 for a separate pool on VS2? What type of persistence are you using? Are you using a persistence profile and/or iRule?

     

     

    Aaron
  • VS2 is created with a pool and universal persistence over an irule. In VS1's HTTP_REQUEST event, I need to obtain a member from VS2 and have its IP address insert into the HTTP::uri in the VS1's HTTP_REQUEST event. I don't know if this is clear enough. Thanks.
  • doesn't the active_members Aaron suggested work?

    [root@ve1023:Active] config  b virtual bar list
    virtual bar {
       snat automap
       pool foo
       destination 172.28.19.79:80
       ip protocol 6
       rules myrule
       profiles {
          http {}
          tcp {}
       }
    }
    [root@ve1023:Active] config  b rule myrule list
    rule myrule {
       when HTTP_REQUEST {
            log local0. "\[active_members -list foo2\]: [active_members -list foo2]"
    }
    }
    [root@ve1023:Active] config  b pool foo2 list
    pool foo2 {
       members {
          200.200.200.102:80 {}
          200.200.200.103:80 {}
       }
    }
    
    [root@ve1023:Active] config  curl -I http://172.28.19.79
    HTTP/1.1 200 OK
    Date: Wed, 11 Jan 2012 00:36:34 GMT
    Server: Apache/2.2.3 (CentOS)
    Last-Modified: Fri, 11 Nov 2011 14:48:14 GMT
    ETag: "4183e4-3e-9c564780"
    Accept-Ranges: bytes
    Content-Length: 62
    Set-Cookie: BROWSER=MOZILLA%20INTERNET_EXPLORER%20CHROME; path=/
    Content-Type: text/html; charset=UTF-8
    
    [root@ve1023:Active] config  cat /var/log/ltm
    Jan 10 16:36:21 local/tmm info tmm[26866]: Rule myrule HTTP_REQUEST: [active_members -list foo2]: {200.200.200.102 80} {200.200.200.103 80}
    
  • Colin_Walker_12's avatar
    Colin_Walker_12
    Historic F5 Account
    The -list option should definitely get you a list of the pool members. If this isn't working could you let us know? That is a bug if it's failing, and I'd like to recreate it if possible. What version are you running?

     

     

    Colin