虚拟机上CentOS 7关闭防火墙操作
1.首先查看防火墙的状态,使用的命令为:#service iptables status
提示:Unit iptables.service could not be found.
解决方案:还原传统的管理方式
1.先执行如下命令:
#cd/etc/sysconfig
#ls -l
这个时候没有查看到iptable文件,但存在ip6table-config和iptables-config.我的虚拟机是Centos7操作系统,CentOS 7默认没有iptables文件
2.安装iptables-services,使用命令:# yum install iptables-services
看到完毕信息,表示iptables-services已安装完成
3.启动iptables
#systemctl enable iptables
#systemctl start iptables
4.查看防火墙状态
#service iptables status
5.关闭防火墙,使用命令:#service iptable stop
6.打开防火墙,使用命令:#service iptable start(本次有效,下次开机后恢复原设置)
注:如果虚拟机切换了网络连接方式,需要重启,因为IP会变.用之前的IP会断开连接,而且旧IP已不能用.
装虚拟机的物理机,只关闭专用网络的防火墙,就可以被另一台计算机ping通了.