Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ::1 to hosts on host machine? #266

Open
runofthemill opened this issue May 24, 2018 · 1 comment
Open

Add ::1 to hosts on host machine? #266

runofthemill opened this issue May 24, 2018 · 1 comment

Comments

@runofthemill
Copy link

Hi there! One of the projects I use frequently, https://github.com/roots/trellis, uses vagrant-hostmanager to manage the hosts file on the host for accessing local VMs. For whatever reason, connecting to the VMs in the browser is incredibly slow when there's only an IPv4 entry in hosts, and I've been able to fix it by adding a separate entry for ::1. A section of /etc/hosts might look like this:

## vagrant-hostmanager-start id: a361872c-e564-44a3-998e-962e4e0c46e8
192.168.50.5	gr.test
192.168.50.5	www.gr.test
## vagrant-hostmanager-end

::1				gr.test

I'd love to do this programmatically, so I was curious if this is something the plugin is currently capable of (perhaps undocumented) or something that could be added as a feature?

Thank you!

@keengene
Copy link

keengene commented Jul 17, 2018

I needed to do something similar today. Using the Custom IP resolver functionality seems to do the trick as it will take any output and write to /etc/hosts. Try:

config.hostmanager.ip_resolver = proc do 
  `echo ::1`.rstrip  
end`

That would of course replace the IPv4 entry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants