Forum Discussion

Gill_32697's avatar
Gill_32697
Icon for Nimbostratus rankNimbostratus
Mar 11, 2016

Help with iRule filter by ip subnet

Need an iRule for a vip, if client is internal 10.0.0.0 /24 then pool websure else if the are public internet display maintenance page. this is not trggering..

 

when HTTP_REQUEST { if { [IP::addr [IP::client_addr]/24 equals 10.0.0.0] } { pool websure-pool } else { HTTP::respond 200 content { Site Maintenance Page We are sorry, Websure is currently down for essential maintenance. } } }

 

1 Reply

  • Hi Gill,

    you may try the iRule below. It uses

    [getfield]
    syntax to strip route domain suffixes and generates an additional log line for further troubleshooting...

    when HTTP_REQUEST {
        log local0.debug "Client: [IP::client_addr] Result = [IP::addr [getfield [IP::client_addr] "%" 1] equals "10.0.0.0/24"]  (boolean)"
        if { [IP::addr [getfield [IP::client_addr] "%" 1] equals "10.0.0.0/24"] } then { 
            pool websure-pool 
        } else { 
            HTTP::respond 200 content { We are sorry, Websure is currently down for essential maintenance. }
        } 
    }
    

    Cheers, Kai