4

We have an OSX host and an ubuntu 10.04 vagrant instance running on virtualbox. While attempting to send an email to emailtests.com (for email testing purposes) we noticed that the DNS was not resolving appropriately.

So we tried to following command on OSX and our Vagrant instance: dig -tMX emailtests.com

OSX

; <<>> DiG 9.8.3-P1 <<>> -tMX emailtests.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 39364
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 4, ADDITIONAL: 3

;; QUESTION SECTION:
;emailtests.com.            IN  MX

;; ANSWER SECTION:
emailtests.com.     300 IN  MX  10 litmus-smtp-in-392690123.us-east-1.elb.amazonaws.com.

;; AUTHORITY SECTION:
emailtests.com.     172711  IN  NS  ns-1596.awsdns-07.co.uk.
emailtests.com.     172711  IN  NS  ns-215.awsdns-26.com.
emailtests.com.     172711  IN  NS  ns-1288.awsdns-33.org.
emailtests.com.     172711  IN  NS  ns-964.awsdns-56.net.

;; ADDITIONAL SECTION:
ns-964.awsdns-56.net.   158810  IN  A   205.251.195.196
ns-1288.awsdns-33.org.  158499  IN  A   205.251.197.8
ns-1596.awsdns-07.co.uk. 72461  IN  A   205.251.198.60

;; Query time: 74 msec
;; SERVER: 184.73.189.33#53(184.73.189.33)
;; WHEN: Mon Sep  9 13:15:02 2013
;; MSG SIZE  rcvd: 282

Vagrant

; <<>> DiG 9.7.0-P1 <<>> -tMX emailtests.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 2227
;; flags: qr aa rd; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0
;; WARNING: recursion requested but not available

;; QUESTION SECTION:
;emailtests.com.            IN  MX

;; Query time: 104 msec
;; SERVER: 10.0.2.3#53(10.0.2.3)
;; WHEN: Mon Sep  9 13:09:42 2013
;; MSG SIZE  rcvd: 32

As you can see the MX records are not resolving the same way. I looked around online and found answers telling us to add the following the vagrant file:

  config.vm.customize ["modifyvm", :id, "--natdnsproxy1", "on"]
  config.vm.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
  config.vm.customize ["modifyvm", :id, "--natdnspassdomain1", "on"]

Which we already had. We are still not able to resolve that address and likely many other addresses properly. Any ideas about how to solve this or narrow down the problem?

Note: we are able to send email to gmail and can ping/dig some domains.

UPDATE, ifconfig from vagrant

eth0      Link encap:Ethernet  HWaddr 08:00:27:36:71:5f  
          inet addr:10.0.2.15  Bcast:10.0.2.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fe36:715f/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:38137 errors:0 dropped:0 overruns:0 frame:0
          TX packets:26845 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:18987844 (18.9 MB)  TX bytes:6605246 (6.6 MB)

eth1      Link encap:Ethernet  HWaddr 08:00:27:80:07:aa  
          inet addr:192.168.42.3  Bcast:192.168.42.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fe80:7aa/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:8294812 errors:0 dropped:0 overruns:0 frame:0
          TX packets:4509692 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:1871276346 (1.8 GB)  TX bytes:1268188839 (1.2 GB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:815216 errors:0 dropped:0 overruns:0 frame:0
          TX packets:815216 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:371105283 (371.1 MB)  TX bytes:371105283 (371.1 MB)
Parris
  • 329
  • 3
  • 16

2 Answers2

2

Looks like the configured DNS server, 10.0.2.3, is not configured to do recursive lookups. You don't get an answer at all. Use a DNS server that can do recursive lookups, or configure yours to be able to do so.

mfinni
  • 36,144
  • 4
  • 53
  • 86
1

I stumbled across this while looking at the same problem this morning, and after a lot of googling/head-scratching came up with the following solution, which i'll post for anyone else who has this issue in future and gets stuck.

The natdns Vagrantfile settings that work for us (Vagrant 1.6.3, tested on OSX (using VirtualBox 4.3.14) and Windows8 (using Virtual Box 4.3.15 r95286 - my colleague had different unrelated problem using 4.3.14 with windows8 so is using a beta build that appears to work properly with vagrant)

config.vm.customize ["modifyvm", :id, "--natdnsproxy1", "off"]
config.vm.customize ["modifyvm", :id, "--natdnshostresolver1", "off"]
config.vm.customize ["modifyvm", :id, "--natdnspassdomain1", "off"]

(definitely the first line, you might not need the following two, i've included them just incase you switched them to on while experimenting - i have just --natdnsproxy1 and --natdnshostresolver1 in my Vagrantfile both set to off).

The reason appears to be that Vagrant defaults --natdnsproxy1 to on, and virtualboxs' proxied DNS for mx lookups seems flawed/broken/flakey - if you set it to off the vm will use the IP addresses the host uses for the DNS rather than trying to proxy them via 10.0.2.3 - et voila you get the full mx records from DNS (or at least we do).

(For a little google-searching goodness, the reason i came to all this was that emails weren't being sent to certain domains from vagrant running Centos 6.5 - we could see sendmail was responding with the error: 503 "This mail server requires authentication when attempting to send to a non-local e-mail address..." , and we then discovered that doing a dig mydomain.com mx was returning the A record of the domain rather than the expected MX mail ones, which suggested a DNS lookup issue with Vagrant / VirtualBox ).