Forum Discussion
Jeff_Tuthill_10
Nimbostratus
Aug 10, 2009Pool Selection based on client domain name or IP address
So I think this may be an easy one but I am getting stuck on this. I have an application that I want to allow access to if the client has a certain domain name or is coming from a certain IP subnet...otherwise I want to discard the connection.
So far I have set up a Data Group with the allowed IP's and set up the irule as such:
when HTTP_REQUEST {
if { [matchclass [IP::client_addr] equals $::DATA_GROUP_NAME] } {
pool pool1
} else {
discard
}
}
This works fine for the IP addresses but how do I get the domain name working? So my scenario is:
Go to pool1 if you are from 10.10.10.0 or 10.10.11.0 or from *.example.com otherwise you get discarded.
- dennypayne
Employee
I'm not aware of any header that a browser normally sends that includes domain name information. What exactly do you mean by "the client has a certain domain name?" - hoolio
Cirrostratus
You could check the requested domain in the Host header value. But as Denny suggests, there isn't anything in HTTP that would have a domain associated with it. You could potentially do a reverse DNS lookup to see if there is a reverse DNS record associated with the client IP address. - Jeff_Tuthill_10
Nimbostratus
What I mean by the domain name is the network that the client is coming from, i.e. coming from comcast.net or aol.com. So can I have a ruke that says all clients coming from comcast.net use this pool. - hoolio
Cirrostratus
There is a default aol datagroup which contains the proxy server IP addresses AOL publishes. If you can get a list of the hosts/subnets that Comcast uses, you could define them in an address type datagroup and check the client IP address against the datagroup. - Jeff_Tuthill_10
Nimbostratus
So how do I get an iRule to look at two different Data Groups? Here is the scenario: - hoolio
Cirrostratus
You could either figure out which IP address ranges comcast uses, or you could depend on their reverse DNS records being valid for all client IP addresses. If you use the first option, you'd define a datagroup just like the stock AOL datagroup and check the IP::client_addr against that datagroup:when HTTP_REQUEST { if { [matchclass [IP::client_addr] equals $::DATA_GROUP_NAME] } { pool pool1 } elseif { [matchclass [IP::client_addr] equals $::comcast_ips] } { pool pool1 } else { discard } }
- Jeff_Tuthill_10
Nimbostratus
Thanks for the leads hoolio!!!
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