Forum Discussion
iRule to ping host
I'm pretty new to the Big IP load balancers. We have a couple servers on which we have SharePoint sites load balanced. The load balancing appears to work fine. Obviously, I've set up a Virtual Server with a virtual IP, so when users connect to a site, for instance sitename.domain.net, they will connect to the IP of the virtual server and get load balanced. However, we talked about being able to ping the sitename.domain.net from a specific workstation and getting the IP address of the member server to whichthe specific workstation is connected currently to aid in troubleshooting, instead of the IP of the Virtual Server configured on the load balancer. The SharePoint admins say they saw this when we initially set up the Virtual Server, and I've not made any changes on the load balancer since. We did make some DNS tweaks, but I don't see where this would have enabled them to tell which member a specific workstation is connected to. I'm thinking we could set up an iRule for this, but again I'm new to the F5. Any ideas? Maybe there is an easier way? Thanks.
33 Replies
- What_Lies_Bene1
Cirrostratus
You could use something simple like this to simply insert the selected server IP address in a header in every server response and use something like IEHeaders, HTTPWatch or LiveHTTPHeaders on the client to read it's value;when HTTP_RESPONSE { HTTP::header insert Via "[LB::server addr]" You could also replace the Server header if it is present } - What_Lies_Bene1
Cirrostratus
Or you could use something a little more complex to send the data in response to a specific request URI:when LB_SELECTED { set whichserver [LB::server addr] } when HTTP_REQUEST { if { string tolower [HTTP::uri] equals "/whichserver" } { HTTP::respond 200 content "Real server IP is: $whichserver" noserver Content-Type "text/html" Connection "Close" Stop processing the iRule for this event here return } } - Gopal_Prakriya_
Nimbostratus
I would like to send a txt message to my unix team when I hit LB_FAILED messages in /var/log/tmm (Only when no nodes available) Any help is appreciated - What_Lies_Bene1
Cirrostratus
Gopal, please start a new topic rather than posting in unrelated existing (and unresolved) ones. - Darthw_20046
Nimbostratus
Thanks Steve. I can see where those would be helpful, however the HTTP tools look like they would cost us, as the free version limits the number of sites. Using "ping" would be free :) If there is an iRule that will accomplish responding with the host IP from the client workstation when it pings the site being load balanced. Our Sharepoint admin says he was initially seeing pings of the host IP addresses in the pool, rather than the virtual IP address of the pool for the Sharepoint site, when he would ping from a client. I've not changed a setting, so is there some setting on the load-balance, via i-Rule or otherwise that would make this work?
- nitass
Employee
if you want to access server in pool using ip, is network ip forwarding virtual server usable?
sol7595: Overview of IP forwarding virtual servers
http://support.f5.com/kb/en-us/solutions/public/7000/500/sol7595.html - nitass
Employee
I would like to send a txt message to my unix team when I hit LB_FAILED messages in /var/log/tmm (Only when no nodes available) Any help is appreciatedis remote log command (in irule) or custom syslog-ng usable? Colin and Deb have written great articles about logging and syslog-ng as following.
The101: iRules 101 - Logging & Comments by Colin
https://devcentral.f5.com/s/articles/the101-irules-101-logging-amp-comments
LTM 9.4.2+: Custom Syslog Configuration by Deb
https://devcentral.f5.com/s/articles/LTM-9-4-2-Custom-Syslog-Configuration
- What_Lies_Bene1
Cirrostratus
I may be mistaken but if you PING the Virtual Server you will never get responses from the Pool Member. I'm not 100% as I guess there's a chance this might occur with a Layer 2 Forwarding VS.
LiveHTTPHeaders and IEHTTPHeaders are both free to use from what I can see, even for commercial use. - Darthw_20046
Nimbostratus
Thanks all. I'll look closer at the HTTP header tools. The one had a free version, but said it was limited to the number of sites you could configure to use it (as I understood what I read), and potentially we will eventually have a large number of sites. Also, it requires an install on the client workstation, and I think our application guys are wanting something that is quickly reviewable.
I'll look at the forwarding information.
In the meantime I've been looking at iRules and found one that perhaps I could adapt to just log the information on the load balance system log. The iRule below is not complete though. I'd like to set up each iRule for the Sharepoint Sites only that we load balance, and don't know how to do that. Basically I'd like each time someone connects to a load balanced Sharepoint site virtual IP address pool that the client's IP address and the address of the physical host server gets logged as an informational message in the F5 logs. I think the iRule below will work, except I'm still researching how to only use the rule for Sharepoint sites. I figure there is a rule where I can say if a "CLIENT ACCEPTED" occurs to a specific vip, but potentially we will have dozens of VIPs in the future, so I could have a lot of iRules to manage. Is there a way to look at Client Accepted connections for only a type of pool? We're using the Sharepoint templates.
rule SharePoint_sitename{
when CLIENT ACCEPTED {
set remote [IP::remote_addr]
set cip [IP::client_addr]
log local.info "Connection Sharepoint_sitename From $cip to $remote" - Darthw_20046
Nimbostratus
Whoops forgot the ending brackets:
rule SharePoint_sitename{
when CLIENT ACCEPTED {
set remote [IP::remote_addr]
set cip [IP::client_addr]
log local.info "Connection Sharepoint_sitename From $cip to $remote"
}
}
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* 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