Question

How can I make IP address for vagrant ssh the same as for the VM? What would I need to change/add to my manifest (Vagrant config files) ?

To explain my situation a little more: In my /etc/hosts file, I've setup local domains to map to the IP address of the VM as 192.168.56.105 - this is what is configured in the Vagrant setup, this works.

However vagrant ssh tries to connect to 127.0.0.1

Why would this be?

My vagrant ssh details are (when outputted to a file):

Host default HostName 127.0.0.1 User vagrant Port 2222 UserKnownHostsFile /dev/null StrictHostKeyChecking no PasswordAuthentication no IdentityFile /Users/rdavis/.vagrant.d/insecure_private_key IdentitiesOnly yes LogLevel FATAL

Was it helpful?

Solution

My specific problem had a root cause in port collision (with other VMs I'm using). Full credit to my colleague for spotting this.

Vagrant detects port collision but in your Vagrantfile config you have to do something about it i.e.

auto_correct: true

https://docs.vagrantup.com/v2/networking/forwarded_ports.html

This means that I can run more than one VM at a time without this issue.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top