How to change the ssh host in Vagrantfile

5,101

The option in your vagrant config should look something like

config.ssh.host = '192.168.0.13'
Share:
5,101

Related videos on Youtube

Brady Lee
Author by

Brady Lee

just another lifelong learner

Updated on September 18, 2022

Comments

  • Brady Lee
    Brady Lee almost 2 years

    I run vagrant(1.7.2) on Mac OS(10.10.3) with Snappy Ubuntu Core(15.04 stable), for docker, using VirtualBox 4.3.28 as a provider.

    It all went well before I configured the "public_network" in Vagrantfile.

    config.vm.network "public_network", bridge: 'en0:Wi-Fi (AirPort)'
    

    After I turn on the "public_network" option, during "vagrant up", the guest os(Snappy Ubuntu 15.04) obtained the IP 192.168.0.13(I logged in in VirtualBox GUI), and i can manually ssh in with the IP(192.168.0.13) and vagrant private key from the Mac terminal.

    My problem is the "vagrant ssh" still tried to ssh into "127.0.0.1":

    default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2222
    default: SSH username: ubuntu
    default: SSH auth method: password
    default: Warning: Connection timeout. Retrying...
    default: Warning: Connection timeout. Retrying...
    

    In vagrant doc I found the config.ssh.host setting, but I cannot figure out a working Vagrantfile for "vagrant ssh".