Eric_Stewart_36
Oct 15, 2018Nimbostratus
Verify iRule Syntax
Hello all
I am trying to write an iRule that will check for the incoming port, and then, check source IP address, and choose a Pool accordingly. This is my first iRule. Please let me know if this looks like I am programming it correctly. Obviously the X.X.X.X entries will have my desired IPs inserted. The Virtual Server has a default pool assigned that should catch anything that does not get caught by the iRule. There is also a Default Persistence Profile on the Virtual Server that I do not want used if a match is found in the iRule, thus the "persist none" entries. Please let me know if that is correct also.
Thanks!!! Eric
when CLIENT_ACCEPTED {
if {[TCP::local_port] equals 7002 or [TCP::local_port] equals 443 or [TCP::local_port] equals 8443} {
if { [IP::addr [IP::client_addr] equals X.X.X.X] } {
persist none
pool APP1
}
if { [IP::addr [IP::client_addr] equals X.X.X.X] } {
persist none
pool APP2
}
if { [IP::addr [IP::client_addr] equals X.X.X.X] } {
persist none
pool APP3
}
if { [IP::addr [IP::client_addr] equals X.X.X.X] } {
persist none
pool APP4
}
if { [IP::addr [IP::client_addr] equals X.X.X.X] } {
persist none
pool APP5
}
}
if {[TCP::local_port] equals 7001 or [TCP::local_port] equals 80} {
if { [IP::addr [IP::client_addr] equals X.X.X.X] } {
persist none
pool APP1
}
if { [IP::addr [IP::client_addr] equals X.X.X.X] } {
persist none
pool APP2
}
if { [IP::addr [IP::client_addr] equals X.X.X.X] } {
persist none
pool APP3
}
if { [IP::addr [IP::client_addr] equals X.X.X.X] } {
persist none
pool APP4
}
if { [IP::addr [IP::client_addr] equals X.X.X.X] } {
persist none
pool APP5
}
}
}