Forum Discussion
Please help creating this iRule to direct subnets to different paths.
Please help creating this iRule to direct subnets to different paths.I would need something like below 2 samples. Please let me know if you need any other details.
when HTTP_REQUEST { if {Subnet 10.9.254.0/24 , 164.38.32.0/24, 10.10.10.0/24 etc.} forward to path XYZ } else {Subnet NOT above subnets } forward to path ABC }
when HTTP_REQUEST { if {Subnet 10.9.254.0/24 , 164.38.32.0/24, 10.10.10.0/24 etc.} forward to path XYZ } else {Anything other subnet other than above subnets} forward to path ABC }
===================== Sys::Version Main Package Product BIG-IP Version 10.2.4
8 Replies
- nathe
Cirrocumulus
How about something like this?
Create a datagroup with the subnets above and call it, say "xyz_subnet" and this iRule should do it
when HTTP_REQUEST { if {([class match [IP::remote_addr] equals xyz_subnet]) } { HTTP::uri "/XYZ" } else { HTTP::uri "/ABC" } }Hope this helps, N
- nathe
Cirrocumulus
You can list the subnets, as many as you want, in the datagroup itself in a list format. Is that what you mean?
- nathe
Cirrocumulus
See Jason's article here. You'd want an Internal class:
https://devcentral.f5.com/articles/irules-data-group-formatting-rules.UotsncQRBfg
- Thomas_Gobet_91
Cirrostratus
There's no specific syntax, you just have to define a datagroup with all your subnets in it. You can create it through the Web interface or via tmsh.
Here is an example of what you have to define :
ltm data-group internal /Common/Network { records { DMZ { data 192.168.10.0/24 } LAN { data 192.168.0.0/24 } } type string }- Srijana_137175
Nimbostratus
Ok, I will create a Data Group for bunch of subnets but how do i CALL that data group( lets say Testdata_gp) in below iRule script ?? when HTTP_REQUEST { if {([class match [IP::remote_addr] equals xyz_subnet]) } { HTTP::uri "/XYZ" } else { HTTP::uri "/ABC" } }
- Thomas_Gobet
Nimbostratus
There's no specific syntax, you just have to define a datagroup with all your subnets in it. You can create it through the Web interface or via tmsh.
Here is an example of what you have to define :
ltm data-group internal /Common/Network { records { DMZ { data 192.168.10.0/24 } LAN { data 192.168.0.0/24 } } type string }- Srijana_137175
Nimbostratus
Ok, I will create a Data Group for bunch of subnets but how do i CALL that data group( lets say Testdata_gp) in below iRule script ?? when HTTP_REQUEST { if {([class match [IP::remote_addr] equals xyz_subnet]) } { HTTP::uri "/XYZ" } else { HTTP::uri "/ABC" } }
- nathe
Cirrocumulus
xyz_subnet was my example, replace this with Testdata_gp. This means it will look up this datagroup for the subnets you've entered and redirect accordingly.
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