Forum Discussion
IP::addr with Different Masks
I'm still new to iRules. This is similar to an iRule I found online:
when HTTP_REQUEST { switch [IP::addr [IP::client_addr] mask 255.255.255.0] { "10.10.4.0" - "192.168.4.0" { pool pool_http_server_1 } default { pool default_pool } } }
I need to modify it for the networks I'm working on, but they’re not all /24s. I don't know whether there's a way to match a specific IP with a specific mask, or whether there's a different approach I should use. I was thinking of something along the lines of:
when HTTP_REQUEST { switch [IP::addr [IP::client_addr] ] { "10.0.0.0 mask 255.0.0.0" - "192.168.0.0 mask 255.255.0.0" {
Can anyone help steer me to what will work? Thanks.
3 Replies
- John_Meggers
Nimbostratus
Sorry, the iRule lost its formatting when I submitted. In the suggested section, I'm not sure if there's a variable to represent the subnet mask, or what should go after [IP::client_addr]. - James_Thomson
Employee
can you explain what you want to do? Do you want clients from 10.0.0.0/8 to go to one pool and clients from 192.168.0.0/16 to go to another pool?
- nitass
Employee
since you want to match number of subnets (with different subnet mask), shouldn't it be easier to use class match instead of IP::addr command?
class
https://devcentral.f5.com/wiki/irules.class.ashx
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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