iptables -I INPUT -p tcp --dport 1521 -j DROP

iptables -I INPUT -s 192.168.8.18 -p tcp --dport 15672 -j ACCEPT

禁止所有端口

iptables -D INPUT DROP

允许一个ip访问所有端口

iptables -A INPUT -s 10.20.86.0/24 -p tcp -j ACCEPT

允许本机

  1. iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
  2. iptables -A OUTPUT -m state --state ESTABLISHED,RELATED -j ACCEPT

开放所有

iptables -P INPUT ACCEPT

防火墙

firewall-cmd --permanent --add-rich-rule="rule family="ipv4" source address="192.168.50.20" port protocol="tcp" port="6379" accept" --permanent