允许 ufw 规则针对特定端口卷曲本地主机

允许 ufw 规则针对特定端口卷曲本地主机

我只想curl -if localhost:54321允许ufw.我可以从命令行应用什么规则?

我已尝试ufw allow proto tcp from any to any port 54321ufw status显示以下内容:

To                         Action      From
--                         ------      ----
54321/tcp                  ALLOW       Anywhere
54321/tcp (v6)             ALLOW       Anywhere (v6)

但我还是做不到curl -if localhost:54321

答案1

知道了:

ufw allow proto tcp from any to any port 54321,54322
ufw allow out proto tcp from any to any port 54321,54322

答案2

man ufw

Allow access to udp 1.2.3.4 port 5469 from 1.2.3.5 port 5469:

    ufw allow proto udp from 1.2.3.5 port 5469 to 1.2.3.4 port 5469

因此您正在寻找的命令是

     ufw allow proto tcp from <ip_source> to <ip_destination> port 54321

相关内容