防火墙常用操作

防火墙操作常用指令:


1> iptables
service iptables status // 查看防火墙状态
iptables -L -n // 使用命令查看端口开启情况
iptables -F // 清除预设表filter中的所有规则链的规则
iptables -X // 清除预设表filter中使用者自定链中的规则
/etc/rc.d/init.d/iptables save // 保存以后下次重启才会开启
service iptables restart // 重启一下防火墙


iptables -A INPUT -p tcp --dport 80 -j ACCEPT
iptables -A OUTPUT -p tcp --dport 80 -j ACCEPT

/etc/rc.d/init.d/iptables save

service iptables restart // 重启一下防火墙


2> firewalld

systemctl status firewalld // 查看firewall服务状态
firewall-cmd --state // 查看firewall状态
service firewalld start // 开启firewall服务状态
firewall-cmd --reload // 修改设置后要重启防火墙



firewall-cmd --query-port=80/tcp // 查询端口是否开放
firewall-cmd --permanent --add-port=80/tcp // 开放80端口
firewall-cmd --permanent --remove-port=80/tcp // 移除端口

firewall-cmd --permanent --list-ports // 查看防火墙的开放的端口
firewall-cmd --list-all //查看防火墙规则

posted @   Mr.Liu08  阅读(168)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构
点击右上角即可分享
微信分享提示