chef / knife-windows

Plugin for Chef's knife tool for working with Windows nodes
Apache License 2.0
152 stars 110 forks source link

Network Error: Connection refused - connect(2) #452

Closed kmanohar1 closed 6 years ago

kmanohar1 commented 6 years ago

WHile running 'knife bootstrap windows winrm' I am seeing this error:

C:\Users\Administrator>IF "AMD64" == "x86" IF not defined PROCESSOR_ARCHITEW6432

C:\Users\Administrator>goto install Checking for existing downloaded package at "C:\Users\Administrator\AppData\Local\Temp\chef-client-latest.msi" No existing downloaded packages to delete. Attempting to download client package using PowerShell if available... powershell.exe -ExecutionPolicy Unrestricted -InputFormat None -NoProfile -NonInteractive -File C:\chef\wget.ps1 "http://temp-file01.us.com/tools/chef_bootstrap/cca/chef-client-13.6.4-1-x64.msi" "C:\Users\Administrator\AppData\Local\Temp\chef-client-latest.msi" Download via PowerShell succeeded. Installing downloaded client package...

C:\Users\Administrator>msiexec /qn /log "C:\Users\Administrator\AppData\Local\Temp\chef-client-msi24808.log" /i "C:\Users\Administrator\AppData\Local\Temp\chef-client-latest.msi" ERROR: Network Error: Connection refused - connect(2) for "10.150.133.205" port 5985 (10.150.133.205:5985)

dheerajd-msys commented 6 years ago

@kmanohar1, It seems from your logs that you are hitting into private IP address for bootstrapping the VM. You can use Public IP address for bootstrap and also there are some prerequisites that you need to configure after VM creation :

  1. Update your security groups inbound rules for opening the port 5985 & 5986 from portal.
  2. Configure Winrm services for creating the listener and opening the ports 5985 & 5986.

Please follow Readme https://github.com/chef/knife-windows OR try out below commands to configure Winrm services :

winrm quickconfig -q
winrm create winrm/config/Listener?Address=*+Transport=HTTP
winrm set winrm/config/winrs '@{MaxMemoryPerShellMB="300"}'
winrm set winrm/config '@{MaxTimeoutms="1800000"}'
winrm set winrm/config/service '@{AllowUnencrypted="true"}'
winrm set winrm/config/service/auth '@{Basic="true"}'
netsh advfirewall firewall add rule name="WinRM 5985" protocol=TCP dir=in localport=5985 action=allow
netsh advfirewall firewall add rule name="WinRM 5986" protocol=TCP dir=in localport=5986 action=allow
NetSh Advfirewall set allprofiles state off
net stop winrm
net start winrm
  1. Bootstrap the VM.

I've tried out all these and successfully bootstrap the VM.

Hope it helps,

Thanks

dheerajd-msys commented 6 years ago

@kmanohar1 Any updates on this? Please try and let us know.

Thanks

Vasu1105 commented 6 years ago

@kmanohar1 If you are still running with this issue feel free to open this again and provide more details like Windows version, knife command and and what whether you are using public or private IP. I am closing this for now.

sunilvishvakarma commented 4 years ago

While bootstrapinng the windows machine, i get the below messages and fails

knife bootstrap -o winrm IP -N "host name" -u user-name -P 'Password' -vvvv

INFO: Using configuration from /Users/suns0002/.chef/knife.rb DEBUG: Checking if we need to accept Chef license to bootstrap node DEBUG: Reading products and relationships... DEBUG: Successfully read products and relationships Connecting to DEBUG: winrm-fs requested, loading WinRM::FS gem (~> 1.0) DEBUG: WinRM::FS previously loaded DEBUG: [WinRM] @<{:transport=>:negotiate, :disable_sspi=>false, :basic_auth_only=>false, :endpoint=>"http://:5985/wsman", :user=>"administrator", :password=>"", :no_ssl_peer_verification=>false, :realm=>nil, :service=>nil, :ca_trust_file=>nil, :ssl_peer_fingerprint=>nil}> (Write-Host '[WinRM] Established ') DEBUG: [WinRM] opening remote shell on http://10.4.54.167:5985/wsman DEBUG: [WinRM] Endpoint doesn't support config request for MaxEnvelopsizekb DEBUG: [WinRM] opening remote shell on http://10.4.54.167:5985/wsman DEBUG: [WinRM] Endpoint doesn't support config request for MaxEnvelopsizekb DEBUG: [WinRM] opening remote shell on http://10.4.54.167:5985/wsman DEBUG: [WinRM] Endpoint doesn't support config request for MaxEnvelopsizekb

I have tried the above solution, but still same results. could you please someone help me in this

Regards Sunil

Vasu1105 commented 4 years ago

@suniilsync may be you can increase the envelope size and check just for reference https://github.com/dsccommunity/SharePointDsc/wiki/Error-Exceeded-the-configured-MaxEnvelopeSize-quota