这是一个非常基本的问题,我很惊讶我找不到答案,但我们找到了。
遵循以下规则:
22 ALLOW 192.168.1.0/24
是否允许所有协议或假定使用 TCP?
答案1
这直接回答了手册页:
Users can specify rules using either a simple syntax or a full syntax. The simple syntax
only specifies the port and optionally the protocol to be allowed or denied on the host.
[...]
Example rules using the simple syntax:
ufw allow 53
This rule will allow tcp and udp port 53 to any address on this host. To specify a
protocol, append '/protocol' to the port. For example:
ufw allow 25/tcp
This will allow tcp port 25 to any address on this host.