移动 WiFi 热点不允许通过 Putty 访问 Ubuntu Server VM

移动 WiFi 热点不允许通过 Putty 访问 Ubuntu Server VM

我有一台 Ubuntu 20.04 服务器虚拟机,它设置了静态 IP 地址,我可以使用我的普通 WiFi 通过 Putty 访问虚拟机。

但是,如果我将主机(Windows)连接到手机热点并尝试连接,它会继续失败并显示:-

Network Error: Connection timed out

我尝试了不同的手机和不同的网络提供商,但仍然出现相同的错误。

请评论有关所需 VM 的任何其他信息。

请告诉我如何解决。

答案1

小心防火墙

第一次尝试:

sudo ufw disable

如果这解决了问题,您可以执行以下操作:

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

我的系统适用于:

$ 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)

只有[ 1][ 2]是绝对必要的。

#----------------------------------------------------- 在我的系统上:

开启 WiFi 后:

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

这意味着 WiFi 热点:

  • 输入来自wlo1
  • 输出是enp42s0

相关内容