Ubuntu ufw:基于每个接口设置规则

Ant*_*och 45 ubuntu firewall iptables ufw

我想创建一个规则,允许 eth1 上的任何人访问端口 80。UFW 可以这样做还是我应该回去使用 Shorewall?

澄清一下:这是一个能力问题,ufw 可以将接口作为目标处理吗?

Ant*_*och 69

我终于阅读了手册页:

By default, ufw will apply rules to all available interfaces. To
limit  this,  specify DIRECTION on INTERFACE, where DIRECTION is
one of in or out (interface aliases  are  not  supported).   For
example,  to  allow  all  new incoming http connections on eth0,
use:

ufw allow in on eth0 to any port 80 proto tcp
Run Code Online (Sandbox Code Playgroud)

详细说明一下,答案是肯定的,ufw 可以使用该接口作为目标。我的特定规则如下所示:

ufw allow in on eth1 to [eth1 ip addr] port 80 proto tcp
Run Code Online (Sandbox Code Playgroud)


Sha*_*den 6

是的,如果 eth1 只是一个具有自己 IP 地址的普通接口(并且该 IP 地址是您尝试授予访问权限的地址):

ufw allow from any to [eth1 ip addr] port 80
Run Code Online (Sandbox Code Playgroud)

但如果还有比这更复杂的事情,那么我们需要更多关于这个系统是如何设置的信息。