<commit_before># Landrush: DNS for Vagrant

Simple DNS that's visible on both the guest and the host.

> Because even a Vagrant needs a place to settle down once in a while.

Spins up a small DNS server and redirects DNS traffic from your VMs to use it,
automatically registers/deregisters IP addresseses of guests as they come up
and down.

## Installation

Install under Vagrant (1.1 or later):

    $ vagrant plugin install landrush

## Usage

Enable the plugin in your `Vagrantfile`:

    config.landrush.enable

Bring up a machine that has a private network IP address and a hostname (see the `Vagrantfile` for an example) 

    $ vagrant up

And you should be able to get your hostname from your host:

    $ dig -p 10053 @localhost myhost.vagrant.dev
    
If you shut down your guest, the entries associated with it will be removed.

You can add static host entries to the DNS server in your `Vagrantfile` like so:

    config.landrush.host 'myhost.example.com', '172.16.17.32'

Any DNS queries that do not match will be passed through to an upstream DNS server, so this will be able to serve as the one-stop shop for your guests' DNS needs.

### Visibility on the Guest

Linux guests using iptables should automatically have their DNS traffic redirected properly to our DNS server. File an issue if this does not work for you.

### Visibility on the Host

I'm currently developing this on OS X 10.8, and there's a nice trick you can pull to unobtrusibly add a secondary DNS server only for specific domains.

All you do is drop a file in `/etc/resolver/$DOMAIN` with information on how to connect to the DNS server you'd like to use for that domain.

So what I do is name all of my vagrant servers with the pattern `$host.vagrant.dev` and then drop a file called `/etc/resolver/vagrant.dev` with these contents:

```
# Use landrush server for this domain
nameserver 127.0.0.1
port 10053
```

Once you have done this, you can run `scutil --dns` to confirm that the DNS resolution is working -- you should see something like:
```
resolver #8
  domain   : vagrant.dev
  nameserver[0] : 127.0.0.1
  port     : 10053
```


This gives us automatic access to the landrush hosts without having to worry about it getting in the way of our normal DNS config.

## Work in Progress - Lots to do!

* The guest visibility strategy assumes iptables-based firewall.
* Lots of static values that need configurin' - config location, ports, etc.
* VirtualBox only right now, need to support VMWare
* Tests tests tests.

## Contributing

1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request<commit_msg>bolster readme a bit<commit_after># Landrush: DNS for Vagrant

Simple DNS that's visible on both the guest and the host.

> Because even a Vagrant needs a place to settle down once in a while.

Spins up a small DNS server and redirects DNS traffic from your VMs to use it,
automatically registers/deregisters IP addresseses of guests as they come up
and down.

## Installation

Install under Vagrant (1.1 or later):

    $ vagrant plugin install landrush

## Usage

### Get started

Enable the plugin in your `Vagrantfile`:

    config.landrush.enable

Bring up a machine that has a private network IP address and a hostname (see the `Vagrantfile` for an example)

    $ vagrant up

And you should be able to get your hostname from your host:

    $ dig -p 10053 @localhost myhost.vagrant.dev

If you shut down your guest, the entries associated with it will be removed.


### Static entries

You can add static host entries to the DNS server in your `Vagrantfile` like so:

    config.landrush.host 'myhost.example.com', '172.16.17.32'

This is great for overriding production services for nodes you might be testing locally. For example, perhaps you might want to override the hostname of your puppetmaster to point to a local vagrant box instead.

### Unmatched Queries

Any DNS queries that do not match will be passed through to an upstream DNS server, so this will be able to serve as the one-stop shop for your guests' DNS needs.

### Visibility on the Guest

Linux guests using iptables should automatically have their DNS traffic redirected properly to our DNS server. File an issue if this does not work for you.

### Visibility on the Host

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

If you name all of my vagrant servers with the pattern `$host.vagrant.dev` and then drop a file called `/etc/resolver/vagrant.dev` with these contents:

```
# Use landrush server for this domain
nameserver 127.0.0.1
port 10053
```

Once you have done this, you can run `scutil --dns` to confirm that the DNS resolution is working -- you should see something like:
```
resolver #8
  domain   : vagrant.dev
  nameserver[0] : 127.0.0.1
  port     : 10053
```

This gives us automatic access to the landrush hosts without having to worry about it getting in the way of our normal DNS config.

There's also a handy command to automate the creation of this file:

```
vagrant landrush install
```

### Additional CLI commands

Check out `vagrant landrush` for additional commands to monitor the DNS server daemon.

## Work in Progress - Lots to do!

* The guest visibility strategy assumes iptables-based firewall.
* Lots of static values that need configurin' - config location, ports, etc.
* Tests tests tests.

## Contributing

1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request
{'fraction_non_alphanumeric': 0.06127747966072356, 'fraction_numerical': 0.016098320927817208, 'mean_word_length': 3.7791563275434243, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 6, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6969995', 'n_tokens_mistral': 1753, 'n_tokens_neox': 1607, 'n_words': 892}