firewalld基本配置

2020-04-07  本文已影响0人  cnwinds

基本指令

# 启用防火墙
systemctl start firewalld.service
# 添加访问规则
firewall-cmd --permanent --add-rich-rule="rule family="ipv4" source address="192.168.142.0/24" port protocol="tcp" port="5432" accept"
firewall-cmd --permanent --add-rich-rule="rule family="ipv4" source address="192.168.143.0/24" port protocol="tcp" port="5432" accept"
# 让规则生效
systemctl restart firewalld.service
# 查看配置结果
firewall-cmd –list-all
# 删除规则
firewall-cmd --permanent --remove-rich-rule="rule family="ipv4" source address="192.168.142.0/24" port protocol="tcp" port="5432" accept"
# 让规则生效
systemctl restart firewalld.service
上一篇下一篇

猜你喜欢

热点阅读