Forum Discussion
iRule if based on incoming IP
Hi,
I have a problem here... I'm trying to make an iRule perform specific action if incoming traffic comes from a specific IP address. I have:
if {[IP::addr [IP::client_addr] equals 10.8.199.231]}{
log local0. "dupa"
}
now I'm quite sure my IP is 10.8.199.231 but when I log this traffic using:
log local0. "Incoming IP: [IP::client_addr]"
i get in log:
10.8.199.231%3
How can I catch traffic from this IP to code some exceptions?
- Jad_Tabbara__J1
Cirrostratus
I guess the %3 is added because you are using multiple route domains.
If you add to your condition equals "10.8.199.231%3"
It will match
Regards
- Lee_Sutcliffe
Nacreous
Not sure if this is the cause of your issue but you don't need to put the IP address in quotes, try it without as per the wiki: https://clouddocs.f5.com/api/irules/IP__client_addr.html
if {[IP::addr [IP::client_addr] equals 10.8.199.231%3]} { log local0. "IDMS dupa" }
- jaikumar_f5
Noctilucent
- Stanislas_Piro2
Cumulonimbus
Hi,
you can extract Route domain and IP Address with split and compare it with IP::addr (useful if you need to compare network with netmask evaluation)
elseif {$incURI contains "csmon"}{ set _redirect "0" log local0. "IDMS test Monitoring: [HTTP::uri]" log local0. "IDMS test inc IP: [IP::client_addr]" lassign [split [IP::client_addr] "%"] IP_addr rd if {[IP::addr $IP_addr equals "10.8.199.231"] && $rd equals [ROUTE::domain]} { log local0. "IDMS dupa" } }
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