Filter DNS requests using Aflex
in aFleX
Posted by brunov
I have the following aflex that will allow you to filter the DNS requests by hostname, and limit what will be load balanced to your DNS servers.
Code:
This will allow any request that ends in slb.yahoo.com, or slb.google.com. All other requests will be rejected at the load balancer.
Bruno
I have the following aflex that will allow you to filter the DNS requests by hostname, and limit what will be load balanced to your DNS servers.
Code:
when CLIENT_DATA {
#capture the udp payload and capture the requested hostname
set udplength [UDP::payload length]
set udplength [expr "$udplength-13-5"]
set dnspayload [UDP::payload 13 $udplength]
#replace cntrl character with period and make the hostname human readable
regsub -all {[[:cntrl:]]+} $dnspayload {.} payload_sub
#compare hostname in request to required hostname list
if { ([string first "slb.yahoo.com" $payload_sub] >= 0) or
([string first "slb.google.com" $payload_sub] >= 0) } {
pool DNS
log "There is a match the request is $payload_sub"
} else { reject }
}
This will allow any request that ends in slb.yahoo.com, or slb.google.com. All other requests will be rejected at the load balancer.
Bruno
0