Forum Discussion
Lucas_Kaczmarsk
Nimbostratus
Mar 06, 2015irule problem - allow only selected IPs
Hello Guys,
I'm new to irules so please excuse my basic question. I'm trying to allow traffic only to the two IP addresses, but the irule below only matches the first one. Any idea why?
when HTTP_REQUEST { if { not [IP::addr [IP::remote_addr] equals 1.1.1.1] or [IP::addr [IP::remote_addr] equals 2.2.2.2]} { reject } }
Thanks, Lucas
3 Replies
- Michael_Jenkins
Cirrostratus
Try this. You needed to put
around the IP address checks, otherwise it was checking not 1.1.1.1 or IS 2.2.2.2()when HTTP_REQUEST { if { not ([IP::addr [IP::remote_addr] equals 1.1.1.1] || [IP::addr [IP::remote_addr] equals 2.2.2.2])} { reject } } - Michael_Jenkins
Cirrostratus
Or you could try with a
statement instead, like this:switchwhen HTTP_REQUEST { switch [IP::addr [IP::remote_addr] mask 255.255.255.255] { "1.1.1.1" - "2.2.2.2" { Do nothing } default { reject } } } - Lucas_Kaczmars1
Altostratus
Thank you so much! It's all working fine now :-)
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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