Learn F5 Technologies, Get Answers & Share Community Solutions Join DevCentral

Filter by:
  • Solution
  • Technology
Answers

IP addresses List

Hi guys,

I have GTM 1600 running BIGIP-10.2.0.1707.0.iso , and i want to add IRule for DNS redirect. I have many IP addresses and I want to build a list to be used in the example below instead of adding a line for each IP. Any idea??

when DNS_REQUEST {
if {[IP::addr [IP::client_addr]/24 equals  10.1.1.0] \
or [IP::addr [IP::client_addr]/24 equals  10.1.2.0] \
or [IP::addr [IP::client_addr]/24 equals  10.1.3.0] \
or [IP::addr [IP::client_addr]/24 equals  10.1.4.0]} {
cname "example1.com"} else {
cname "example2.com"}
}

I tried :
class address_list {
host 10.1.1.0
host 10.1.2.0
}
but i get errors:
01070151:3: Rule [CNAME-REDIRECT-1] error:
line 1: [undefined procedure: class] [class address_list {

Thanks
0
Rate this Question

Answers to this Question

placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER
Unfortunately GTM doesn't currently support datagroups so multiple IP::addr checks are necessary. You could open a case with F5 Support to request this feature. If there's an existing RFE ID, they'll add your request to it. If not, they can create one for you.

Aaron
0
placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER
Hi Aaron,

I find that I can go around it by creating topology record "CGNO" from the GUI [Global Traffic ›› Topology : Regions] and add all IPs to it. Then I use the "matchregion" in my irule as the following:

when DNS_REQUEST {
if { [matchregion ldns CGNO]}{
host 1.1.1.1
log local2. "**** Request from [IP::client_addr]****"

}
else { host 2.2.2.2
log local2. "****Request from [IP::client_addr] ****"
}
}

I think using the "matchregion" in this example makes it easier to me and to my operation team to update subnets without touching the IRule.

matchregion page: http://devcentral.f5.com/wiki/default.aspx/iRules/matchregion.html

Thanks
-Wassim
0
placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER
Hi Wassim,

That looks like a great solution. Thanks for posting it.

Aaron
0