3

I have multiple devices (A, B, C). Device A is a sensor that captures data and shares it with device C (Android) over a local Wi-Fi network. The problem is that the application to receive data only works on Android, and Android does not support being connected to two networks simultaneously, so when C connects to the Wi-Fi that A emits, it can correctly receive the data captured by A, but loses internet connection. I would like to know if a third device B (Ubuntu 23.10) with internet thanks to a 4G modem, can connect to the Wi-Fi network that A broadcasts and share internet through that Wi-Fi network so that C has internet when it connects to A's Wi-Fi.

enter image description here

A is not configurable, it is a purchased device and I cannot modify anything. A emits a Wi-Fi signal and to receive data it is necessary to connect an Android device (C) to A's Wi-Fi network in order to receive data from its application. If A could connect to a hotspot issued by C there would be no problem since A and C would be connected and C would maintain an internet connection. However, A's app does not support that functionality and the only way to receive the data captured by A is to connect C to the Wi-Fi created by A. I would like to know if I can add another device (B), with an OS that does support simultaneous connection of network interfaces (for example Ubuntu) and share the internet through the Wi-Fi created by A.

I have searched many similar questions about it, but none that solve my problem. In most of the questions asked, the internet is shared through a network cable or by creating a hotspot, however, I need to share the internet through the Wi-Fi network that A creates and not create a new one. On the other hand, I have found a lot of information about bridges and bonding, but I have not achieved favorable results either.

1

3 Answers 3

2

Determine Your Approach

While Ljm's answer is certainly doable with a little explainnation, this one will be the easiest to implement, and cost you time and whatever a decently supported USB Wifi Adapter costs. Tip: Stay away from adapters that contain Broadcom Chipsets. Although the Wireless SoC in a Pi is Broadcom based the driver for the USB versions has been discontinued.

What to Connect

The object of our exercise is to put all three of the above devices in the same subnet, as Ljm has also alluded to. In simple terms a subnet is a bit mask. This bit mask determines how much of an IP address belongs to the host and how much belongs to the client machine. The most common subnet is 255.255.255.0, meaning that 75% of the octets belong to the host, and 25% belong to the client. In a LAN's case, the host is the DHCP server and the client could be any of those above devices.

To put these devices into the same subnet, the DHCP server must be able to negotiate with all 3 devices at the same time. From our comments, and your picture, the OP and I determined that A - Fishing Sounder, and C - Android Phone can both negotiate with B - Raspberry Pi only if connected independently. (They will not connect simultaneously).

Now What?

Due to a limitation in B - Raspberry Pi's SoC:

  1. The Wireless Card can either transmit/connect to other networks, or
  2. The Wireless card can receive/be connected to.

Because we can't fiddle with the internals of A - Fishing Echo Sounder, were only left with C - Android Phone. Because phones (regardless of brand) use separate hardware they are able to be connected to and connect to other devices simultaneously, so we inverted our Internet Connected Device. As such the OP's picture will now look like this:


                                                          Internet
 ==>   Android Phone                                          ^
 |          ^                                              =======
 |          |              Pi Wireless Adapter                ^    
 |   Fishing Echo Sounder <===========================> Raspberry Pi
 |                                                          |   
 |                                                Second USB Adapter   
 |                                                          ^
 |                                                          | 
 |===========================================================                                                              

As the OP has also noted, the Pi's limitation can be overcome by purchasing a USB Wireless Adapter, but for that I recommend doing homework before purchase as my tip alluded to. After purchase the OP must make sure that the Pi's Wireless Adapter and the purchased USB adapter both have IP addresses that are manually assigned addresses that belong to A - Fishing Echo Sounder's Address Pool.

5
  • Thanks for the response, forgive my hard-headedness, but I don't quite understand what you've said. Could you clarify it for me please? Mar 22 at 18:33
  • 1
    I don't have that fancy picture maker you used, but my diagram above inverts your picture by pointing both A and B to C, and assuming C has a data plan, all devices can get to the internet. If we assume that you'd like to keep your picture as is, you can buy a second wireless adapter for the pi and manually set the address of that adapter to an address that both the pi and the phone can "see".
    – eyoung100
    Mar 22 at 19:31
  • 1
    What are the first 3 numbers for the IP Addresses of the devices? If A and B can talk to each other then the first 3 are equal. If A and C can talk to each other then those first three are also equal, therefore the adapter you add to the pi must also have an address with the same first 3 numbers.
    – eyoung100
    Mar 22 at 19:46
  • The problem is that although C has a data plan, when he connects to a Wi-Fi network without internet C is left without internet. This seems to be an Android limitation... Mar 22 at 19:56
  • 1
    @WorkPhoneID002 Then buying a second adapter for the Pi would be the easiest. When I found the reference link though the App you use does have a web interface. I don't know if that only apples locally, i.e., when off the internet. As for the Android limitation, remember that you can also connect the Pi to the internet. I'll redo my diagram. Notice that the arrows across the top only carry traffic between the Fishing Sensor and the Pi, While the bottom arrows Flow from the Pi to the Phone. This is what we were attempting before we discovered the limitation of the embedded Pi Wireless
    – eyoung100
    Mar 22 at 21:24
1

A is not configurable, it is a purchased device and I cannot modify anything.

Then this 100% depends on how A is set up. But everything points to this being impossible, because you would have to tell A, which controls the network you want to join, to tell other devices to use B to access the internet.

Also, if A is some weak embedded device, it's definitely not the thing you would want to use to route traffic through, due to network bandwidth and CPU limitatons – and it would have to do that, in an encrypted setting. So, this is doubly undesirable.

Sorry, the device you own and its software are just not user friendly, and don't allow you to do reasonable things.

Note that the largest currently existing botnets are cheap IoT devices that should not have been connected to the internet, given their firmware quality. So, maybe it's also not a great idea to connect your A to a network with internet access, either.

1

Based on the information that you give, I do not have a ready to go solution. It depends also a bit on the configuration of A. So I'll just throw in my way of thinking, hoping that it helps.

A apparently provides an SSID that you can connect to with your phone. A will also do some form of DHCP, providing you with an IP address. When connected to A, your android device will show something like IP address 192.168.x.y with a netmask of 255.255.255.z (z is almost always 0 with these type of devices).

You should be able to connect your Raspberry Pi (?) from the drawing to that subnet. You then need to configure your Pi as some form of a router.

  • You will need to NAT towards the subnet of A
  • You can use OpenVPN to provide access to this specific subnet. The use of OpenVPN will allow you to access the device, as long as your Openvpn server is accessible.
  • be sure that you have no double IP subnets.
1
  • Thanks for trying to offer a solution! Unfortunately I'm far from understanding how to do what you suggest... Mar 22 at 17:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .