Forum Discussion

Patrick_Chang_7's avatar
Patrick_Chang_7
Historic F5 Account
Mar 29, 2008

How to get server IP when LB_Selected


when HTTP_REQUEST {
   set clientIP [IP::client_addr]
}
when LB_SELECTED {
   set serverIP [serverside {IP::remote_addr}]
}
when LB_FAILED {
   log local0. "LB Failed for client $clientIP and server $serverIP"
}

I am trying to grab the server IP when the the LB selection is made. However, it is saying that IP::remote_addr is undefined in the serverside context at the time of this event. What is the right way to get this?
  • Try this

    
    when HTTP_REQUEST  {  
        set clientIP [IP::client_addr]
    }
    when LB_SELECTED  {   
         set serverIP [LB::server addr]
    }
    when LB_FAILED {   
         log local0. "LB Failed for client $clientIP and server $serverIP"
    }

    /cb
  • LB_ SELECTED

     

     

    Enter a topic name to show or a new topic name to create; then press Enter

     

    .

     

    Description | Examples | Related Information

     

    Description

     

    Triggered when the system selects a pool member.

     

     

     

     

    Examples

     

    when LB_SELECTED {

     

    if { [IP::addr [IP::remote_addr] equals "10.0.0.1"] } {

     

    snat VIPsnat

     

    }

     

    }

     

     

     

     

    Related Information

     

    Available Commands:

     

    IP::client_addr, IP::local_addr, LB::reselect, LB::server, priority, SSL::sessionid, SSL::unclean_shutdown, SSL::verify_result,

     

    Returns the client IP address of a connection.

     

    6/29/2007 5:51:27 PM - deb

     

    Returns IP address value of the virtual or self-ip the client is connected to.

     

    3/29/2007 3:38:35 PM - hoolio

     

    Advance the load balancing pointer

     

    4/12/2007 5:10:50 AM - citizen_elah

     

    Returns information about the currently selected server

     

    7/22/2007 9:01:41 PM - jpruitt

     

    The priority command is used to set the order that like iRule events are executed.

     

    8/16/2007 4:57:23 PM - deb

     

    Gets the SSL session ID.

     

    8/28/2007 5:30:46 PM - spark

     

    Sets the value of the *Unclean Shutdown* setting.

     

    8/28/2007 4:50:53 PM - spark

     

    Gets or sets the result code for peer certificate verification.

     

    8/27/2007 5:58:32 PM - spark