出现错误提示**unit firewalld.service could not be found
** 的原因是 Ubuntu 22.04 默认没有安装 firewalld
。Ubuntu 系统默认使用的是**ufw
**(Uncomplicated Firewall,简单防火墙)作为防火墙管理工具。
使用ufw
bash
sudo ufw enable # Enable the firewall
sudo ufw status # Check firewall status
sudo ufw allow <port> # Allow a specific port (e.g., `sudo ufw allow 22` for SSH)