Forum Discussion
sbadea_81872
Nimbostratus
Feb 03, 2009Restricting access using irule
Is it possible to create an irule to restrict access to a certain ip range/hosts? I created a data group list containing a number of hosts ip addresses; need some help to create the irule. Can it look like this one?
when CLIENT_ACCEPTED {
if { [matchclass [IP::remote_addr] equals $::mylist] } {
pool my_pool
} else {
discard
- hoolio
Cirrostratus
Hi there,when CLIENT_ACCEPTED { if { [matchclass [IP::remote_addr] equals $::mylist] } { pool my_pool } else { discard } }
- sbadea_81872
Nimbostratus
Thanks. It worked just fine. - Fotios_30046
Nimbostratus
This rule is just what I was looking for, however what if the data group contained networks instead of hosts. Can this same irule work? - Fotios_30046
Nimbostratus
I tried it out and it works perfectly. I only adjusted the when CLIENT_ACCEPTED to when HTTP_REQUEST so that we could redirect them if they didn't meet the match. - miguel_61461
Nimbostratus
how do you define "mylist" ? - hoolio
Cirrostratus
It would be most efficient to add the IP's/subnets to a datagroup. You can either edit the bigip.conf file, or modify the class via the command line using 'bigpipe' or use an external class and a separate file. Try searching on AskF5.com for details on these options, or reply here if you get stuck.
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