0

I have a Ubuntu 20.04 Server Virtual Machine, it has a static IP address set and I am able to access the VM via Putty using my normal WiFi.

However, if I connect my host machine(Windows) to my mobile's hotspot and try to connect, it keeps failing and displays:-

Network Error: Connection timed out

I have tried different cell phones and different network providers, it still gives the same error.

Please comment any additional information regarding the VM that is needed.

Please let me know how to resolve it.

6
  • Is the Ubuntu VM on your own machine? Or is it hosted elsewhere, perhaps in the cloud? If it is hosted on your own machine, then it sounds like, when you connect via mobile hotspot, the routing table is getting adjusted and resulting in a route that cannot reach back to your machine (perhaps you're behind CG-NAT via the mobile hot spot and your VM's static IP is in the same subnet?). If, however, the VM is hosted elsewhere, then my first guess would be a firewall issue. Your normal WiFi IP is allowed through, but not the IP you have when connected via mobile hotspot. Apr 10, 2022 at 18:11
  • Hi,the VM is on my own machine. How do I check if I'm behind a CG-NAT ?
    – StudentV
    Apr 10, 2022 at 18:30
  • It can be tricky to tell, depending on the mobile device. The IP address shown in the devices settings may be the internal WAN IP (which will be in a private IP address range for CG-NAT) or they might "helpfully" show the external IP. For starters, can you provide (1) the static IP address of the Ubuntu guest machine, (2) the results of route print command on the host Windows machine when connected via normal Wifi, and (3) the results of route print command on the host Windows machine when connected via the mobile hotspot. Apr 10, 2022 at 18:45
  • The server IP is 192.168.0.150
    – StudentV
    Apr 11, 2022 at 11:22
  • The route print output is too big, how do I share it in the comments ?
    – StudentV
    Apr 11, 2022 at 11:24

1 Answer 1

0

BE CAREFUL WITH THE FIREWALL

First try:

sudo ufw disable

If that solves the problem, you can do:

sudo ufw enable
sudo ufw       allow in  on wlo1
sudo ufw route allow out on enp41s0

My system works with:

$ sudo ufw status numbered
[ 1] Anywhere on wlo1           ALLOW IN    Anywhere
[ 2] Anywhere on enp41s0        ALLOW FWD   Anywhere       (out)
[ 3] Anywhere (v6) on wlo1      ALLOW IN    Anywhere (v6)
[ 4] Anywhere (v6) on enp41s0   ALLOW FWD   Anywhere (v6)  (out)

Only [ 1] and [ 2] are strictly necessary.

#----------------------------------------------------- On my system:

With WiFi on:

ifconfig

> enp41s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
>         inet 192.168.2.115  netmask 255.255.255.0  broadcast 192.168.2.255
>         inet6 fe80::19b0:6542:ee4:5982  prefixlen 64  scopeid 0x20<link>
>         ether 00:d8:61:9e:2b:52  txqueuelen 1000  (Ethernet)
>         RX packets 46282  bytes 39478576 (39.4 MB)
>         RX errors 0  dropped 4  overruns 0  frame 0
>         TX packets 38257  bytes 7380268 (7.3 MB)
>         TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
> 
> enp42s0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
>         ether 00:d8:61:9e:2b:53  txqueuelen 1000  (Ethernet)
>         RX packets 0  bytes 0 (0.0 B)
>         RX errors 0  dropped 0  overruns 0  frame 0
>         TX packets 0  bytes 0 (0.0 B)
>         TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
> 
> lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
>         inet 127.0.0.1  netmask 255.0.0.0
>         inet6 ::1  prefixlen 128  scopeid 0x10<host>
>         loop  txqueuelen 1000  (Local Loopback)
>         RX packets 1981  bytes 318831 (318.8 KB)
>         RX errors 0  dropped 0  overruns 0  frame 0
>         TX packets 1981  bytes 318831 (318.8 KB)
>         TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
> 
> wlo1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
>         inet 192.168.2.115  netmask 255.255.255.0  broadcast 192.168.2.255
>         inet6 fe80::1c39:c0d6:43bd:fcf0  prefixlen 64  scopeid 0x20<link>
>         ether 38:00:25:95:18:02  txqueuelen 1000  (Ethernet)
>         RX packets 50  bytes 17772 (17.7 KB)
>         RX errors 0  dropped 0  overruns 0  frame 0
>         TX packets 48  bytes 7067 (7.0 KB)
>         TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

This means that the WiFi hotspot:

  • Input is from wlo1
  • Output is to enp42s0

You must log in to answer this question.

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