# Trying to connect to a Windows host using the FQDN

**URL:** <https://forum.ansible.com/t/trying-to-connect-to-a-windows-host-using-the-fqdn/6612>\
**Category:** Get Help\
**Tags:** windows, network, ansible-core\
**Created:** [June 17, 2024, 8:17pm UTC](https://forum.ansible.com/t/trying-to-connect-to-a-windows-host-using-the-fqdn/6612 "2024-06-17T20:17:14Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![jbrown](https://avatars.discourse-cdn.com/v4/letter/j/b19c9b/32.png) [@jbrown](https://forum.ansible.com/u/jbrown)\
**Post date:** [June 17, 2024, 8:17pm UTC](https://forum.ansible.com/t/trying-to-connect-to-a-windows-host-using-the-fqdn/6612/1 "2024-06-17T20:17:15Z")

</div>

Hi everyone,

There seems to be an issue trying to connect to my host using their fully qualified domain name (FQDN). I can ping each host with Ansible using their respective IP Addresses but whenever I try using the FQDN I get this error:

 ![Screenshot 2024-06-17 155527](https://us1.discourse-cdn.com/ansible/original/2X/d/da4305f88f585c3871ea66062adcf76ceebd027d.png)

I have already configured WinRM and have installed packages onto Windows PCs so I know the connection works. I can ping the host from the Windows command line using the FQDN with no issues but when I try it from my Ansible control node (which is on the same PC) I keep getting the error above. I’m wondering whether I have not configured something correctly or if Ansible is just unable to reach the host due to some firewall restriction.

Here is an example of what my inventory looks like:

```auto
[hosts]
my-host1
my-host2

[hosts:vars]
ansible_user=user
ansible_password=mypass
ansible_connection=winrm
ansible_winrm_server_cert_validation=ignore
ansible_winrm_transport=ntlm
ansible_winrm_scheme=https
ansible_winrm_port=5986
ansible_winrm_message_encryption=always

```

I am using the community ansible-core version 2.16.7

Any suggestions about what the error could be would be much appreciated.

Thanks,  
Julian

---

<div class="post-metadata">

**Author:** ![olanok](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/olanok/32/1210_2.png) [@olanok](https://forum.ansible.com/u/olanok)\
**Post date:** [June 17, 2024, 8:50pm UTC](https://forum.ansible.com/t/trying-to-connect-to-a-windows-host-using-the-fqdn/6612/2 "2024-06-17T20:50:14Z")

</div>

Sounds like a DNS resolution issue. From the PC that is running ansible, can you you resolve the IP address from the host name?

nslookup my-host1

---

<div class="post-metadata">

**Author:** ![jbrown](https://avatars.discourse-cdn.com/v4/letter/j/b19c9b/32.png) [@jbrown](https://forum.ansible.com/u/jbrown)\
**Post date:** [June 18, 2024, 1:19pm UTC](https://forum.ansible.com/t/trying-to-connect-to-a-windows-host-using-the-fqdn/6612/3 "2024-06-18T13:19:35Z")

</div>

When I try nslookup:

```auto
nslookup my-host1

```

this is the response:

```auto
Server: 1.1.1.1
Address: 1.1.1.1#53

** server can't find my-host1: NXDOMAIN

```

---

<div class="post-metadata">

**Author:** ![CWollinger](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/cwollinger/32/2847_2.png) [@CWollinger](https://forum.ansible.com/u/CWollinger)\
**Post date:** [June 18, 2024, 1:32pm UTC](https://forum.ansible.com/t/trying-to-connect-to-a-windows-host-using-the-fqdn/6612/4 "2024-06-18T13:32:18Z")

</div>

Make sure that my-host1 is able to be resolved (via DNS or host entry). For https it is also important that your winrm listener is listening on this hostname and that the certificate matches:

```auto
winrm enumerate winrm/config/listener

Listener
    Address = *
    Transport = HTTPS
    Port = 5986
    Hostname = my-host1 
    ListeningOn = xxx.xxx.xxx.xxx
    ...

```

---

<div class="post-metadata">

**Author:** ![jbrown](https://avatars.discourse-cdn.com/v4/letter/j/b19c9b/32.png) [@jbrown](https://forum.ansible.com/u/jbrown)\
**Post date:** [June 18, 2024, 1:48pm UTC](https://forum.ansible.com/t/trying-to-connect-to-a-windows-host-using-the-fqdn/6612/5 "2024-06-18T13:48:39Z")

</div>

Thank you for this info I will check the listener on the host device. I’m also looking into the resolv.conf file on my VM that is running Ansible.

---

<div class="post-metadata">

**Author:** ![jbrown](https://avatars.discourse-cdn.com/v4/letter/j/b19c9b/32.png) [@jbrown](https://forum.ansible.com/u/jbrown)\
**Post date:** [June 18, 2024, 3:23pm UTC](https://forum.ansible.com/t/trying-to-connect-to-a-windows-host-using-the-fqdn/6612/6 "2024-06-18T15:23:03Z")

</div>

I was able to fix the issue by adding the correct DNS IP address to my resolv.conf file. Thank you, guys, for your responses they definitely helped guide me to the solution.
