cogitatio/vagrant-hostsupdater — pull request #36 by ben-rosio (2014-01-21 23:38:50+00:00)
Title: Use ifconfig on guest machine to get any extra IPs available

This came about when I was attempting to use a private network with type dhcp. No host manager I've found supports this (as supporting it is a bit weird).

I went ahead and added the code to easily support it, but it could use some work, which I wouldn't mind doing when I have a bit more time.

It works by connecting to the machine, running `ifconfig`, and parsing out all the inet addresses. It then loops through them, excluding the first (which is put in for Vagrant, if I understand correctly) and localhost. It'll add them to the list of ips returned if they aren't already in it.

This allows dhcp private networks, which is really nice (so now you never have to know the ip, just your host name).

Example configuration:

config.vm.hostname = "devel.localhost"
config.vm.network :private_network, type: :dhcp