Forum Discussion

upatel209_95128's avatar
upatel209_95128
Icon for Nimbostratus rankNimbostratus
Apr 29, 2014

DNS caching

I have created my first irule but get an error when RULE_INIT {

 Hostname to resolve to IP - Production
set ::EBSProductionHost "edt-online.ebs.nationalgrid.com"

 Time in ms after which to re-query DNS server 
set ::QueryTime 30000

table add -subtable "DNS" "Production" "[RESOLV::lookup @10.165.128.41 $::EBSProductionHost]" indef
    after $::QueryTime - periodic { table replace -subtable "DNS" "Production" "[RESOLV::lookup @10.165.128.41 $::EBSProductionHost]" indef }

}

when CLIENT_ACCEPTED {

 Retrieve VIP address from table and define variable
set ::VIP [table lookup -subtable "DNS" "Prodution"]

 Select the IP 
log local0. "IP resolved! - [lindex $::VIP 0]"
node [lindex ::VIP 0] 21

}

error as

01070151:3: Rule [/Common/ebs_dns_edt] error: /Common/ebs_dns_edt:9: error: [command is not valid in current event context (RULE_INIT)][RESOLV::lookup @10.165.128.41 $::EBSProductionHost] /Common/ebs_dns_edt:9: error: [command is not valid in current event context (RULE_INIT)][table add -subtable "DNS" "Production" "[RESOLV::lookup @10.165.128.41 $::EBSProductionHost]" indef]