I've been trying to work out why the PHP getmxrr()
and checkdnsrr()
methods do not return successfully for working domains in a number of vagrant VMs that I use.
When looking into this further I tried using simple dig
commands and I only get an ANSWER for A
records. Anything else returns nothing.
As an example, here is the 'correct' ANSWER section for an ANY
enquiry showing all of the records for that exist for an example domain (from an AWS-hosted server). You can see that their are at least NS
, TXT
, A
and MX
records:
Debian AWS VM:
$ dig reiss.com ANY
; <<>> DiG 9.9.5-9+deb8u6-Debian <<>> reiss.com ANY
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 65366
;; flags: qr rd ra; QUERY: 1, ANSWER: 20, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;reiss.com. IN ANY
;; ANSWER SECTION:
reiss.com. 55 IN NS ns2.dnsmadeeasy.com.
reiss.com. 55 IN NS ns3.dnsmadeeasy.com.
reiss.com. 55 IN NS ns4.dnsmadeeasy.com.
reiss.com. 55 IN NS ns0.dnsmadeeasy.com.
reiss.com. 55 IN NS ns1.dnsmadeeasy.com.
reiss.com. 55 IN MX 1 reiss-com.mail.protection.outlook.com.
reiss.com. 55 IN TXT "v=spf1 ip4:212.49.201.210 ip4:80.168.187.225 ip4:109.68.12.42 ip4:79.125.20.120 ip4:46.51.172.2 ip4:46.51.172.4 include:spf.protection.outlook.com include:spf.mandrillapp.com -all"
reiss.com. 55 IN TXT "loaderio=44b80a8be72962eccbd8ad01b6bfcac7"
reiss.com. 55 IN TXT "google-site-verification=vrc2bvxpw2quwligK1dYuIFG6SLPp6PsOj3FlbNKmmo"
reiss.com. 55 IN TXT "globalsign-domain-verification=DxtJ51OaIp87_OgmKu-iPxmFMN4i0CvhJtymIzHDyK"
reiss.com. 55 IN TXT "vzjt+g3yB76l1eAihRfinxKPdAJvcxO5AAXUVdOlnqDRjHA8l+fHdBKsUp+mrKeCB2GTaX4GCUpFo5PoYNvTgw=="
reiss.com. 55 IN SOA ns0.dnsmadeeasy.com. dns.dnsmadeeasy.com. 2008025750 43200 3600 1209600 180
reiss.com. 55 IN A 52.85.142.187
reiss.com. 55 IN A 52.85.142.218
reiss.com. 55 IN A 52.85.142.227
reiss.com. 55 IN A 52.85.142.253
reiss.com. 55 IN A 52.85.142.33
reiss.com. 55 IN A 52.85.142.79
reiss.com. 55 IN A 52.85.142.108
reiss.com. 55 IN A 52.85.142.145
;; Query time: 0 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Sat Feb 18 12:48:12 UTC 2017
;; MSG SIZE rcvd: 872
Virtual machine (Centos 7):
Looking at individual requests on my Vagrant VM though and I get:
$ dig reiss.com A
; <<>> DiG 9.9.4-RedHat-9.9.4-38.el7_3.2 <<>> reiss.com ANY
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 32964
;; flags: qr rd ra; QUERY: 1, ANSWER: 8, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;reiss.com. IN ANY
;; ANSWER SECTION:
reiss.com. 3600 IN A 52.85.142.79
reiss.com. 3600 IN A 52.85.142.218
reiss.com. 3600 IN A 52.85.142.227
reiss.com. 3600 IN A 52.85.142.253
reiss.com. 3600 IN A 52.85.142.145
reiss.com. 3600 IN A 52.85.142.33
reiss.com. 3600 IN A 52.85.142.108
reiss.com. 3600 IN A 52.85.142.187
;; Query time: 1 msec
;; SERVER: 10.0.2.3#53(10.0.2.3)
;; WHEN: Sat Feb 18 12:48:24 GMT 2017
;; MSG SIZE rcvd: 155
But any other type of record returns nothing:
$ dig reiss.com MX
; <<>> DiG 9.9.4-RedHat-9.9.4-38.el7_3.2 <<>> reiss.com MX
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOTIMP, id: 2267
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;reiss.com. IN MX
;; Query time: 0 msec
;; SERVER: 10.0.2.3#53(10.0.2.3)
;; WHEN: Sat Feb 18 14:52:15 GMT 2017
;; MSG SIZE rcvd: 38
$ dig reiss.com TXT
; <<>> DiG 9.9.4-RedHat-9.9.4-38.el7_3.2 <<>> reiss.com TXT
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOTIMP, id: 24668
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;reiss.com. IN TXT
;; Query time: 0 msec
;; SERVER: 10.0.2.3#53(10.0.2.3)
;; WHEN: Sat Feb 18 14:53:36 GMT 2017
;; MSG SIZE rcvd: 38
These commands work fine on the AWS server as well as on my Mac OSX host machine locally, it just seems to fail inside my Vagrant/Virtualbox VM.
The problem is also affecting PHP so I don't think it's anything to do with the dig command.
Any ideas?