Not to beat a dead horse, but...hopefully this will clarify things a bit more:
The IP::local_addr and IP::remote_addr commands are context-specific, in that the value they return depends on whether they are called from a client-side or server-side event. In the client-side context (as in the CLIENT_ACCEPTED event, for example), remote_addr refers to the far end, or the client IP address). In the server-side context (as in the LB_SELECTED event, for example), remote_addr refers to the node IP address.
Some of the wiki entries on the IP commands were actually slightly incorrect. The example for IP::server_addr used the command in the clientside event, CLIENT_ACCEPTED. This is not valid as a serverside connection hasn't been established yet. I updated the errors I found on the IP commands.
[IP::server_addr] is the same as [serverside {IP::remote_addr} ]
[IP::client_addr] is the same as [clientside {IP::remote_addr} ].
I believe that "serverside {}" and "clientside {}" are specific to F5's implementation of TCL and are used to force the evaluation of the command into the specified context as opposed to the current event's context. So if you wanted to get the client IP address while in a serverside event, you could use clientside {IP::remote_addr}. Of course, IP::client_addr is probably a simpler method to get this value.
Here are a sampling of the major events for an HTTP connection (compiled from these two posts):
Colin added a good entry on the order of events and their context:
Click here
And here is another post with additional info on the context of events:
Click here
Request events:
---------------------------------------------
CLIENT_ACCEPTED- clientside - triggered when LTM receives and accepts a connection from a client
HTTP_REQUEST- clientside - triggered when an HTTP profiles
HTTP_REQUEST_DATA- clientside - triggered if HTTP::collect was called in HTTP_REQUEST
LB_SELECTED- clientside - triggered when a node has been selected per the load balancing algorithm
SERVER_CONNECTED- serverside - triggered when a connection is established with the node
HTTP_REQUEST_SEND- serverside - triggered when LTM sends the HTTP request to the node
CLIENT_CLOSED- clientside - triggered when the client connection is closed
Response events:
---------------------------------------------
HTTP_RESPONSE- serverside - triggered when LTM receives the HTTP response from the node
HTTP_RESPONSE_DATA- serverside - triggered if HTTP::collect was called in HTTP_RESPONSE
SERVER_CLOSED- serverside - triggered when the server connection is closed
Here are a few examples of the IP command results in different events:
client: 1.1.1.1
VIP:2.2.2.2
SNAT:3.3.3.3
Node:4.4.4.4
Rule log_IPs_rule :[IP::client_addr]:1.1.1.1
Rule log_IPs_rule :[IP::remote_addr]:1.1.1.1
Rule log_IPs_rule :[IP::local_addr]:2.2.2.2
Rule log_IPs_rule :[IP::server_addr]:invalid in this context (no serverside connection has been established)
Rule log_IPs_rule :[IP::client_addr]:1.1.1.1
Rule log_IPs_rule :[IP::remote_addr]:1.1.1.1
Rule log_IPs_rule :[IP::local_addr]:2.2.2.2
Rule log_IPs_rule :[IP::server_addr]:invalid in this context (no serverside connection has been established)
Rule log_IPs_rule :[IP::client_addr]:1.1.1.1
Rule log_IPs_rule :[IP::remote_addr]:1.1.1.1
Rule log_IPs_rule :[IP::local_addr]:2.2.2.2
Rule log_IPs_rule :[IP::server_addr]:invalid in this context (no serverside connection has been established)
Rule log_IPs_rule :[IP::client_addr]:1.1.1.1
Rule log_IPs_rule :[IP::remote_addr]:4.4.4.4
Rule log_IPs_rule :[IP::local_addr]:3.3.3.3
Rule log_IPs_rule :[IP::server_addr]:4.4.4.4
Rule log_IPs_rule :[IP::client_addr]:1.1.1.1
Rule log_IPs_rule :[IP::remote_addr]:4.4.4.4
Rule log_IPs_rule :[IP::local_addr]:3.3.3.3
Rule log_IPs_rule :[IP::server_addr]:4.4.4.4
Rule log_IPs_rule :[IP::client_addr]:1.1.1.1
Rule log_IPs_rule :[IP::remote_addr]:4.4.4.4
Rule log_IPs_rule :[IP::local_addr]:3.3.3.3
Rule log_IPs_rule :[IP::server_addr]:4.4.4.4
Rule log_IPs_rule :[IP::client_addr]:invalid in this context (no clientside connection has been established)
Rule log_IPs_rule :[IP::remote_addr]:4.4.4.4
Rule log_IPs_rule :[IP::local_addr]:3.3.3.3
Rule log_IPs_rule :[IP::server_addr]:4.4.4.4
Rule log_IPs_rule :[IP::client_addr]:1.1.1.1
Rule log_IPs_rule :[IP::remote_addr]:1.1.1.1
Rule log_IPs_rule :[IP::local_addr]:2.2.2.2
Rule log_IPs_rule :[IP::server_addr]:invalid in this context (no serverside connection has been established)
So all in all, if you wanted to make a load balancing decision based on the clien't IP address and the destination IP address (VIP) the client requested, you would want to focus on the clientside context and use IP::client_addr (or IP::remote_addr in clientside events) and IP::local_addr to refer to the VIP they requested.
--Aaron