Forum Discussion
Dan_Deming_1935
Nimbostratus
Aug 18, 2006How do I insert LB's IP with an irule?
We have 2 F5 Big IP units set up in front of 3 web servers running Apache 1.3. We're using the Type: Standard, Protocol: TCP and HTTP Profile: HTTP settings.
In our Apache logs, we want to include...
Aug 18, 2006
Which IP of the BIG-IP are you looking at inserting? The Management port, the IP of the virtual, or the internal gateway address that is used to connect to your backend servers?
The values of IP::client_addr, IP::local_addr, IP::remote_addr, and IP::server_addr have different values depending on the event they are accessed in.
In the HTTP_REQUEST event, there is no server side connection so think of this as the first half of the connection where the client is connecting to the virtual. In this context the values are the followingIP::client_addr - The address of the connecting client
IP::local_addr - The address of the virtual the client is connecting to
IP::remote_addr - The address of the connecting client (same as client_addr)
IP::server_addr - Not valid as there is no serverside connection.
If you want the server address of the pool member you are connecting to, you can access this in the HTTP_REQUEST_SEND event. This is raised after a serverside connection has been established and before the request is sent. In this event, the values are:IP::client_addr - The address of the connecting client
IP::local_addr - The address of the connecting client (same as client_addr)
IP::remote_addr - The address of the pool member
IP::server_addr - The address of the pool member
So, this rule should do what you want
when HTTP_REQUEST {
set bigip_addr [IP::local_addr]
}
when HTTP_REQUEST_SEND {
clientside {
HTTP::header insert "Client-Addr" [IP::client_addr]
HTTP::header insert "BIGIP-Addr" $bigip_addr
HTTP::header insert "Node-Addr" [IP::remote_addr]
}
}I don't believe you have access to the virtual address in the HTTP_REQUEST_SEND event so you'll have to store it in a variable from the HTTP_REQUEST event.
Also, you'll need to enclose the HTTP::header commands in a clientside context within the HTTP_REQUEST_SEND event which might not be obvious.
Hopefully this will give you enough to get you going.
-Joe
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects
