Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save bartek/9be413139fe3558414f0a55f3846d116 to your computer and use it in GitHub Desktop.
Save bartek/9be413139fe3558414f0a55f3846d116 to your computer and use it in GitHub Desktop.
speeding up DNS/SSH connections in vagrant
- Tune /etc/ssh/sshd_config
UseDNS no # Disable DNS lookups
GSSAPIAuthentication no # Disable negotation of slow GSSAPI
don't forget to restart it, use a script provider to set it , or create it with veewee or snapshot it
- Tune Vagrantfile
vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
See <http://serverfault.com/questions/453185/vagrant-virtualbox-dns-10-0-2-3-not-working?rq=1>
- Logging into the vm with a regular ssh command
See <http://blog.codeboutique.com/post/creating-debian-squeeze-box-for-vagrant>
vagrant ssh-config vmname | ssh -t -t -F/dev/stdin vmname
Use the -t -t to overcome the pseudoterminal warning
- Now use a control connnection for ssh
(as it seems that the cli invocation of vagrant takes a couple of seconds ....)
Setup the control session:
vagrant ssh-config vmname | ssh -t -t -F/dev/stdin -o 'ControlMaster auto' -o 'ControlPath ~/.ssh/vagrant' vmname
Use it for fast login
ssh -o 'ControlMaster auto' -o 'ControlPath ~/.ssh/vagrant' vmname
Now it logins in a matter of milliseconds!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment