Forum Discussion
raj_74759
Nimbostratus
May 19, 2008Adding Multiple IP's to Remote Address
Hi Guys, a newbie to iRule's have completed my first one and it works fine however i'd like to know of a way to tidy it up and add multiple host IP's or networks to a line rather than have to add a line at a time with a different address..I'm sure you can work out what i'm trying to achieve with my irule..your help would be much appreciated.
when HTTP_REQUEST {
if { ([HTTP::uri] equals "/") and ([IP::addr [IP::client_addr] equals 1.1.1.1]) } {
HTTP::redirect "/referrals/blah"
}
elseif { ([HTTP::uri] equals "/") and ([IP::addr [IP::client_addr] equals 1.1.1.2]) } {
HTTP::redirect "/referrals/blah"
}
elseif { ([HTTP::uri] equals "/") and ([IP::addr [IP::client_addr] equals 1.1.1.3]) } {
HTTP::redirect "/referrals/blah"
}
elseif { ([HTTP::uri] equals "/") and ([IP::addr [IP::client_addr] equals 2.2.2.2]) } {
HTTP::redirect "/referrals/blah"
}
elseif { ([HTTP::uri] equals "/") and ([IP::addr [IP::client_addr] equals 3.3.3.3]) } {
HTTP::redirect "/referrals/blog"
}
elseif { ([HTTP::uri] equals "/") and ([IP::addr [IP::client_addr] equals 4.4.4.4]) } {
HTTP::redirect "/referrals/blog"
}
elseif { ([HTTP::uri] equals "/") and ([IP::addr [IP::client_addr] equals 10.10.10.10]) } {
HTTP::redirect "/referrals/blog"
}
elseif { [HTTP::uri] equals "/" }{
HTTP::redirect "http://www.blahblahblah.co.uk/error/NotInService.html"
}
}
- Colin_Walker_12Historic F5 AccountTo do comparisons against a network range you would use the IP::addr command and something like:
if { [IP::addr [IP::remote_addr] equals 1.1.1.1/255.255.255.0] } { ...
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