Narven
4/23/2015 - 10:56 AM

dns tuning ssh login speedup 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!