Forum Discussion
Ranvir_Floura_7
Nimbostratus
Mar 25, 2009redirect based on source ip address
Need a little help in coming up with an iRule where if the client IP matches i want it going to a pool, if not just redirect to a url. I am missing something here
when CLIENT_ACCEPTED ...
dennypayne
Employee
Apr 15, 2009The wiki says - "Use of IP::addr is not necessary if matchclass command is used to perform the address-to-address comparison" but nonetheless you may want to try:
if { [matchclass IP:addr[IP::client_addr] equals $::relay_hosts_allowed]} {
The rule looks fine though...so long as LTM has a route to whatever you are trying to get to (or is directly connected) then it should forward the packet.
You could add some logging to see if you're not matching for some reason:
when CLIENT_ACCEPTED {
if { [matchclass [IP::client_addr] equals $::relay_hosts_allowed]} {
log local0. "[IP::client_addr] matched an allowed host."
forward
} else {
log local0. "[IP::client_addr] didn't match, dropping"
drop
}
}
Denny
Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects
