9

Is it possible for me to run a Zeroconf mDNS server on my Android phone? Something like Avahi on Linux.

The reason I ask is because I run an SSH/SFTP server on my phone for transferring files to/from the phone. Right now I have to connect using the local IP address (10.1.0.x) and the IP changes via DHCP. I'd like to simply be able to connect to my phone using a .local address.

I don't think Dynamic DNS will work, because I want my LAN address (the private IP, 10.1.0.x) not my public NAT IP.

1

Do you have any control over the (presumably wireless) LAN that you're connecting your phone to? It seems to me that the main part of your problem is just that your phone picks up different IP addresses each time it connects to your LAN. If it always had the same IP, then you could either make a note of this, save it in your SSH client, or assign a name to that IP on your other machine(s) using a HOSTS file or similar.

Are you in control of your network, or do you know the person that is? You (or they) should be able to assign a static IP address, or a reserved IP address, to your device so that every time you connect your phone to the LAN it always picks up the same IP address.

If it's a small, personal network then this would just be a setting on your device's record on your router, if this is a larger network then it would be setup on the DHCP server and a matching A name record could also be setup on their internal DNS to give you a permanent name.

  • Thanks, this was what I ended up doing -- I assigned a static DHCP mapping for the phone on my router, and then added that IP to my local DNS server. Solved the problem for me but it wouldn't necessarily solve it for others. – Josh Dec 3 '12 at 15:06
  • Just as a comment: I change networks often but I still want to arrange for my devices to know each others' addresses, so this isn't a general solution. It would be better if Android supported Zeroconf. – rptb1 Nov 7 '15 at 10:41
  • This solution works fine at home... but the thing about android devices is they tend to be portable... and these days, so do computers! :) Connecting from my laptop to my phone is something I'd like to be able to easily do anywhere, whenever they are on the same network, whether I have control over it or not. mDNS provided a solution to this problem years ago... is it still impossible to take advantage of on Android? – Josh Dec 24 '16 at 9:10
  • @Josh the original question was focussed on a device that would need to be discoverable on a particular network, if you need a solution that will work as you roam between different networks (and different types of networks) then that is a different question. Please ask yours as a new question, and feel free to link back to this question stating the differences in your needs. – GAThrawn Jan 4 '17 at 11:27
3
+50

Currently there is no Avahi daemon on Android and open ticket #354 at Avahi tracker, where there are attached patches, needs to be addressed to make a build for Android possible.

You can try to build it manually, if really needed.

  • 1
    Is there still no avahi daemon on Android? :) – Mazze Apr 7 '14 at 8:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.