如何使用 UFW 允许本地接口上的所有流量?

lau*_*ent 2 networking reverse-proxy ufw

我已经将 Apache 作为另一个 Docker 服务的反向代理运行。我得到了它的工作,但一旦我启用 UFW,所有连接都会被阻止,并显示以下错误消息:

12月29日23:50:23 vps520941内核:[2870586.522706] [UFW BLOCK] IN= OUT=br-xxxxxxxxx SRC=172.24.0.1 DST=172.24.0.3 LEN=60 TOS=0x00 PREC=0x00 TTL=64 ID=38755 DF协议=TCP SPT=54620 DPT=22300 窗口=292

这是以下结果ifconfig

br-xxxxxxxxx Link encap:Ethernet  HWaddr xx:xx:xx:xx:xx
          inet addr:172.24.0.1  Bcast:172.24.255.255  Mask:255.255.0.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:22 errors:0 dropped:0 overruns:0 frame:0
          TX packets:34 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:1630 (1.6 KB)  TX bytes:2896 (2.8 KB)
Run Code Online (Sandbox Code Playgroud)

以前,我曾尝试允许网络接口 IP 上的流量,但每次重新启动时它都会发生变化,因此这不起作用。

我在 ufw 中有这样的东西:ufw allow in from 172.22.0.0/24 to any port但是当然这不再起作用了,因为接口 IP 现在是 172.24.0.1。

所以我想知道,是否可以告诉UFW允许所有连接,不是基于IP,而是基于网络接口名称?

Mic*_*ton 5

它就在手册页中,有很多示例:on <interface>.

考虑:

ufw allow in(or out) on <interface> to any
Run Code Online (Sandbox Code Playgroud)