firewall-cmd --zone=public --list-ports
firewall-cmd --zone=public --query-port=8090/tcp
firewall-cmd --reload
firewall-cmd --zone=public --add-port=8090/tcp --permanentfirewall-cmd --reload
firewall-cmd --zone=public --remove-port=8090/tcp --permanentfirewall-cmd --reload
firewall-cmd --list-all
firewall-cmd --permanent --add-rich-rule=“rule family=“ipv4” source address=“192.168.110.24” accept”firewall-cmd --reload
firewall-cmd --permanent --remove-rich-rule=“rule family=“ipv4” source address=“192.168.110.24” accept”firewall-cmd --reload
firewall-cmd --permanent --add-rich-rule=“rule family=“ipv4” source address=“192.168.110.21/24” accept”firewall-cmd --reload
firewall-cmd --permanent --add-rich-rule="rule family=“ipv4” source address=“192.168.110.21” port protocol=“tcp” port=“8090” acceptfirewall-cmd --reload
需要/etc/hosts.allow 和 /etc/hosts.deny相互配合即可完成

拒绝所有ip
vim /etc/hosts.deny
增加sshd:all:deny
vim /etc/hosts.allow
增加 sshd:192.168.110.24:allow
如果配置成192.168.110.*,表示只有这个ip段的能连接
以上为个人经验,希望能给大家一个参考,也希望大家多多支持本站。
您可能感兴趣的文章: