CentOS 防火墙操作总结

环境:CentOS 7.4

CentOS 7.4 默认使用的是 firewall 作为防火墙

防火墙开启、关闭、禁用命令

systemctl start firewalld           #开启 firewall
systemctl stop firewalld.service    #停止 firewall
systemctl status firewalld          #检查 firewall 状态
systemctl disable firewalld.service #禁止 firewall 开机启动
systemctl enable firewalld.service  #开启 firewall 开机启动

使用 firewall-cmd 配置端口

firewall-cmd --state                                          #查看 firewall 状态
firewall-cmd --reload                                         #重新加载配置
firewall-cmd --list-ports                                     #查看开放的端口
firewall-cmd --zone=public --add-port=9200/tcp --permanent    #开启 firewall 端口
firewall-cmd --zone=public --remove-port=9200/tcp --permanent #关闭 firewall 端口

命令含义:
–zone              #作用域
–add-port=9200/tcp #添加端口,格式为:端口/通讯协议
–permanent         #永久生效,没有此参数重启后失效

注意:添加端口后,必须用命令firewall-cmd --reload重新加载一遍才会生效

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值