DNS for Vagrant: Installing the Landrush plugin for Vagrant

I’ve been using Vagrant for a several years now and love it. One of my few complaints was that each time I wanted to create a new machine I would need to edit my /etc/hosts file. Then I found the excellent Vagrant plugin named Landrush.

My hosts file went from this:

127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
192.168.10.2 project1
192.168.10.3 project2
192.168.10.4 project4
192.168.10.5 project5
192.168.10.6 project6
192.168.10.7 project7
192.168.10.8 project8
192.168.10.9 project9

To this:

127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost

How to Install Landrush

Installing and using Landrush is really easy.

Step 1: Install the plugin

vagrant plugin install Landrush

Step 2: Add the Landrush configuration to your Vagrantfile

config.vm.hostname = "project1.vagrant.dev" # if not set yet
config.landrush.enabled = true

There are more options you can add which can be found here.

If you don’t want to use the TLD of vagrant.dev you can change it but keep it mind it will override that TLD on your computer. If you set your box’s hostname to something.google.com and set landrush.tld = google.com your searches won’t work very well unless you use Bing…nevermind, your searches still won’t work very well.

Step 3: Start up your vagrant box

vagrant up

That’s it. Landrush does everything else for you.

Test your box, project1.vagrant.dev should be pointing to the IP address of your vagrant box.

Share

1 comment

  1. Excellent post. Precise!

    One additional point for future visitors. I was sold by the fact that it does not need “Password” every time you boot a machine. Other plugins (hostmanager) need to sudo/edit /etc/hosts. That is a bit of a bummer.

    In this you need to enter password only when you use a new tld in your configuration. This includes first time launch too

Leave a Reply

Your email address will not be published. Required fields are marked *