# Connecting to device (using hostname) via WIFI

**URL:** <https://forums.balena.io/t/connecting-to-device-using-hostname-via-wifi/133323>\
**Category:** openBalena\
**Created:** [June 15, 2020, 1:18pm UTC](https://forums.balena.io/t/connecting-to-device-using-hostname-via-wifi/133323 "2020-06-15T13:18:01Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![gerb0n](https://avatars.discourse-cdn.com/v4/letter/g/85e7bf/32.png) [@gerb0n](https://forums.balena.io/u/gerb0n)\
**Post date:** [June 15, 2020, 1:18pm UTC](https://forums.balena.io/t/connecting-to-device-using-hostname-via-wifi/133323/1 "2020-06-15T13:18:01Z")

</div>

I have a local-mode enabled device (raspberrypi 4). It is connected with an ethernet cable and I am able to connect to it using the hostname (testdevice.local) with other ‘wired’ devices.

However when I try to connect to it from wireless devices over WIFI the hostname does not get resolved. Accessing the device via ip-address does work.

I think it’s a pretty normal usecase where my device is connected via ethernet-cable and other wireless devices are trying to connect to it using the hostname, isn’t it?

---

<div class="post-metadata">

**Author:** ![gerb0n](https://avatars.discourse-cdn.com/v4/letter/g/85e7bf/32.png) [@gerb0n](https://forums.balena.io/u/gerb0n)\
**Post date:** [June 15, 2020, 2:50pm UTC](https://forums.balena.io/t/connecting-to-device-using-hostname-via-wifi/133323/2 "2020-06-15T14:50:33Z")

</div>

Also I kinda just figured out the avahi discovery service is just for developer purposes.  
Is it possible to enable it on production-images aswell? I’d like my device to be easily found with a hostname in production environements.

---

<div class="post-metadata">

**Author:** ![alexgg](https://avatars.discourse-cdn.com/v4/letter/a/7ab992/32.png) [@alexgg](https://forums.balena.io/u/alexgg)\
**Post date:** [June 15, 2020, 5:09pm UTC](https://forums.balena.io/t/connecting-to-device-using-hostname-via-wifi/133323/3 "2020-06-15T17:09:36Z")

</div>

Hi, could you please log into the hostOS in your device using the dashboard and paste the result of the following command:

```auto
route

```

This will print the kernel routing table and will allow us to understand the specific network configuration on your device. It is possible that you have configured two network interfaces in the same subnet so DNS messages are being forwarded through the first routing table match.

Regarding your second question, avahi is running also on production devices. You can check this by running `avahi-browse --all` from a Linux PC and seeing that the SSH service is being broadcasted.  
However, note that `balena scan` won’t show local devices on a production build as this is used for local development mode.

---

<div class="post-metadata">

**Author:** ![gerb0n](https://avatars.discourse-cdn.com/v4/letter/g/85e7bf/32.png) [@gerb0n](https://forums.balena.io/u/gerb0n)\
**Post date:** [June 15, 2020, 5:57pm UTC](https://forums.balena.io/t/connecting-to-device-using-hostname-via-wifi/133323/6 "2020-06-15T17:57:52Z")

</div>

I am using Open Balena btw so no dashboard for me.

The output from `route`:

 ![](https://global.discourse-cdn.com/balena/original/2X/2/2b9ba14a8fbf574999b354063dc5b9495956b624.png)

I have checked and wireless or wired both assign the same subnetmask-range to my laptop.

---

<div class="post-metadata">

**Author:** ![rahul-thakoor](https://avatars.discourse-cdn.com/v4/letter/r/9de053/32.png) [@rahul-thakoor](https://forums.balena.io/u/rahul-thakoor)\
**Post date:** [June 16, 2020, 12:45pm UTC](https://forums.balena.io/t/connecting-to-device-using-hostname-via-wifi/133323/8 "2020-06-16T12:45:05Z")

</div>

hey there!  
It looks like an issue with mDNS and resolving the hostname from your host device Can you please confirm the following:

1. What operating system your host computer is using?
2. If you have 2.4 and 5GHz networks, make sure that the host computer and the device are on the same one?

Thanks

---

<div class="post-metadata">

**Author:** ![gerb0n](https://avatars.discourse-cdn.com/v4/letter/g/85e7bf/32.png) [@gerb0n](https://forums.balena.io/u/gerb0n)\
**Post date:** [June 16, 2020, 1:10pm UTC](https://forums.balena.io/t/connecting-to-device-using-hostname-via-wifi/133323/10 "2020-06-16T13:10:45Z")

</div>

I am not sure what you mean with ‘host computer’.

My device is connected to my network via ethernet, so no 2.4 or 5GHz involved.  
I have a container running a simple website running on port 80.

Surfing to the hostname on wired devices results in showing the website.  
Wireless devices (e.g. phones, laptops, tablets) won’t show the website. However they DO show the website when I use the ip-address of the balena-device in the browser.

---

<div class="post-metadata">

**Author:** ![lucianbuzzo](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/lucianbuzzo/32/615_2.png) [@lucianbuzzo](https://forums.balena.io/u/lucianbuzzo)\
**Post date:** [June 16, 2020, 2:55pm UTC](https://forums.balena.io/t/connecting-to-device-using-hostname-via-wifi/133323/11 "2020-06-16T14:55:21Z")

</div>

Hi, in this instance “host computer” refers to the computer you are trying to access the device from. It sounds like your router is possibly using a different DHCP configuration for the wired and wireless networks. Can you use a tool like `dig` to check that the DNS servers used for wired and wireless connections are the same?  
It should be as simple as running `dig testdevice.local` from your laptop using a wired and wireless connections and comparing the results.

---

<div class="post-metadata">

**Author:** ![gerb0n](https://avatars.discourse-cdn.com/v4/letter/g/85e7bf/32.png) [@gerb0n](https://forums.balena.io/u/gerb0n)\
**Post date:** [June 16, 2020, 3:12pm UTC](https://forums.balena.io/t/connecting-to-device-using-hostname-via-wifi/133323/13 "2020-06-16T15:12:45Z")

</div>

I don’t really see a useful difference:

 ![image](https://global.discourse-cdn.com/balena/original/2X/a/a6c700b9dd5887d66a9c860f1355ab744dd7a59c.png)

Red being the wired connection and green the wireless.

I am on a windows 10 machine btw and executing commands using WSL (unbuntu).

---

<div class="post-metadata">

**Author:** ![lucianbuzzo](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/lucianbuzzo/32/615_2.png) [@lucianbuzzo](https://forums.balena.io/u/lucianbuzzo)\
**Post date:** [June 16, 2020, 3:53pm UTC](https://forums.balena.io/t/connecting-to-device-using-hostname-via-wifi/133323/14 "2020-06-16T15:53:46Z")

</div>

Which Windows OS build do you have? Do you have an mDNS responder installed on your maching (like Apple’s Bonjour)?

---

<div class="post-metadata">

**Author:** ![gerb0n](https://avatars.discourse-cdn.com/v4/letter/g/85e7bf/32.png) [@gerb0n](https://forums.balena.io/u/gerb0n)\
**Post date:** [June 16, 2020, 3:55pm UTC](https://forums.balena.io/t/connecting-to-device-using-hostname-via-wifi/133323/15 "2020-06-16T15:55:02Z")

</div>

I do have bonjour installed yes.

---

<div class="post-metadata">

**Author:** ![lucianbuzzo](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/lucianbuzzo/32/615_2.png) [@lucianbuzzo](https://forums.balena.io/u/lucianbuzzo)\
**Post date:** [June 16, 2020, 3:55pm UTC](https://forums.balena.io/t/connecting-to-device-using-hostname-via-wifi/133323/16 "2020-06-16T15:55:08Z")

</div>

One more question, what other devices have you tested the wired connection on?

---

<div class="post-metadata">

**Author:** ![gerb0n](https://avatars.discourse-cdn.com/v4/letter/g/85e7bf/32.png) [@gerb0n](https://forums.balena.io/u/gerb0n)\
**Post date:** [June 16, 2020, 3:55pm UTC](https://forums.balena.io/t/connecting-to-device-using-hostname-via-wifi/133323/17 "2020-06-16T15:55:56Z")

</div>

Two android phones. A Oneplus 6 and a Samsung Galaxy S9.

---

<div class="post-metadata">

**Author:** ![gerb0n](https://avatars.discourse-cdn.com/v4/letter/g/85e7bf/32.png) [@gerb0n](https://forums.balena.io/u/gerb0n)\
**Post date:** [June 16, 2020, 4:17pm UTC](https://forums.balena.io/t/connecting-to-device-using-hostname-via-wifi/133323/18 "2020-06-16T16:17:42Z")

</div>

Forgive my stupidity but I don’t see how my laptop / host OS is relevant. Maybe it’s because I explained my issue the wrong way?

What I am trying to achieve is to place a device into **any given network**. I want that device to be ‘found’ inside that given network using a hostname, in my case ‘shipr.local’. Users will be able to download an app on their phone (IOS or Android) and that app will connect to the device. I don’t want to worry about ip-addresses inside my android/ios-code. Each user will have different ip-addresses and subnet-ranges; I just want to use the ‘shipr.local’ hostname to communicate to my api (which the device will expose).

The reason I think my host OS is irrelevant is because the hostname-resolving (which is probably done by mDns? I don’t know I am a noob in that case) should work on any device; windows, linux, android or IOS. Although in reality I would only care about android or IOS. Also having bonjour installed or anything shouldnt be a prerequisite for this to work.

Right now I am testing this process using a windows laptop (it’s just my development laptop). I can reach my device via my browser via ‘[http://shipr.local](http://shipr.local)’. But only in a wired situation, as soon as I use my WIFI the browser responds with a 404. It does however show my website when I browse to my ip-address.

---

<div class="post-metadata">

**Author:** ![Ereski](https://avatars.discourse-cdn.com/v4/letter/e/958977/32.png) [@Ereski](https://forums.balena.io/u/Ereski)\
**Post date:** [June 16, 2020, 5:59pm UTC](https://forums.balena.io/t/connecting-to-device-using-hostname-via-wifi/133323/19 "2020-06-16T17:59:15Z")

</div>

`.local` domains work differently than normal ones, and it relies on a different protocol called mDNS. There are some differences with plain DNS. For example, you don’t need to pay for `.local` domains and there is no central registry for those domains. Unfortunately, support for mDNS domains is not included by default in most non-Linux installations. Because of that, an mDNS resolver like bonjour is required to get `.local` domains working. More info here: [https://en.wikipedia.org/wiki/Multicast\_DNS](https://en.wikipedia.org/wiki/Multicast_DNS)

mDNS relies on multicast packets. What might be happening is that the router is not transmitting multicast messages between wired/wireless interfaces, or maybe it’s blocking wireless multicast. Could you fill which of the following combinations work/doesn’t work (host being the device you access):

wired device \<-\> wired host  
wireless device \<-\> wired host  
wired device \<-\> wireless host  
wireless device \<-\> wireless host

---

<div class="post-metadata">

**Author:** ![gerb0n](https://avatars.discourse-cdn.com/v4/letter/g/85e7bf/32.png) [@gerb0n](https://forums.balena.io/u/gerb0n)\
**Post date:** [June 16, 2020, 7:01pm UTC](https://forums.balena.io/t/connecting-to-device-using-hostname-via-wifi/133323/21 "2020-06-16T19:01:39Z")

</div>

Ok, will do that. Before I can provide that list something else is blocking me. But I will create another topic for that.
