Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vagrant tries to use IPv6 address and fails to connect via WinRM #8759

Closed
sandersaares opened this issue Jul 7, 2017 · 2 comments · Fixed by #8831
Closed

Vagrant tries to use IPv6 address and fails to connect via WinRM #8759

sandersaares opened this issue Jul 7, 2017 · 2 comments · Fixed by #8831

Comments

@sandersaares
Copy link

sandersaares commented Jul 7, 2017

Vagrant version

Vagrant 1.9.6

Host operating system

Windows Server 2016

Guest operating system

Windows Server 2016

Vagrantfile

Does not appear dependent on anything specific in my Vagrantfile. Here is a sanitized version:

# -*- mode: ruby -*-
# vi: set ft=ruby :

vm_image_url = "c:/tmp/Windows2016-HyperV.box"
vm_name = "my-windows-host"
vswitch_name = "xxx"

Vagrant.configure("2") do |config|
  config.vm.provision "Copy setup files to guest",
    type: "file", source: "../Content", destination: "C:/Users/xxx/Vagrant"

  config.vm.box = vm_image_url

  config.vm.guest = :windows

  config.vm.provider "hyperv" do |hyperv|
      hyperv.vmname = vm_name

      # First boot can take a while, as it does the post-sysprep initialization. Just chill for a bit.
      hyperv.ip_address_timeout = 300
  end

  config.vm.communicator = "winrm"
  # The transport we use provides encryption but not server authentication. No MITM protection, in other words.
  config.winrm.transport = :ssl
  config.winrm.ssl_peer_verification = false
  config.winrm.basic_auth_only = true

  config.vm.network "public_network", bridge: vswitch_name

  # Synced folders are not necessary and in fact, can be quite problematic.
  # The images may or may not support them but disable them just to be safe.
  config.vm.synced_folder ".", "/vagrant", disabled: true

  # Default credentials used in the ASDP component host base images. Should be changed by the provision steps above.
  config.winrm.username = "xxx"
  config.winrm.password = "xxx"

end

Debug output

https://gist.github.com/sandersaares/a7872745c6f4707b585d5cd12828574d

Expected behavior

VM should have started and provisioning process executed. The connection should be established through IPv4 once the VM gets its IP address from DHCP.

Actual behavior

VM started but Vagrant for some reason grabbed its IPv6 autoconfigured address instead of the IPv4 address (assigned via DHCP) and was thereafter unable to connect to it for whatever reason via WinRM.

==> default: Waiting for the machine to report its IP address...
    default: Timeout: 300 seconds
    default: IP: fe80::3494:c53c:280a:146c
==> default: Waiting for machine to boot. This may take a few minutes...
    default: WinRM address: fe80::3494:c53c:280a:146c:5986
    default: WinRM username: xxx
    default: WinRM execution_time_limit: PT2H
    default: WinRM transport: ssl
C:/HashiCorp/Vagrant/embedded/mingw64/lib/ruby/2.3.0/uri/rfc3986_parser.rb:67:in `split': bad URI(is not URI?): https://fe80::3494:c53c:280a:146c:5986/wsman (URI::InvalidURIError)
        from C:/HashiCorp/Vagrant/embedded/mingw64/lib/ruby/2.3.0/uri/rfc3986_parser.rb:73:in `parse'
        from C:/HashiCorp/Vagrant/embedded/mingw64/lib/ruby/2.3.0/uri/common.rb:227:in `parse'
        from C:/HashiCorp/Vagrant/embedded/gems/gems/winrm-2.2.3/lib/winrm/http/transport.rb:29:in `initialize'
        from C:/HashiCorp/Vagrant/embedded/gems/gems/winrm-2.2.3/lib/winrm/http/transport.rb:237:in `initialize'
        from C:/HashiCorp/Vagrant/embedded/gems/gems/winrm-2.2.3/lib/winrm/http/transport_factory.rb:48:in `new'
        from C:/HashiCorp/Vagrant/embedded/gems/gems/winrm-2.2.3/lib/winrm/http/transport_factory.rb:48:in `init_ssl_transport'
        from C:/HashiCorp/Vagrant/embedded/gems/gems/winrm-2.2.3/lib/winrm/http/transport_factory.rb:29:in `create_transport'
        from C:/HashiCorp/Vagrant/embedded/gems/gems/winrm-2.2.3/lib/winrm/connection.rb:82:in `transport'
        from C:/HashiCorp/Vagrant/embedded/gems/gems/winrm-2.2.3/lib/winrm/connection.rb:76:in `shell_factory'
        from C:/HashiCorp/Vagrant/embedded/gems/gems/winrm-2.2.3/lib/winrm/connection.rb:41:in `shell'
        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.9.6/plugins/communicators/winrm/shell.rb:66:in `cmd'
        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.9.6/plugins/communicators/winrm/communicator.rb:107:in `block in ready?'
        from C:/HashiCorp/Vagrant/embedded/mingw64/lib/ruby/2.3.0/timeout.rb:91:in `block in timeout'
        from C:/HashiCorp/Vagrant/embedded/mingw64/lib/ruby/2.3.0/timeout.rb:33:in `block in catch'
        from C:/HashiCorp/Vagrant/embedded/mingw64/lib/ruby/2.3.0/timeout.rb:33:in `catch'
        from C:/HashiCorp/Vagrant/embedded/mingw64/lib/ruby/2.3.0/timeout.rb:33:in `catch'
        from C:/HashiCorp/Vagrant/embedded/mingw64/lib/ruby/2.3.0/timeout.rb:106:in `timeout'
        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.9.6/plugins/communicators/winrm/communicator.rb:106:in `ready?'
        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.9.6/plugins/communicators/winrm/communicator.rb:57:in `block in wait_for_ready'
        from C:/HashiCorp/Vagrant/embedded/mingw64/lib/ruby/2.3.0/timeout.rb:91:in `block in timeout'
        from C:/HashiCorp/Vagrant/embedded/mingw64/lib/ruby/2.3.0/timeout.rb:33:in `block in catch'
        from C:/HashiCorp/Vagrant/embedded/mingw64/lib/ruby/2.3.0/timeout.rb:33:in `catch'
        from C:/HashiCorp/Vagrant/embedded/mingw64/lib/ruby/2.3.0/timeout.rb:33:in `catch'
        from C:/HashiCorp/Vagrant/embedded/mingw64/lib/ruby/2.3.0/timeout.rb:106:in `timeout'
        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.9.6/plugins/communicators/winrm/communicator.rb:31:in `wait_for_ready'
        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.9.6/lib/vagrant/action/builtin/wait_for_communicator.rb:16:in `block in call'
        from C:/HashiCorp/Vagrant/embedded/gems/gems/logging-2.2.2/lib/logging/diagnostic_context.rb:474:in `block in create_with_logging_context'

Steps to reproduce

  1. vagrant up
@ashokvaddevalli
Copy link

ashokvaddevalli commented Jul 27, 2017

I am also facing same issue Vagrant with vSphere.

Vagrant 1.9.7

E:\Vagrant-vpshere\Vagrant>vagrant up --provider=vsphere
Bringing machine 'default' up with 'vsphere' provider...
==> default: Calling vSphere CloneVM with the following settings:
==> default: -- Template VM: Demo/vm/Templates/win7-vagrant
==> default: -- Target VM: Demo/vm/Templates/test
==> default: New virtual machine successfully cloned
==> default: Waiting for the machine to report its IP address...
default: Timeout: 240 seconds
default: IP: X.X.X.X
==> default: Waiting for machine to boot. This may take a few minutes...
default: WinRM address: X.X.X.X:5985
default: WinRM username: administrator
default: WinRM execution_time_limit: PT2H
default: WinRM transport: negotiate
bad URI(is not URI?): http://2002:a463:5ab4::a463:5ab4:5985/wsman

@ghost
Copy link

ghost commented Apr 1, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@hashicorp hashicorp locked and limited conversation to collaborators Apr 1, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants