hung_105573
Jul 12, 2013Nimbostratus
Irule Dns to handle nslookup dns from client
Hi all
i have irule handle request dns from client , when client lookup dns with subdomain match list subdomain in white_list datagroup then this irule will reponse record "A" to client , this a irule also monitor link status of line internet terminated on F5 . the case 3 lines internet up then , we want this irule response record "A" to client flow loadbalance round robin to share performance of 3 lines .
pls see irule and help me
when DNS_REQUEST {
set Whitelist_Match 0
if {[class match $fqdn equals whitelist] } {
does FQDN exist in our whitelist string:value datagroup for that site.
if { [LB::status node 183.91.x.y] eq "up" } {
Client made a DNS request for a Whitelist site.
set Whitelist_Match 1
set FakeIPv4_cmc [class match -value $fqdn equals whitelist]
DNS::return
}
if { [LB::status node 222.255.x.y] eq "up" } {
set Whitelist_Match 1
set FakeIPv4_vnpt [class match -value $fqdn equals vnpt_whitelist]
DNS::return
}
if {[LB::status node 118.69.x.y] eq "up" } {
set Whitelist_Match 1
set FakeIPv4_fpt [class match -value $fqdn equals fpt_whitelist]
DNS::return
}
}
}
when DNS_RESPONSE {
if { $Whitelist_Match } {
switch [DNS::question type] {
"A" {
DNS::answer insert "$fqdn. $static::whitelist_ttl [DNS::question class] [DNS::question type] $FakeIPv4_cmc"
DNS::answer insert "$fqdn. $static::whitelist_ttl [DNS::question class] [DNS::question type] $FakeIPv4_vnpt"
DNS::answer insert "$fqdn. $static::whitelist_ttl [DNS::question class] [DNS::question type] $FakeIPv4_fpt"
}
default {
}
}
}
}
many thanks