# Elastic agent behind NAT

**URL:** <https://discuss.elastic.co/t/elastic-agent-behind-nat/316424>\
**Category:** Elastic Agent\
**Created:** [October 12, 2022, 9:37am UTC](https://discuss.elastic.co/t/elastic-agent-behind-nat/316424 "2022-10-12T09:37:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![krzychohoho](https://avatars.discourse-cdn.com/v4/letter/k/c68b51/32.png) [@krzychohoho](https://discuss.elastic.co/u/krzychohoho)\
**Post date:** [October 12, 2022, 9:37am UTC](https://discuss.elastic.co/t/elastic-agent-behind-nat/316424/1 "2022-10-12T09:37:01Z")

</div>

Hi, I came across some issues while trying to install elastic-agent. The case is I have a fleet server with elastic and kibana on local machine with local IP adres. The problem is that i need to deploy elastic agent on another host that sees the fleet server through external adres. And thi is the one I use to enroll elastic agent. For example. Fleet is running on internal 192.168.0.1 And the external is 34.55.23.22. These are just example IPs. So the enroll command I use on host where I want to have an elastic-agent is:

> elastic-agent enroll -f --url=https://EXTERNAL\_IP:8220 --enrollment-token=Token --certificate-authorities /etc/pki/ca-trust/source/anchors/ca.crt

The /etc/pki/ca-trust/source/anchors/ca.crt is installed and this the same one that I am using on fleet server. Fleet server and Elastic certificates are created with two Ip adresses internal and external.

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

After enrollment the agent is healthy for about seconds and becomes unhealthy.

 ![obraz](https://us1.discourse-cdn.com/elastic/original/3X/2/b/2bf81d38cf245635573446ef40b920530576b3cb.png)

So I checked the logs and this is the error:

> {"log.level":"error","@timestamp":"2022-10-12T09:11:14.646Z","log.origin":{"file.name":"fleet/fleet\_gateway.go","file.line":202},"message":"failed to dispatch actions, error: fail to communicate with updated API client hosts: Get "https://INTERNAL\_IP:8220/api/status?": context deadline exceeded","ecs.version":"1.6.0"}

So the conclusion is that it still tries to communicate with and internal adres. Why? How can i change it?

Thank you in advance for your help.

---

<div class="post-metadata">

**Author:** ![krzychohoho](https://avatars.discourse-cdn.com/v4/letter/k/c68b51/32.png) [@krzychohoho](https://discuss.elastic.co/u/krzychohoho)\
**Post date:** [October 12, 2022, 10:05am UTC](https://discuss.elastic.co/t/elastic-agent-behind-nat/316424/2 "2022-10-12T10:05:45Z")

</div>

Ok think i got this. I need to change fleet adres in settings inside fleet tab.

---

<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:** [November 9, 2022, 10:05am UTC](https://discuss.elastic.co/t/elastic-agent-behind-nat/316424/3 "2022-11-09T10:05:59Z")

</div>

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