# How to specify servername to use SNI

**URL:** <https://forum.cedalo.com/t/how-to-specify-servername-to-use-sni/913>\
**Category:** Security\
**Created:** [November 30, 2023, 2:24pm UTC](https://forum.cedalo.com/t/how-to-specify-servername-to-use-sni/913 "2023-11-30T14:24:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![flaviob](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.cedalo.com/flaviob/32/538_2.png) [@flaviob](https://forum.cedalo.com/u/flaviob)\
**Post date:** [November 30, 2023, 2:24pm UTC](https://forum.cedalo.com/t/how-to-specify-servername-to-use-sni/913/1 "2023-11-30T14:24:13Z")

</div>

Hi all, I know mosquitto supports SNI but I would like to know how servername can be specified. I need to access two different MQTT+TLS endpoints inside a kubernetes cluster exposed by an IP address.  
What I read about SNI is that I can use the cluster IP address and via SNI servername access different MQTT endpoints inside the cluster.

What I expected was something like

mosquitto\_pub -h \<cluster\_ip\_address\>

and then the servername that can be servername\_1 or servername\_2 depending on the endpoint I want to connect to inside the cluster.  
Is it possible? Am I’m wrong in something?

---

<div class="post-metadata">

**Author:** ![roger.light](https://avatars.discourse-cdn.com/v4/letter/r/838e76/32.png) [@roger.light](https://forum.cedalo.com/u/roger.light)\
**Post date:** [November 30, 2023, 4:11pm UTC](https://forum.cedalo.com/t/how-to-specify-servername-to-use-sni/913/2 "2023-11-30T16:11:53Z")

</div>

I’m afraid it’s not possible to specify a separate ip address and SNI hostname with the mosquitto clients. The SNI hostname is set based on the hostname provided, and the IP address is obtained through a DNS lookup.
