Forum Discussion
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
- mimlo_61970
Cumulonimbus
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 } - sosabsd_111766
Nimbostratus
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 } } }
- mimlo_61970
Cumulonimbus
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.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com