Forum Discussion

John_Meggers's avatar
John_Meggers
Icon for Nimbostratus rankNimbostratus
Apr 10, 2014

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

  • 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].
  • 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?