Forum Discussion
Jure_Simsic_106
Nimbostratus
Feb 16, 2007Admin access check
I have a fairly basic irule that's giving me trouble. The idea is that when a client a ceirtain url, he get's allowed access (use another pool) in case his IP is from a valid subnet, otherwise we don't let him through. I have tried this, but I must have some error somewhere:
when HTTP_REQUEST {
if { [HTTP::uri] starts_with "/admin" and
{ if { [IP::addr[IP::client_addr] starts_with "10.10.10" ] or
[IP::addr[IP::client_addr] starts_with "10.10.11" ] }
use pool admin-pool
} else { drop }
}
}
Can anyone tell me what is wrong here
- dennypayne
Employee
Your logic looks sound...what error are you getting? You probably need "discard" instead of "drop" though. - Wes_98712
Nimbostratus
So it appears you are trying to validate that a client's IP address matches a specific IP class then right?class networks_class { network 10.10.10.0 mask 255.255.255.0 network 10.10.11.0 mask 255.255.255.0 } when HTTP_REQUEST { set my_uri [HTTP::uri] set my_client [IP::client_addr] if { $my_uri starts_with "/admin" } { if { [matchclass $my_client equals $::networks_class] } { pool admin-pool } } else { discard } }
- Jure_Simsic_106
Nimbostratus
This looks neat, but I keep getting syntax errors. I've left just the class definition in: - hoolio
Cirrostratus
The class is a separate object from the rule. In the GUI it's called a datagroup. What you have there is how it's listed in the bigip.conf. - Wes_98712
Nimbostratus
Yeah should have mentioned that before. The bigip.conf lists the class as what appears to be an irule, but in reality it's really just a classification of an object within TCL. Think of it has really just an array, you can loop through it, which is what the matchclass does.
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