vagrant 2.0.0 and hyperv

86 views
Skip to first unread message

Paul Baxter

unread,
Sep 30, 2017, 7:56:19 PM9/30/17
to Vagrant
Having problems with connecting to my VM and possibly initial insecure key ssh exchange for my first box.

Can ping the VM from host but not SSH.

VM (centos/7) is created and I can log in via hyperv console but not via ssh.

Anyone point me to recent documentation that is pertinent to setting up the ssh, or the hyper v network

(e.g. I've seen some web blogs suggest you must run vagrant as an administrator in powershell)
I've tried both as <user> and run as admin but no real difference. Both seem to create and start the VM and neither let me ssh in!



my <user> .ssh dir has
vagrant insecure public key (from github.. hashicorp/keys/vagrant.pub) copied as <user>\.ssh\authorized_keys
Also locally generated a public/private key using ssh-keygen
Files are <user>\.ssh\rsa_id and rsa_id.pub
Overwrote <user>\.vagrant.d\insecure_private_key with the contents of my rsa_id (private key)

Using openssh v7.5p1 (latest) or putty

Getting a connection refused with ssh or putty but don't know why and how to debug this.


Other info:

hyperV external switch shared with the host win 10 pro machine
ipconfig on host reports the vExternal switch IP as 192.168.1.X
Connecting into the VM via hyper V with password. ip a also shows eth0 with IP 192.168.1.X (same IP as virtual switch) - expected?

Tried changing the VM machine to use a legacy network adapter instead. No difference.

Initial trials were unsuccessful. However in the middle of trying lots of things, I did have this working earlier, but having destroyed the VM and recreated I have failed to repeat the success.


Alvaro Miranda Aguilera

unread,
Sep 30, 2017, 8:17:25 PM9/30/17
to vagra...@googlegroups.com
what about permissions?

from the console as your user try

chown -R vagrant: ~/.ssh
chmod -R 0600 ~/.ssh
chmod 0700 ~/.ssh

first command set owner
second set all file and dir as RW
third (no -R) set dir to RWX

then you can try vagrant ssh



--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/mitchellh/vagrant/issues
IRC: #vagrant on Freenode
---
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vagrant-up+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/c6c1348f-d1ee-4f7f-a29b-7f2b08b7bbba%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Alvaro

Paul Baxter

unread,
Sep 30, 2017, 8:24:31 PM9/30/17
to Vagrant
Overwrote <user>\.vagrant.d\insecure_private_key with the contents of my rsa_id (private key)

BTW this seemed strange since the default VM still has the vagrant.pub insecure public key, so surely the insecure private key shouldn't be overwritten?

Tried without this step to no effect, which makes me think this is more a basic network thing than an ssh one?

PS My external connection is over wifi in case that matters! 

Alvaro Miranda Aguilera

unread,
Sep 30, 2017, 8:26:02 PM9/30/17
to vagra...@googlegroups.com
can you share a debug log of vagrant ssh

ie

set VAGRANT_LOG=debug
vagrant ssh

and from the vm an

ls -al ~/.ssh

screenshot is fine if you are over the console


--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/mitchellh/vagrant/issues
IRC: #vagrant on Freenode
---
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vagrant-up+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Alvaro

Paul Baxter

unread,
Sep 30, 2017, 8:31:51 PM9/30/17
to Vagrant
I'm running this from windows powershell, so there isn't a vagrant user here. Just my user account??

I have my user\.ssh dir set as read only and all it's files rsa_id, rsa_id.pub and authorized_keys (copy of vagrant.pub) are read only
To unsubscribe from this group and stop receiving emails from it, send an email to vagrant-up+...@googlegroups.com.



--
Alvaro

Alvaro Miranda Aguilera

unread,
Oct 2, 2017, 3:15:42 AM10/2/17
to vagra...@googlegroups.com
hello

my bad

those were meant to the vagrant user inside the guest vm.

To unsubscribe from this group and stop receiving emails from it, send an email to vagrant-up+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/49a690f5-9710-453d-bfd8-d34821162858%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Alvaro

Message has been deleted

Paul Baxter

unread,
Oct 2, 2017, 4:57:07 AM10/2/17
to Vagrant
Thanks for the replies.

Problem was solved by
a) Removing and then adding appropriate vExternal hyperV switch
b) Removing openssh (vagrant normally relies on its own ssh client)
c) Removing my own .ssh keys and using default insecure_private_key in my .vagrant.d dir
(Basically reinstalling and ignoring the article I previously posted).

Now I see the insecure key replaced by a secure key as part of the first vagrant up and stored in the same dir structure as the Vagrantfile (so don't check in the whole tree!)

One minute later I'm in my bright shiny new Centos 7 dev environment :)

Now on to packer and ansible...

PS Your tip about --debug was very helpful in identifying my ssh connection timeout

PS My network config is wifi adapter 'wifi' into network bridge and network bridge properties set to connect to just 'wifi' for local resources (untick vExternal and vInternal). network bridge has the hyperv switch extension ticked.
Note, my machine is wifi only, no external ethernet port. Internet connection sharing is NOT selected. Internet from vExternal VMs achieved via the bridge direct to wifi.

Still not 100% on this network connection. I'd prefer if the VMs were on an internal connection with an explicit share on the host to allow the internet on the wifi connection to be shared by nodes on the internal network. (currently my VMs pick up IPs via DHCP in my router's subnet.
Reply all
Reply to author
Forward
0 new messages