Forum Discussion

James_21682's avatar
James_21682
Icon for Nimbostratus rankNimbostratus
May 21, 2009

Restrict access to VIP by source IP address

Afternoon,

 

 

I want to restrict access to a vip to only certain IP addresses, I have done that with the following iRule ( I took it from this forum)

 

 

when HTTP_REQUEST {

 

if { [IP::client_addr] eq "192.168.0.30" || [IP::client_addr] eq "192.168.3.10" || [IP::client_addr] eq "192.168.4.13" || [IP::client_addr] eq "192.168.5.16" } {

 

pool testapps2s

 

} else {

 

HTTP::respond 200 content "Not AllowedYou are not allowed to access this site!"

 

}

 

}

 

 

I want to add 3 different subnets to the above IPs (say 192.168.7.0, 192.168.9.0 and 102.168.12.0). How would I accomodate that in the iRule - I am a novice when it comes to this so any help would be appreciated.

 

 

Thanks

 

  • hoolio's avatar
    hoolio
    Icon for Cirrostratus rankCirrostratus
    Hi,

     

     

    It would be more efficient and easier to use an address type datagroup and the matchclass command (Click here) to do this. Try searching the forum for address type datagroup for more info.

     

     

    Aaron