# Recommendation for network.host value when VMs are prone to get replaced with change of IP

**URL:** <https://discuss.elastic.co/t/recommendation-for-network-host-value-when-vms-are-prone-to-get-replaced-with-change-of-ip/179283>\
**Category:** Elasticsearch\
**Created:** [May 2, 2019, 6:08am UTC](https://discuss.elastic.co/t/recommendation-for-network-host-value-when-vms-are-prone-to-get-replaced-with-change-of-ip/179283 "2019-05-02T06:08:49Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![sg.esearch](https://avatars.discourse-cdn.com/v4/letter/s/e8c25b/32.png) [@sg.esearch](https://discuss.elastic.co/u/sg.esearch)\
**Post date:** [May 2, 2019, 6:08am UTC](https://discuss.elastic.co/t/recommendation-for-network-host-value-when-vms-are-prone-to-get-replaced-with-change-of-ip/179283/1 "2019-05-02T06:08:49Z")

</div>

As per [https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-network.html#network-interface-values](https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-network.html#network-interface-values), the network.host value can be an IP, hostname or special value like `_eth0_`

In our production environment, the VMs are prone to get replaced anytime without notice such that their IP address changes, but hostname does not.

What is the best setting of network.host in such a scenario?  
The hostname is kind of long (60+ chars) and we would like to avoid it is possible.  
But we also want the replaced VM (data-disk still remains as such with the VM as its networked storage) to re-join the indexes it was part of.

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [May 2, 2019, 6:23am UTC](https://discuss.elastic.co/t/recommendation-for-network-host-value-when-vms-are-prone-to-get-replaced-with-change-of-ip/179283/2 "2019-05-02T06:23:08Z")

</div>

Why not just use the interface identifier and not worry about it?

---

<div class="post-metadata">

**Author:** ![sg.esearch](https://avatars.discourse-cdn.com/v4/letter/s/e8c25b/32.png) [@sg.esearch](https://discuss.elastic.co/u/sg.esearch)\
**Post date:** [May 2, 2019, 6:25pm UTC](https://discuss.elastic.co/t/recommendation-for-network-host-value-when-vms-are-prone-to-get-replaced-with-change-of-ip/179283/3 "2019-05-02T18:25:19Z")

</div>

I will try to give a small example to clarify.  
Let us say previously the node was bound to IP1.  
After replace, the IP became IP2 and the new node is bound to IP2 now.  
The hostname has remained unchanged during the replace.

My concern is that will ES recognize that IP1 is gone for good and start using IP2 from that point onwards without any issues? I guess I saw some article which talks about automatic load-balancing of shards but it would be good to confirm a specific use-case if someone has experience dealing with it.

Is it better to bind to the unchanging hostname? Or ES is able to handle the IP-change seamlessly?

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [May 2, 2019, 7:51pm UTC](https://discuss.elastic.co/t/recommendation-for-network-host-value-when-vms-are-prone-to-get-replaced-with-change-of-ip/179283/4 "2019-05-02T19:51:52Z")

</div>

> [@sg.esearch](#):
>
> My concern is that will ES recognize that IP1 is gone for good and start using IP2 from that point onwards without any issues?

Yes, it will.

---

<div class="post-metadata">

**Author:** ![sg.esearch](https://avatars.discourse-cdn.com/v4/letter/s/e8c25b/32.png) [@sg.esearch](https://discuss.elastic.co/u/sg.esearch)\
**Post date:** [May 2, 2019, 9:16pm UTC](https://discuss.elastic.co/t/recommendation-for-network-host-value-when-vms-are-prone-to-get-replaced-with-change-of-ip/179283/5 "2019-05-02T21:16:36Z")

</div>

Thank you Mark !

---

<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:** [May 30, 2019, 9:16pm UTC](https://discuss.elastic.co/t/recommendation-for-network-host-value-when-vms-are-prone-to-get-replaced-with-change-of-ip/179283/6 "2019-05-30T21:16:40Z")

</div>

Closed on May 30, 2019, 9:16pm UTC

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