UFW:将iptables规则翻译成UFW

这是iptables的规则:

-A INPUT -i eth0 -s 10.2.0.51,10.2.0.52 -d 228.0.0.3 -j ACCEPT 

我怎样才能把它翻译成ufw规则?

我试过了:

 root@localhost:~# sudo ufw allow from 10.2.0.51,10.2.0.,52 to 228.0.0.3 to any port ERROR: Wrong number of arguments root@localhost:~# sudo ufw allow from 10.2.0.51,10.2.0,52 to 228.0.0.3 to any port proto tcp ERROR: Wrong number of arguments 

我错过了什么?

语法如下:

 sudo ufw allow from <target> to <destination> port <port number> proto <protocol name> 

所以,你应该跑

 sudo ufw allow from 10.2.0.51,10.2.0.52 to 228.0.0.3 

它将允许所有端口和所有协议。 仅限于TCP:

 sudo ufw allow from 10.2.0.51,10.2.0.52 to 228.0.0.3 proto tcp