Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Jimmy-Xu/87a2291730d097a352ff to your computer and use it in GitHub Desktop.
Save Jimmy-Xu/87a2291730d097a352ff 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