# Error while setting up agent

**URL:** <https://discuss.elastic.co/t/error-while-setting-up-agent/372750>\
**Category:** Elastic Agent\
**Created:** [January 3, 2025, 2:44pm UTC](https://discuss.elastic.co/t/error-while-setting-up-agent/372750 "2025-01-03T14:44:24Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ahmad3](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ahmad3/32/140410_2.png) [@Ahmad3](https://discuss.elastic.co/u/Ahmad3)\
**Post date:** [January 3, 2025, 2:44pm UTC](https://discuss.elastic.co/t/error-while-setting-up-agent/372750/1 "2025-01-03T14:44:24Z")

</div>

![image](https://us1.discourse-cdn.com/elastic/original/3X/e/a/ea4a2b2a4f7a6997a6d585cf504e2ee3dc8dc3cd.png)

has anyone encountered this annoying error, i tried deleting re trying nothing seems to work.

---

<div class="post-metadata">

**Author:** ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)\
**Post date:** [January 3, 2025, 5:41pm UTC](https://discuss.elastic.co/t/error-while-setting-up-agent/372750/2 "2025-01-03T17:41:48Z")

</div>

Hi @Ahmad3 Please don't post screenshot of text... it is unreadable for many and you will and can not be searched or debugged.

Please review the troubleshooting, although my first guess is a Firewall as the message says unreachable, the message is right there ... please try to curl the fleet endpoint with proper https and port from the server you are trying to install the agent.

[Troubleshooting](https://www.elastic.co/guide/en/fleet/current/fleet-troubleshooting.html)

---

<div class="post-metadata">

**Author:** ![Ahmad3](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ahmad3/32/140410_2.png) [@Ahmad3](https://discuss.elastic.co/u/Ahmad3)\
**Post date:** [January 6, 2025, 10:06pm UTC](https://discuss.elastic.co/t/error-while-setting-up-agent/372750/3 "2025-01-06T22:06:49Z")

</div>

this error is so annoying, i tried possible solution. and i can ping the host.

who has a solution?

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/e/e/eede9e8cf34c722caebde0b0043ee9f4577cdfa3.png)

---

<div class="post-metadata">

**Author:** ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)\
**Post date:** [January 6, 2025, 10:33pm UTC](https://discuss.elastic.co/t/error-while-setting-up-agent/372750/4 "2025-01-06T22:33:27Z")

</div>

This is a connectivity issue... being actively refused by the host... this is most likely a firewall issue not an agent issue

 ![Screenshot 2025-01-06 at 2.24.38 PM](https://us1.discourse-cdn.com/elastic/original/3X/9/2/927a59bce6c1023edd19bf83901a975b5d94bcbf.jpeg)

**Ping does not validate connectivity to host and port via tcp**

Did you try to telnet from this agent host to that host and port where fleet is?

`telnet 10.0.2.15 8220`

What is the result from that?

What is the result of this from the agent host

`curl -k -v https://10.0.2.15:8220`

Also what is you enrollment command ... are you using self signed certs?

If so you need to use the  
`--insecure` flag

as [documented](https://www.elastic.co/guide/en/fleet/current/elastic-agent-cmd-options.html#_synopsis_5)

> `--insecure`
> 
> Allow the Elastic Agent to connect to Fleet Server over insecure connections. This setting is required in the following situations:
> 
> - When connecting to an HTTP server. The API keys are sent in clear text.
> - When connecting to an HTTPs server and the certificate chain cannot be verified. The content is encrypted, but the certificate is not verified.
> - When using self-signed certificates generated by Elastic Agent.
> 
> We strongly recommend that you use a secure connection.
