# Hostname resolution

**URL:** <https://forum.inductiveautomation.com/t/hostname-resolution/111698>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [October 24, 2025, 10:35am UTC](https://forum.inductiveautomation.com/t/hostname-resolution/111698 "2025-10-24T10:35:39Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![jakned](https://avatars.discourse-cdn.com/v4/letter/j/4da419/32.png) [@jakned](https://forum.inductiveautomation.com/u/jakned)\
**Post date:** [October 24, 2025, 10:35am UTC](https://forum.inductiveautomation.com/t/hostname-resolution/111698/1 "2025-10-24T10:35:40Z")

</div>

Hi, we are running Perspective app on multiple Raspberry Pi touchscreens and I since I have some application logic tied to a location, I use their hostname to display different views.

Now I have been running that for year now and I wanted to have a wifi connection as a backup in case network cable fails. Thats when the hostname resolution problems started. This is a code i use to determine the hostname:  
`InetAddress.getByName(ip).getHostName()`

While this works on one active NIC, when the Pi has both wifi and eth, the code fails to resolve the hostname.

What could i do to have both wifi and eth running and still have the hostname resolution working?

Thanks

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [October 24, 2025, 10:40am UTC](https://forum.inductiveautomation.com/t/hostname-resolution/111698/2 "2025-10-24T10:40:33Z")

</div>

Try `InetAddress.getLocalHost().getHostName()` and see if that gets you a better result.

---

<div class="post-metadata">

**Author:** ![jakned](https://avatars.discourse-cdn.com/v4/letter/j/4da419/32.png) [@jakned](https://forum.inductiveautomation.com/u/jakned)\
**Post date:** [October 24, 2025, 10:49am UTC](https://forum.inductiveautomation.com/t/hostname-resolution/111698/3 "2025-10-24T10:49:54Z")

</div>

Hi Kevin, thanks. I might have been not specific enough. I need to resolve a hostname of the Pi running the Perspective app. The `getLocalHost` gets me a hostname of the server running the script.

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [October 24, 2025, 10:51am UTC](https://forum.inductiveautomation.com/t/hostname-resolution/111698/4 "2025-10-24T10:51:45Z")

</div>

Ahh, yeah... not sure then. You may need to hardcode a lookup table instead.

Not sure if it's possible or advised to have reverse DNS lookups point multiple IP at the same hostname, but I'm not an expert there.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [October 24, 2025, 11:17am UTC](https://forum.inductiveautomation.com/t/hostname-resolution/111698/5 "2025-10-24T11:17:37Z")

</div>

> [@jakned](#):
>
> since I have some application logic tied to a location

This is reason #1 to not use Perspective for fixed-location HMIs. The code you are trying to run (in Perspective) actually runs in the gateway, which won't have any insight into the client's route tables.

Vision can do this, and can interrogate more reliable unique info, like local MAC addresses.

> [@Mobile Client MAC Address](https://forum.inductiveautomation.com/t/mobile-client-mac-address/23037/10):
>
> In a real Vision client, you can obtain the local MAC addresses with the following script: from java.net import NetworkInterface # Get list of local mac address as strings def myMacIds(): macs = [ni.hardwareAddress for ni in NetworkInterface.getNetworkInterfaces() if ni.hardwareAddress] return [":".join(["%02x" % (b & 0xff) for b in mac]) for mac in macs] Also, again in a real Vision client, you can obtain the outbound network interface and the corresponding local IP address the clien…

---

<div class="post-metadata">

**Author:** ![tgarrison](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/tgarrison/32/80965_2.png) [@tgarrison](https://forum.inductiveautomation.com/u/tgarrison)\
**Post date:** [October 24, 2025, 11:30am UTC](https://forum.inductiveautomation.com/t/hostname-resolution/111698/6 "2025-10-24T11:30:42Z")

</div>

Pass in a url parameter to identify the screen assuming it’s not a security problem for your situation.

Or assign each Pi it’s own Perspective login.

Or assign static IPs for both network interfaces, and use that instead of the hostname.

---

<div class="post-metadata">

**Author:** ![jakned](https://avatars.discourse-cdn.com/v4/letter/j/4da419/32.png) [@jakned](https://forum.inductiveautomation.com/u/jakned)\
**Post date:** [October 24, 2025, 12:34pm UTC](https://forum.inductiveautomation.com/t/hostname-resolution/111698/7 "2025-10-24T12:34:08Z")

</div>

Thanks Phil for suggestion. All our development is now in Perspective.

---

<div class="post-metadata">

**Author:** ![jakned](https://avatars.discourse-cdn.com/v4/letter/j/4da419/32.png) [@jakned](https://forum.inductiveautomation.com/u/jakned)\
**Post date:** [October 24, 2025, 12:36pm UTC](https://forum.inductiveautomation.com/t/hostname-resolution/111698/8 "2025-10-24T12:36:50Z")

</div>

I was considering also these options but the only one i can do is the one with ip addresses. I am also thinking about using nslookup from the underlying os that runs the gateway. Nslookup on the server works fine.

I opted for hostnames instead of IP addresses because i can replace the device without involving network team since i am the one configuring the hostname.

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [October 24, 2025, 12:43pm UTC](https://forum.inductiveautomation.com/t/hostname-resolution/111698/9 "2025-10-24T12:43:26Z")

</div>

Maybe I misunderstand, but could you use the `[System]Gateway/SystemName` tag to do this ?

---

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [October 24, 2025, 12:46pm UTC](https://forum.inductiveautomation.com/t/hostname-resolution/111698/10 "2025-10-24T12:46:20Z")

</div>

I think he wants the hostname of the client, not gateway.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [October 24, 2025, 12:47pm UTC](https://forum.inductiveautomation.com/t/hostname-resolution/111698/11 "2025-10-24T12:47:48Z")

</div>

> [@jakned](#):
>
> only one i can do is the one with ip addresses

If your IT group ever puts NAT between your HMIs and the gateway, Ignition will only see the NAT common IP. (Perhaps this is happening on your wifi path?)

> [@jakned](#):
>
> I opted for hostnames instead of IP addresses because i can replace the device without involving network team

Nowhere does a client tell Perspective what its host name is. The gateway must use reverse DNS on the source IP to look them up in your gateway's IT infrastructure. So your IT still has put hostnames into the infrastructure.

A Vision client can interrogate its local client environment for the hostname and pass it to the gateway. It is one of the other reliable unique identifiers that Vision can use that Perspective cannot.

> [@jakned](#):
>
> All our development is now in Perspective.

This is a huge mistake, IMNSHO. At least for applications that need fixed-location HMIs. (And a few other things.)

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [October 24, 2025, 12:51pm UTC](https://forum.inductiveautomation.com/t/hostname-resolution/111698/12 "2025-10-24T12:51:19Z")

</div>

I was under the impression he wanted to change a displayed view based on the gateway, but as I said, I may have misunderstood.

edit: Oh wait, I see where I went wrong. I thought the RPIs were his gateways, but they're the HMIs.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [October 24, 2025, 12:52pm UTC](https://forum.inductiveautomation.com/t/hostname-resolution/111698/13 "2025-10-24T12:52:42Z")

</div>

> [@pascal.fragnoud](#):
>
> based on the gateway

No, he has fixed-location HMIs that can't be disambiguated by IP when connecting over wi-fi. Which breaks the logic for which machine's information to display/control.

---

<div class="post-metadata">

**Author:** ![jakned](https://avatars.discourse-cdn.com/v4/letter/j/4da419/32.png) [@jakned](https://forum.inductiveautomation.com/u/jakned)\
**Post date:** [October 24, 2025, 1:54pm UTC](https://forum.inductiveautomation.com/t/hostname-resolution/111698/14 "2025-10-24T13:54:24Z")

</div>

> [@pturmel](#):
>
> So your IT still has put hostnames into the infrastructure.

Not exactly. Not sure what magic is behing this, but when I deploy the Pi, I set the hostname and it ends up in the DNS. That means I dont have to ask IT to create a new reservation or a DNS record. I just take another one and give it the same hostname.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [October 24, 2025, 2:19pm UTC](https://forum.inductiveautomation.com/t/hostname-resolution/111698/15 "2025-10-24T14:19:05Z")

</div>

> [@jakned](#):
>
> I set the hostname and it ends up in the DNS.

That means your IT has set up your DHCP server for your LAN to push client-supplied hostnames into your LAN's reverse-DNS. Which is why it works for your LAN.

Does your wifi DHCP do this too?

---

<div class="post-metadata">

**Author:** ![miketob](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/miketob/32/5936_2.png) [@miketob](https://forum.inductiveautomation.com/u/miketob)\
**Post date:** [October 31, 2025, 8:43am UTC](https://forum.inductiveautomation.com/t/hostname-resolution/111698/16 "2025-10-31T08:43:21Z")

</div>

For fixed location HMI using web-based apps, like perspective, I usually store the location in a cookie, so, the first screen I show to the user is a “Configure location” screen, where the user selects the apropiate location and gets stored in a cookie, so subsequent sessions know that are running in that location.

---

<div class="post-metadata">

**Author:** ![jakned](https://avatars.discourse-cdn.com/v4/letter/j/4da419/32.png) [@jakned](https://forum.inductiveautomation.com/u/jakned)\
**Post date:** [October 31, 2025, 10:29am UTC](https://forum.inductiveautomation.com/t/hostname-resolution/111698/17 "2025-10-31T10:29:20Z")

</div>

> Does your wifi DHCP do this too?

Yes sir.

---

<div class="post-metadata">

**Author:** ![jakned](https://avatars.discourse-cdn.com/v4/letter/j/4da419/32.png) [@jakned](https://forum.inductiveautomation.com/u/jakned)\
**Post date:** [October 31, 2025, 10:30am UTC](https://forum.inductiveautomation.com/t/hostname-resolution/111698/18 "2025-10-31T10:30:18Z")

</div>

That is interesting, would be able to share the part where you work with the cookie?
