Forum Discussion
Robert_Pagano_7
Nimbostratus
Jan 08, 2008accept/reject based on IP address using "matchclass" rather than "starts_with"
I have a working iRule that, besides making a pool selection based on the URI, also checks the IP address of the client to see if client is allowed to access the "admin" functions. See below...
when HTTP_REQUEST {
if { [HTTP::uri] starts_with "/app/admin" } {
if {[IP::client_addr] starts_with "10.64." } {
pool APP-7777_pool
} else {
reject
}
}
elseif { [HTTP::uri] starts_with "/content" } {
pool APP-CONTENT-80_pool
} else {
pool APP-7777_pool
}
}
Unfortunately, not all of the admins reside on IP networks that begin with "10.64." so I would like to expand the functionality of the above iRule so that it consults a list of IP networks when making the allow/reject decision.
I know the matchclass command can do this but my attempt at using it (see below) did not work. I used the GUI to create the "ADMIN-NETWORKS_class" data group which contains the IP network that should be allowed.
when HTTP_REQUEST {
if { [HTTP::uri] starts_with "/app/admin" } {
if { [matchclass [IP::client_addr] equals $::ADMIN-NETWORKS_class] } {
pool APP-7777_pool
} else {
reject
}
}
elseif { [HTTP::uri] starts_with "/content" } {
pool APP-CONTENT-80_pool
} else {
pool APP-7777_pool
}
}
The LTM is operating in one-arm mode and, so, we are using SNAT. Could this be causing the LTM to overwrite the client address with the SNAT address? If so, is there another variable I can use to get the address of the remote client?
Any help will be greatly appreciated!
Thank you.
- hoolio
Cirrostratus
Hi,class ADMIN-NETWORKS_class { network 10.30.0.0/16 host 10.40.1.1 }
- Robert_Pagano_7
Nimbostratus
I am not sure where those smilies came from; each should be a capital "p."
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