Hostname resolve issue with Android USB tethering

Hi Everyone,

I’m working on a project using Jetson Nano Developer Kit, and I would like to add a display and some control interface to it. Inspecting my collection of left behind electronic components, one shines particularly, i.e. an old android phone (you know… the high depth color display, the touch screen, 4G, wifi, bluetooth,…).

My plan is to connect my android phone to the USB Type C port on Jetson Nano, enabling Android USB tethering, and communicate via TCP/IP. (yayaya, I’m avoiding Android OTG on purpose, coz this can reserve me the serial port for the development).

And… I have them connected, enable USB tethering on the Android side, and the Network Manager on Jetson Nano side immediately recognize the rndis connection. Almost everything works like a charm. I can browse webpage on Jetson Nano, and I can even connect the SFTP server on Jetson Nano from Android via Jetson Nano IP address.

Only “almost” is because I can only visit Jetson Nano with its IP address, but not its hostname. The IP address was grep from Jetson nano using ifconfig. This is kind of defeating the purpose of having the onboard display and control interface.

Here is the question. Why couldn’t I visit Jetson Nano with its hostname while IP address works fine?

I just want to exhaust all possibilities for using the hostname before I do something less ideal like using static IP or scanning 192.168.42.1 to 192.168.42.255 indefinitely on Android.

I’m willing to read and determined to try. Any information will be appreciated.

Gary

PS: My Jetson Nano Developer Kit is installed with a clean freah SD card image
jetson-nano-jp461-sd-card-image. The Android phone is Samsung Galaxy S9+.

Unless you have a router which assigns a hostname, and provides this via its own DNS server, your Android won’t know about it. Most DNS servers which show up by default when running any computer require a publicly hosted hostname. You can, however, provide an alias which works like a hostname if you know the IP address (meaning that if the IP address does not change, then it is simple).

I’m not all that familiar with Android, but I think it too has a “hosts” file somewhere. In Linux it would be “/etc/hosts”, and in Windows it is “C:\\Windows\System32\drivers\etc\hosts”. Likely Android has the Linux convention of where this file is.

The hosts file allows the left column to name an IP address, and the right column a set of space-delimited aliases. There will always be some sort of alias for 127.0.0.1 for localhost (which is IPv4), along with an IPv6 equivalent if the device handles IPv6. Let’s say you want to refer to your Jetson as “jetson”, and the IP address is 192.168.55.1; then you could add this to the file (number of spaces between entries is unimportant since 5 spaces count the same as 1 space or 100 spaces):
192.168.55.1 jetson
(real address on left, alias on right, you can now “ping jetson”)

You could give the Jetson two aliases (or more):
192.168.55.1 jetson nano
(you could now ping either jetson or nano)

Since your address is 192.168.44.1, you’d use that instead of 192.158.55.1. The only problem is if the IP address changes. Getting the address assigned by DHCP means the router is in control of this. If you have admin access to the router, then you could bind that exact IP address to the MAC address of the devices involved to force a constant address. Setting up your own DNS is a far more difficult task, but this would work even if IP addresses change.

ok… scaning192.168.42.x indefinitely on android it is. Looking at the bright side, I don’t necessarily know the device name anyway. In this case, scaning IP works better.

Thanks

Oh, by the way, this is a breif video of how I would like to interface Jetson Nano with the old android phone.

It’s just so sad that the guy who wrote the android USB tethering didn’t bother to embrace also the local DNS. The following are the closest relevant descriptions that I googled yesterday. Just in case someone might be interested, here they are:

https://ncrmnt.org/2012/06/27/making-android-hotspot-mode-usable/

https://ncrmnt.org/2013/04/10/android-and-dnsmasq-making-a-better-dnsmasq-wrapper/

It has been at least a decade since I have had a cell phone, but when I had it I used Android. Jetsons did not yet exist (I had a Tegra 3 dev board at the time). What I do remember is that I had an ssh program and could ssh`` to my other Linux systems, but I never tethered. What I am wondering is if the Jetson itself is being accessed over USB or over Wi-Fi? If USB, then you could just use 192.168.55.1. I suspect Wi-Fi since you are using 192.168.42.x`.

Either way Android does have a “hosts” file somewhere you could add an alias to. That was something else I had done with my old Android: To edit the hosts file with a browser/editor program. So it can be done. I don’t know if you have any ability to assign a static address to the Jetson over Wi-Fi by binding to MAC address, but it seems possible.

Just a little update…

I figure out a better solution.

Grab a USB wifi dongle, plug it to Jetson Nano, and setup Jetson Nano as AP (
Creating Wifi AP Hotspot on Jetson Nano - #10 by WayneWWW ).

Then, after the cell phone joins the AP, it can access Jetson Nano via IP address 10.42.0.1 .

Thanks a lot. I can now interface Jetson Nano with cell phones reliable. ^^

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