# Connection to windows target host timeout

**URL:** <https://forum.ansible.com/t/connection-to-windows-target-host-timeout/26416>\
**Category:** Ansible Project\
**Tags:** windows\
**Created:** [January 4, 2018, 3:19pm UTC](https://forum.ansible.com/t/connection-to-windows-target-host-timeout/26416 "2018-01-04T15:19:27Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![MA1](https://avatars.discourse-cdn.com/v4/letter/m/bbce88/32.png) [@MA1](https://forum.ansible.com/u/MA1)\
**Post date:** [January 4, 2018, 3:19pm UTC](https://forum.ansible.com/t/connection-to-windows-target-host-timeout/26416/1 "2018-01-04T15:19:27Z")

</div>

I’m trying to win\_ping a windows host to verify a connection but I keep getting the timeout error bellow:

windows1 | UNREACHABLE! =\> {  
“changed”: false,  
“msg”: “plaintext: HTTPConnectionPool(host=‘xx.xx.xx.xx’, port=3128): Read timed out. (read timeout=30)”,  
“unreachable”: true  
}

I can establish a connection via telnet from the control machine to the target host but when I run win\_ping it times out.

Any help is greatly appreciated.

---

<div class="post-metadata">

**Author:** ![jborean](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/jborean/32/1525_2.png) [@jborean](https://forum.ansible.com/u/jborean)\
**Post date:** [January 4, 2018, 10:12pm UTC](https://forum.ansible.com/t/connection-to-windows-target-host-timeout/26416/2 "2018-01-04T22:12:58Z")

</div>

Have you set up the WinRM listener with a custom port, usually it is over 5985 or 5986 (HTTPS) but the message is saying you are connecting over 3128.

Thanks

Jordan

---

<div class="post-metadata">

**Author:** ![MA1](https://avatars.discourse-cdn.com/v4/letter/m/bbce88/32.png) [@MA1](https://forum.ansible.com/u/MA1)\
**Post date:** [January 4, 2018, 10:24pm UTC](https://forum.ansible.com/t/connection-to-windows-target-host-timeout/26416/3 "2018-01-04T22:24:44Z")

</div>

Hi, I haven’t. what’s been shown in the message is my proxy, I didn’t quite understand why its being shown as an error though.

Regards

MA

---

<div class="post-metadata">

**Author:** ![jborean](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/jborean/32/1525_2.png) [@jborean](https://forum.ansible.com/u/jborean)\
**Post date:** [January 5, 2018, 12:28am UTC](https://forum.ansible.com/t/connection-to-windows-target-host-timeout/26416/4 "2018-01-05T00:28:37Z")

</div>

If you are trying to connect through a proxy I would set the WinRM host settings based on the host itself and then define the proxy vars as environment variables, e.g.

inventory.ini

`  
ansible\_host=xx.xx.xx.xx  
ansible\_user=username  
ansible\_password=password  
ansible\_port=5986  
ansible\_connection=winrm  
ansible\_winrm\_server\_cert\_validation=ignore

`

When running Ansible make sure you have defined the following environment variables

`export HTTPS_PROXY=https://proxyhost:3128 ansible-playbook -i inventory.ini main.yml`

Unfortunately there is no way to programatically define the proxy for an individual host in Ansible as pywinrm does not expose those parameters.

Thanks

Jordan
