Disable the firewall on the VM. The firewall prevents the remote login in SSH mode.
systemctl disable firewalld.service
systemctl stop firewalld.service
Run the systemctl status firewalld.service command to check the firewall status.
service iptables stop
Run the service iptables status command to check the firewall status.
[root@localhost ~]# service iptables status iptables: Firewall is not running.
systemctl disable SuSEfirewall2.service
systemctl stop SuSEfirewall2.service
Run the service SuSEfirewall2 status command to check the firewall status.
Then, run the following command:
If ufw is unavailable, download it from the official website (for example, https://packages.ubuntu.com/) and install it.
The .deb installation package is as follows (the version number is for reference only):
ufw_0.35-0ubuntu2_all.deb
Alternatively, after configuring apt sources in SUSE/Red Hat/CentOS/Oracle Linux/Ubuntu/Debian, run the apt-get install ufw command to install it and then run the ufw disable command to disable the firewall.