linux 7.0防火墙配置,centos 7.0 firewall 防火墙常用命令

1.查看防火墙是否在运行  firewall-cmd --state

[root@localhost ~]# firewall-cmd --state

running

2.查看都有哪些端口添加到例外 firewall-cmd --permanent --list-port

permanent 永久配置

[root@localhost ~]# firewall-cmd --permanent --list-port

80/tcp

3.添加端口到例外 firewall-cmd --permanent --zone=public --add-port=48489/tcp

[root@localhost ~]# firewall-cmd --permanent --zone=public --add-port=48489/tcp

success

查看永久例外的端口列表

[root@localhost ~]# firewall-cmd --permanent --list-port

80/tcp 48489/tcp

4.删除端口例外 firewall-cmd --permanent --remove-port=80/tcp

[root@localhost ~]# firewall-cmd --permanent --remove-port=80/tcp

success

查看端口列表

[root@localhost ~]# firewall-cmd --permanent --list-port

48489/tcp

5. 停止firewald防火墙 systemctl stop firewalld

[root@localhost /]# systemctl stop firewalld

[root@localhost /]# firewall-cmd --state

not running

6.启动firewalld防火墙

systemctl start firewalld

在关闭防火墙后 仍然不能访问nginx,需要查看是否开启nginx进程

ps -ef | grep nginx  以下结果就是系统自带的nginx 说明并不没有开启服务

[root@localhost etc]# ps -ef | grep nginx

root 2340 2188 0 04:41 pts/0 00:00:00 grep --color=auto nginx

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值