Forum Discussion

Jessica_42876's avatar
Jessica_42876
Icon for Nimbostratus rankNimbostratus
Jul 26, 2014

iRule trouble DNS_request

Hi! everyone

 

I have some issues with an iRule, the irule that my boss ask me is one that, check the IP that the client request and change the IP that response that request.

 

for example:

 

In the configuratión I have a zone runner www.domain.com with IP 192.168.1.40 www.domain2.com with IP 192.168.1.41 www.domain3.com with IP 192.168.1.42 www.redirect.domain.com IP 192.168.2.80

 

The subnet that is necesary to change is 192.168.1.0/24

 

Then when the request in the DNS was (www.domain.com) the Request will be attended by www.redirect.domain.com

 

I did a DataGroup of the subnet that is necessary to change with name RED_1.

 

The irule is:

 

when DNS_REQUEST { if {[class match [IP::local_addr] equals Red_1]}{ cname www.redirect.domain.ipn.mx } }

 

But is wrong the irule send me the message:[undefined procedure:[cname]]

 

if I type

 

when DNS_REQUEST { if {[class match [IP::local_addr] equals Red_1]}{ use cname www.redirect.domain.ipn.mx } }

 

the message is that the cname is use by a Address translation

 

How I can solve this irule?. Please help me.

 

  • Hi Jessica,

    First check that your version of GTM can deal with data groups. If it can (After 11.1 I think) you might want to modify your iRule slightly.

    when DNS_REQUEST { if {[class match [IP::addr[IP::client_addr] equals "Red_1"]]}{ cname www.redirect.domain.ipn.mx } }
    IP::client_addr because that yields the address of the clients that you want to check. IP::local_addr gives you an address that is on the BigIP itslef.

    If you think that the problem may be down to the data group query you could try

    when DNS_REQUEST { if { [IP::addr [IP::client_addr] equals 192.168.1.0/24] } { cname www.redirect.domain.ipn.mx } }