If I connect my laptop to a Wi-Fi hotspot provided by the phone? Is there a way to let me SSH into the laptop via an IP address?
Or vice versa, allow the laptop to SSH into the phone (I can already SSH into my phone on my local network by using an app that provides an SSH server on my phone) from the laptop while it’s connected to the hotspot.
I’ve tried this on an old version of Android 10 and was unable to do so, I tested it by connecting two laptops to the hotspot and then trued to nmap each other IP addresses, they were unreachable.
I think the term you’re looking for is isolated vlan in which each device on a network cannot see its peers, which is a common setting in (properly configured) public WiFi hotspots.
edit: oh, you want to access from the phone itself, I did not test that, but it should be easy to test with termux