Forum Discussion
Block users from connecting to a virtual server using ip address
Hi Darren,
You can create a simple irule such as the following example:
The following example blocks any users not entering the correct URL
when HTTP_REQUEST {
set host [string tolower [HTTP::host]]
set uri [ string tolower [HTTP::uri]]
if { !(($host eq "www.yourdomain.com") and ($uri starts_with "/url" )) } {
reject
}
}
Another example is blocking based on an specific clients IP address
when CLIENT_ACCEPTED {
if { [IP::addr [IP::client_addr] equals 10.10.10.10] } {
reject
}
}
or blocking all addresses except a single address
when CLIENT_ACCEPTED {
if {! ([IP::addr [IP::client_addr] equals 10.10.10.10]) } {
reject
}
}
You can get more sophisticated by using the class function when you need to block multiple client ip addresses in different ranges
http://devcentral.f5.com/wiki/iRules.class.ashx
I hope this helps
Bhattman
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