[SOLVED] Sharing Hostnames from WiFi to WiFi Hotspot in Ubuntu

Cj-tech

Admirable
Jan 27, 2021
536
68
8,940
I have an old laptop running the latest version of Ubuntu that I use for projects. That laptop is connected to my WiFi router through a USB WiFi antenna. I have the default wireless card setup to share the USB WiFi connection through the hotspot feature in Settings.

Everything works fine with the hotspot part (i.e. I can connect to it and have internet access). The problem is I have a Raspberry Pi file server setup on my router’s network that I cannot connect to using the hostname on devices that are connected to my hotspot. When on the router WiFi, I can type in for example smb://raspberrypi.local/share into mostly any file manager. On my hotspot, it doesn’t connect unless I use the IP address of the Pi.

I looked into the /etc/hosts file on Ubuntu but that only sets an IP address to a hostname. I could technically do that, but the Raspberry Pi doesn’t have a static IP address. I’ve searched Google for a little while, but nothing specific to my scenario comes up. Any ideas on how I could do something like “hostname forwarding”?
 
Solution
OK I thought SMB was a microsoft thing but it doesn't matter.

The problem is you are using a string of characters

raspberrypi.local

Something needs to translate that and I suspect you do not have a actual dns server.

Without a DNS server how can it possibly find the IP address something must tell it. What happens it is will work on the same subnet sometime because it will use a broadcast protocol to find it. You are on 2 different subnets 192.168.2.1 and 10.1.1.0. This is why DNS servers exist to solve this issue.

You might also have issues with the nat. Stuff on the 10.1.1.x network can open new sessions on the 192.168.1.x network but the reverse will not work. This is the same issue people use port forwarding to...
It all depends on how your hotspot software works. I am assuming you are doing something like trying to use a machine connected via ethernet and having it share the wifi connection ?

I do not know the details of how microsoft is doing file sharing. I know it is not actually using DNS because you do not have a DNS server. It is using some form of broadcast protocol to find device. The problem is broadcast protocols are only within the lan/subnet. It depends on how you hotspot sharing is working. It is likely blocking these broadcast requests.
 
It all depends on how your hotspot software works. I am assuming you are doing something like trying to use a machine connected via ethernet and having it share the wifi connection ?

I do not know the details of how microsoft is doing file sharing. I know it is not actually using DNS because you do not have a DNS server. It is using some form of broadcast protocol to find device. The problem is broadcast protocols are only within the lan/subnet. It depends on how you hotspot sharing is working. It is likely blocking these broadcast requests.
The WiFi hotspot interface (the main WiFi card) has internet access through a USB WiFi adapter. Ubuntu 20 has a WiFi hotspot option in Settings. This isn’t related to Microsoft or Windows operating systems. I’m trying to get my raspberrypi.local host that is on my WiFi router to be seen or forwarded to my hotspot. Basically I want to share connections from the router (IP 192.168.2.1) to the hotspot (IP 10.1.1.0). I think it may be related to DNS.
 
OK I thought SMB was a microsoft thing but it doesn't matter.

The problem is you are using a string of characters

raspberrypi.local

Something needs to translate that and I suspect you do not have a actual dns server.

Without a DNS server how can it possibly find the IP address something must tell it. What happens it is will work on the same subnet sometime because it will use a broadcast protocol to find it. You are on 2 different subnets 192.168.2.1 and 10.1.1.0. This is why DNS servers exist to solve this issue.

You might also have issues with the nat. Stuff on the 10.1.1.x network can open new sessions on the 192.168.1.x network but the reverse will not work. This is the same issue people use port forwarding to solve on a internet router but most hot spot software does not have that ability.
 
Solution