Multisite subdomain failure on Ubuntu control machine

After having much success/fun (thanks Roots team!), with single site workflows using bedrock/trellis I had an issue with setting up subdomain multisite (on Ubuntu control machine).

Warning: I am absolutley new to Multisite, subdomains and DNS servers and putting this explanation together way after the fact.

Sub site dashboards and the sites themselves were not loading after I had created them.

Browsers returned DNS errors.

vagrant landrush list

Returned my host and IP address as expected.

If I remember correctly I think I could ping the main domain but not sub site domains.

After running:

nslookup -query=any myhost

I recieved messages about name collision, I beleive this was caused by dnsmasq routing the query externallly (ISP DNS server for example), where my local domain collided with an external one. You will also get results from the reserved IP address 127.0.53.53 to indicate there is a collision.

However if you win the lucky draw and your local domain does not collide with an external one then you may recieve a message similar to “** server can’t find myhost: NXDOMAIN”

Which is exactly what I recieved after changing my local domain to something extremely obscure.

So actually the problem seems to be that dnsmasq is not talking to landrush.

And if we read the landrush docs, we find the solution:

Visibility on the Host

If you’re on an OS X host, we use a nice trick to unobtrusively add a secondary DNS server only for specific domains.

Landrush adds a file into /etc/resolver that points lookups for hostnames ending in your config.landrush.tld domain
name to its DNS server. (Check out man 5 resolver on your Mac OS X host for more information on this file’s syntax.)

Though it’s not automatically set up by landrush, similar behavior can be achieved on Linux hosts with dnsmasq. You
can integrate Landrush with dnsmasq on Ubuntu like so (tested on Ubuntu 13.10):

sudo apt-get install -y resolvconf dnsmasq
sudo sh -c ‘echo “server=/vagrant.dev/127.0.0.1#10053” > /etc/dnsmasq.d/vagrant-landrush’
sudo service dnsmasq restart

If you use a TLD other than the default vagrant.dev,
replace the TLD in the above instructions accordingly. Please be aware
that anything ending in ‘.local’ as TLD will not work because the avahi daemon reserves this TLD for its own uses.

Due to our configuration of the Trellis Vagrantfile we need to use our own TLD rather than ‘vagrant.dev’ ie if your local domain is mylocal.dev then you would use ‘dev’.

The name collision issue seems to have been caused by the release of hundreds (thousands?) of new public TLD’s hence my local domain ending in ‘.dev’ had a fair chance of winning the lucky draw.

Besides if you configure dnsmasq to talk to landrush as above then I believe there should be no name collision issue as dnsmasq will not route the query externally once found by landrush (note that I have not actually tested this yet ie by changing my domain name back to the one that caused the name collision).

This is my understanding, please jump in if it is not accurate and hopefully this can save someone else a headache.

Craig

PS maybe a note could go in the mutltisite wiki subdomain section to configure dnsmasq as per the landrush documentation for people using Ubuntu as the control machine?