Forum Discussion

sosabsd_111766's avatar
sosabsd_111766
Icon for Nimbostratus rankNimbostratus
May 13, 2014

Irule for Specific Client IPs

hi

 

our current irule is used to only allow IP as per cleass PC: now we need to preserve the same irule but adding another condition if client ip xxxx(which is the part of class PC) then use pool BBB else use pool AAA if clientip is not in class PC then discard

 

our current Irule is as under:

 

rule PCClients { when CLIENT_ACCEPTED { if { [matchclass [IP::remote_addr] equals $::PC] } { pool PC_Pool } else { discard } } }

 

what i think of a new irule will look some thing like below: rule PCClients { when CLIENT_ACCEPTED { if { [matchclass [IP::remote_addr] equals $::PC] } {

 

if { [matchclass [IP::remote_addr] equals $::172.24.21.139] } { pool PC_Pool2 else { pool PC_Pool } } } else { discard } } } plz advice

 

3 Replies

  • I assume 172.24.21.139 is a specific IP address you want to match, and not another datagroup? If so, your inner if statement would be more like this

    if { [IP::addr [IP::remote_addr] equals 172.24.21.139] } {
        pool PC_Pool2
    } else {
        pool PC_Pool
    }
    
  • hi

     

    thanks for your reply. so my final irule will be look like :

     

    irule PCClients { when CLIENT_ACCEPTED { if { [matchclass [IP::remote_addr] equals $::PC] } { if { [IP::addr [IP::remote_addr] equals 172.24.21.139] } {pool PC_Pool2} else { pool PC_Pool} } else { discard } } }

     

  • that looks correct, hard to read without the formatting. Put a tab in front of your code lines and it will format them in a block for you.