博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
20190918-02关闭防火墙服务 000 005
阅读量:4582 次
发布时间:2019-06-09

本文共 2157 字,大约阅读时间需要 7 分钟。

查看服务的方法:/etc/init.d/服务名

 

[root@hadoop100 init.d]# pwd

 

/etc/init.d

 

[root@hadoop100 init.d]# ls -al

 

 

 

 

如果是centOS7

显示一个服务的状态:systemctl status firewalld.service

 

 关闭一个服务:systemctl stop firewalld.service后

 

 启动一个服务:systemctl start firewalld.service

重启一个服务:systemctl restart firewalld.service

在开机时启用一个服务:systemctl enable firewalld.service

在开机时禁用一个服务:systemctl disable firewalld.service

查看服务是否开机启动:systemctl is-enabled firewalld.service

 

查看防火墙是否启动

 

 

 查看已启动的服务列表:systemctl list-unit-files|grep enable

 

 

如果是centOS7以下版本

 

service  服务名 status (功能描述:查看服务状态)

service  服务名 stop (功能描述:关闭服务)

service  服务名 start (功能描述:开启服务)

service  服务名 restart (功能描述:重新启动服务)

service --status-all(查看系统中所有的后台服务)

 

案例实操

 

1)查看网络服务的状态

 

[root@hadoop100 桌面]#service network status

 

2)停止网络服务

 

[root@hadoop100 桌面]#service network stop

 

3)启动网络服务

 

[root@hadoop100 桌面]#service network start

 

4)重启网络服务

 

[root@hadoop100 桌面]#service network restart

 

5)查看系统中所有的后台服务

 

[root@hadoop100 桌面]#service --status-all

 

 

chkconfig     (功能描述:查看所有服务器自启配置)

chkconfig 服务名 off   (功能描述:关掉指定服务的自动启动)

chkconfig 服务名 on   (功能描述:开启指定服务的自动启动)

chkconfig 服务名 --list (功能描述:查看服务开机启动状态)

 

下面未试过,做个笔记

面说下CentOS7和6的默认防火墙的区别

CentOS 7默认使用的是firewall作为防火墙,使用iptables必须重新设置一下

1、直接关闭防火墙

systemctl stop firewalld.service
#停止firewall
systemctl disable firewalld.service
#禁止firewall开机启动

2、设置 iptables service

yum -y
install
iptables-services

如果要修改防火墙配置,如增加防火墙端口3306

vi
/etc/sysconfig/iptables

增加规则

-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT

保存退出后

systemctl restart iptables.service #重启防火墙使配置生效

systemctl
enable
iptables.service
#设置防火墙开机启动

最后重启系统使设置生效即可。

systemctl start iptables.service #打开防火墙

systemctl stop iptables.service
#关闭防火墙

 

下面还是笔记

解决主机不能访问虚拟机CentOS中的站点

前阵子在虚拟机上装好了CentOS6.2,并配好了apache+php+mysql,但是本机就是无法访问。一直就没去折腾了。 

具体情况如下

1. 本机能ping通虚拟机

2. 虚拟机也能ping通本机

3.虚拟机能访问自己的web

4.本机无法访问虚拟机的web 

后来发现是防火墙将80端口屏蔽了的缘故。 

检查是不是服务器的80端口被防火墙堵了,可以通过命令:telnet server_ip 80 来测试。

解决方法如下:

/sbin/iptables
-I INPUT -p tcp --dport 80 -j ACCEPT
然后保存:
/etc/rc
.d
/init
.d
/iptables
save
重启防火墙
/etc/init
.d
/iptables
restart

CentOS防火墙的关闭,关闭其服务即可:

查看CentOS防火墙信息:/etc/init.d/iptables status

关闭CentOS防火墙服务:/etc/init.d/iptables stop 

 
 

转载于:https://www.cnblogs.com/YUJIE666/p/11545308.html

你可能感兴趣的文章
FormsAuthentication使用指南
查看>>
解压缩文件
查看>>
Maven打包附加配置文件
查看>>
面经二
查看>>
使用css实现特殊标志或图形
查看>>
利用接口实现自定义监听事件以及观察者模式
查看>>
Android------>TableLayout表格布局方式
查看>>
Tesnsorflow命名空间与变量管理参数reuse
查看>>
apply、call、bind有什么区别?
查看>>
linq 实现group by 不使用group关键字 等同lambad表达式中的group join 查询一对多关系...
查看>>
IP地址及子网掩码计算
查看>>
akka actor中的基本概念(学习小结)
查看>>
Gao the Grid ZOJ 3647 数三角形
查看>>
周总结
查看>>
进程与线程的区别+进程&线程的通信方式
查看>>
【SQL Server CE2.0】打开加密的数据库(源代码)
查看>>
linux进程管理命令
查看>>
Anaconda环境搭建
查看>>
USACO 好题汇总
查看>>
信号量
查看>>