F5 Technology Blog

Saturday, October 26, 2013

Block IPs using data group and irule


1) Create a data group

Local Traffic > Virtual Servers > iRules > Data Group List
Create data group with Type Address
Add IP address to IP field and provide description in the value field
You can add a list of IP addresses to be blocked.

2) Create an iRule
when HTTP_REQUEST {
 foreach allxforwardvalues [HTTP::header values X-Forwarded-For] {
  foreach destip [split [string map {" " ""} $allxforwardvalues] ","] {
if { [class match -- $destip equals ip_blacklist] } {  
     reject
     event disable all
     return
   }
  }
 }
}

3) Add the iRule to virtual  ip

posted by Jayanthi Krishnamurthy @ 8:56 PM   0 Comments

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home

Newer›  ‹Older

About Me

Name: Jayanthi Krishnamurthy

View my complete profile

Posts

  • Block IPs using data group and irule

Older Posts Newer Posts

Archives

Subscribe to
Posts [Atom]