Forum Discussion
Gorf_33479
Mar 10, 2011Nimbostratus
iRule to filter based on subnet
Greetings all, I have been reading some other forum posts about using iRules to filter client IP's, and I have come across some discussions about how to get subnets to work, but I am still a little lo...
hooleylist
Mar 10, 2011Cirrostratus
Hi Gorf,
The switch statement you're using performs a string comparison of the client IP against the addresses. It would be more efficient to use an address type datagroup and 'matchclass' to do this. An address datagroup also supports subnets.
http://devcentral.f5.com/wiki/default.aspx/iRules/matchclass
when CLIENT_ACCEPTED {
if { not ([matchclass [IP::client_addr] equals allowed_subnets_class]) } {
drop
}
}
Aaron
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