THIS IS RATHER OBSOLETE: These patches were merged into BIND quite a few versions ago, I think.

These patches add the ability to send and receive DNS messages with edns-client-subnet options to BIND's dig utility.

Patches are available for a few BIND versions. The -iana patches use the new IANA-assigned option code instead of the old temporary one.

The patch against BIND 9.7 contains a memory allocation bug so it's better to use a newer version.

Example:

wilmer@fiona:~/src/bind-ecs$ bin/dig/dig @ns1.google.com www.google.com +client=130.89.89.130

; <<>> DiG 9.7.1-P2 <<>> @ns1.google.com www.google.com +client=130.89.89.130
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 512
; CLIENT-SUBNET: 130.89.89.130/32/21
;; QUESTION SECTION:
;www.google.com.                        IN      A

;; ANSWER SECTION:
www.google.com.         604800  IN      CNAME   www.l.google.com.
www.l.google.com.       300     IN      A       74.125.79.104
www.l.google.com.       300     IN      A       74.125.79.99
www.l.google.com.       300     IN      A       74.125.79.147
[DIR]      4096 Jun 11  2017 ../
[FILE]     8720 Jan 11  2016 bind-9.7.1-dig-edns-client-subnet-iana.diff
[FILE]     9539 Jan 11  2016 bind-9.7.1-dig-edns-client-subnet.diff
[FILE]     9907 Jan 11  2016 bind-9.7.3-dig-edns-client-subnet.diff
[FILE]     9207 Jan 11  2016 bind-9.8.4-dig-edns-client-subnet-iana.diff
[FILE]     9189 Jan 11  2016 bind-9.9.3-dig-edns-client-subnet-iana.diff