Connect through ssh to a rpi running ubuntu 16.04 with tethered wifi

Hi all,
I’ve installed recently ubuntu 16.04 on a raspberry pi 3 model B.
It works really fine, no problem about it, thanks very much to the Ubuntu developers !
A 4G wifi hotspot on an android smartphone provides internet connection to the raspberry pi.
I’ve installed ssh on the raspberry pi and it works when I connect to it from a pc connected on the same wifi hotspot using the local network address of the raspberry pi.
In the future, I’d like to connect the raspberry pi, still connected to the internet thanks to a 4G wifi hotspot provided by an android smartphone, from a pc outside the wifi hotspot network.
Does someone knows if it can be done, and how ?
Thanks in advance,
Cedric

Hello
I think there’s two problems with that:

  • As far as I know (might be wrong about that, someone correct my statement if required), it’s not possible to use a Wi-Fi interface simultaneously to connect to a Wi-Fi network and to broadcast a Wi-Fi network, so my guess is you’d have to have additional hardware for a second network interface

  • The ‘connection sharing’ feature of Ubuntu networking preferences uses a hard-coded, non-configurable network: 10.42.0.0/24, this can be a problem if your phone hotspot uses a conflicting network (*), in which case you’d probably have to hack around this using a number of terminal commands.

(*) I realized this issue when it caused a problem for me: I had a Ubuntu Phone with 3G connection broadcasting a Wi-Fi network and my Ubuntu Laptop connecting to that network. From the Ubuntu Laptop I wanted to create a shared cable connection to another machine, but since the networks managed by the phone and by the laptop were the same 10.42.0.0/24 there was a packet routing conflict.