Forum Discussion

Robert_47833's avatar
Robert_47833
Icon for Altostratus rankAltostratus
Dec 02, 2011

how to use [IP::client_addr] match one subnet

hi,dear irule

 

 

if { [IP::client_addr] not equals 10.0.0.0/8 } {

 

xxxxx

 

 

}

 

 

how to achieve this? it is a segment with network mask

 

 

  • can you try this?

    [root@ve1023:Active] config  b rule myrule list
    rule myrule {
       when CLIENT_ACCEPTED {
            log local0. "[IP::client_addr]"
            if {not [IP::addr [IP::client_addr] equals 172.28.19.0/24]} {
                    log local0. "[IP::client_addr] does not match 172.28.19.0/24"
            } else {
                    log local0. "[IP::client_addr] matches 172.28.19.0/24"
            }
    }
    }
    
    Dec  1 21:22:54 local/tmm info tmm[23027]: Rule myrule : 172.28.19.80
    Dec  1 21:22:54 local/tmm info tmm[23027]: Rule myrule : 172.28.19.80 matches 172.28.19.0/24