iRule dns gslb

Hi Guys,

Is it possible to make irule script and applying to F5 DNS GSLB as scenario at below ?

for domain

- example1.com (local) ( because already have record local )

- example2.com (local) ( because already have record local )

- example3.com (local) ( because already have record local )

- bigexample.com --> will be forward to dns (10.242.x.21 & 22 )

- other than that ( other domain ) --> will be forward to Internet (8.8.8.8)

Create a Wide IP of “Aexample1.com”

and apply the simple iRule of:

if DNS lookup = “example1.com” then return DNS response “123.123.123.123” else process requests as normal.

when DNS_REQUEST {

set type [DNS::question type]

if {$type equals “A” } {

set host [DNS::question name]

if {$host contains “ceisa.customs.go.id” } {

DNS::answer insert “[DNS::question name]. 111 [DNS::question class] [DNS::question type] 10.161.5.100”

DNS::return

if {$type equals “A” } {

set host [DNS::question name]

if {$host contains “beacukai.go.id” } {

DNS::answer insert “[DNS::question name]. 111 [DNS::question class] [DNS::question type] 10.161.6.33”

DNS::return

if {$type equals “A” } {

set host [DNS::question name]

if {$host contains “kemenkeu.go.id” } {

DNS::answer insert “[DNS::question name]. 111 [DNS::question class] [DNS::question type] 10.242.53.21, 10.242.53.22”

DNS::return

}

}

}

Surely this is possible?

Can anyone help with an example iRule?

Any help appreciated.