# Using the command line to install the elastic agent, a port error occurs

**URL:** <https://discuss.elastic.co/t/using-the-command-line-to-install-the-elastic-agent-a-port-error-occurs/336035>\
**Category:** Elastic Agent\
**Created:** [June 15, 2023, 4:07am UTC](https://discuss.elastic.co/t/using-the-command-line-to-install-the-elastic-agent-a-port-error-occurs/336035 "2023-06-15T04:07:30Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![xqaiviwjxzw](https://avatars.discourse-cdn.com/v4/letter/x/bbce88/32.png) [@xqaiviwjxzw](https://discuss.elastic.co/u/xqaiviwjxzw)\
**Post date:** [June 15, 2023, 4:07am UTC](https://discuss.elastic.co/t/using-the-command-line-to-install-the-elastic-agent-a-port-error-occurs/336035/1 "2023-06-15T04:07:30Z")

</div>

Using the command line to install the elastic agent, a port error occurs,the access port is communicable,what is the reason? How to solve it? Hope to get a reply, thank you

> sudo ./elastic-agent install -f --url=[https://xxx.xxx.xxx:8220](https://xxx.xxx.xxx:8220) --enrollment-token=xxxxxxxxxxxxxxx --insecure --force

```auto
Error: fail to enroll: fail to execute request to fleet-server: read tcp 192.168.xxx.xxx:60813->xxx.xxx.xxx.xxx:8220: read: connection reset by peer

For help, please see our troubleshooting guide at ​https://www.elastic.co/guide/en/fleet/8.7/fleet-troubleshooting.html

Error: enroll command failed with exit code: 1

For help, please see our troubleshooting guide at ​https://www.elastic.co/guide/en/fleet/8.7/fleet-troubleshooting.html

```

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

---

<div class="post-metadata">

**Author:** ![wsouza](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/wsouza/32/92547_2.png) [@wsouza](https://discuss.elastic.co/u/wsouza)\
**Post date:** [June 15, 2023, 12:52pm UTC](https://discuss.elastic.co/t/using-the-command-line-to-install-the-elastic-agent-a-port-error-occurs/336035/2 "2023-06-15T12:52:58Z")

</div>

Hi @xqaiviwjxzw !

For a deeper analysis, more information would be needed, for example:

1. Does the host where the fleet-server is installed have a firewall enabled? If so, are there explicit rules that allow access to hosts on the local network?
2. Does the host that is trying to join the fleet-server have an active firewall?
3. Have you evaluated routing issues if they are on different networks?
4. Which linux distribution are you using?

Try to run the command netstat -nlvupt and post the result for analysis of applications that are in listening mode. If you have an active firewall, port 443 must be open.

---

<div class="post-metadata">

**Author:** ![xqaiviwjxzw](https://avatars.discourse-cdn.com/v4/letter/x/bbce88/32.png) [@xqaiviwjxzw](https://discuss.elastic.co/u/xqaiviwjxzw)\
**Post date:** [June 16, 2023, 2:58am UTC](https://discuss.elastic.co/t/using-the-command-line-to-install-the-elastic-agent-a-port-error-occurs/336035/3 "2023-06-16T02:58:03Z")

</div>

At present, the initial suspicion is that the domain name has been intercepted by the network operator. Apart from changing the domain name, is there any other way to solve it? Hope to hear back, thank you.

---

<div class="post-metadata">

**Author:** ![wsouza](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/wsouza/32/92547_2.png) [@wsouza](https://discuss.elastic.co/u/wsouza)\
**Post date:** [June 16, 2023, 11:58am UTC](https://discuss.elastic.co/t/using-the-command-line-to-install-the-elastic-agent-a-port-error-occurs/336035/4 "2023-06-16T11:58:10Z")

</div>

Bearing in mind that it is something in the network layer, it is interesting to resolve this pending issue first and, if the problem persists, evaluate other possibilities.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 14, 2023, 11:58am UTC](https://discuss.elastic.co/t/using-the-command-line-to-install-the-elastic-agent-a-port-error-occurs/336035/5 "2023-07-14T11:58:21Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
