Skip to content

Instantly share code, notes, and snippets.

@neuroticnerd
Last active February 2, 2020 22:14
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save neuroticnerd/30b12648a933677ad2c4 to your computer and use it in GitHub Desktop.
Save neuroticnerd/30b12648a933677ad2c4 to your computer and use it in GitHub Desktop.
Vagrant landrush DNS plugin tips and troubleshooting

landrush

landrush is an excellent Vagrant plugin if you are trying to develop or test in a multi-machine VM environment. It works by spinning up a small local DNS server and registering the private network IPs of each machine during vagrant up so that they can be accessed via their hostname in both the host machine as well as the other guest machines. A great bonus of using landrush is that the VMs can be defined in separate Vagrantfiles (e.g. if you have separate git repos for building different machines).

useful commands

  • vagrant landrush status - show whether the DNS server daemon is currently running locally.
  • vagrant landrush ls - list the currently registered IP + hostname pairs.

troubleshooting

the local DNS daemon is not running

You can check whether the daemon is running by using the command vagrant landrush status. The daemon should be started automatically via vagrant up when it is enabled in your Vagrantfile, but if for some reason it is not started, you can vagrant landrush start.

IPs are not registered but machine is running

Currently, the IP + hostname of a VM is only registered duing the vagrant up command, which means that commands like vagrant reload do not actually trigger the registration of the VM's IP and hostname. Make sure to vagrant halt/destroy and then vagrant up to register the IP/hostname.

hostname is listed in DNS, but will not resolve

Mac OSX is very aggresive regarding negative DNS caching; this means that if at any point you try to access the VM in your browser and it cannot resolve the hostname, that result will be cached and prevent it from resolving for a while after even if it is listed properly in the DNS daemon.

This can usually be fixed by flushing the Mac's DNS cache:

sudo killall -HUP mDNSResponder

DNS cache is flushed but it still cannot resolve

If you have already flushed your OS's DNS cache, it is possible that your browser additionally still has a negative result cached.

  • Firefox:
    1. type about:config in Firefox’s address bar
    2. acknowledge and ignore the warning that appears next
    3. search for an entry called network.dnsCacheExpiration and set it’s value to 0
    4. if there’s no such entry, create a new integer item with the name above and a value of 0
    5. now go back and change the value to your preferred setting (FF default = 60)

hostname resolves but connection is aborted

If you ping the VM from host and get something like:

ping: sendto: Permission denied

Then the most likely culprits are Firewall, Antivirus, or VPN clients (such as the Cisco AnyConnect Secure Client, which blocks certain local traffic). Make sure that you don't have any enabled, or if you do, turn all of them off, then re-enable each until you find which one is causing the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment