download and extract BIND.
1 | $ wget ftp://ftp.isc.org/isc/bind9/9.9.3/bind-9.9.3.tar.gz |
Download the patch from Wilmer van der Gaast.
1 | $ wget http://wilmer.gaa.st/edns-client-subnet/bind-9.9.3-dig-edns-client-subnet-iana.diff |
Patch the code, configure (without OpenSSL because we only want dig) and compile.
1 | $ patch -p0 < bind-9.9.3-dig-edns-client-subnet-iana.diff |
Now you will have dig placed in bin/dig. You can try it this way:
1 | $ ./bin/dig/dig @ns1.google.com www.google.es +client=157.88.0.0/16 |
Note the CLIENT-SUBNET line in the answer OPT PSEUDOSECTION.>