linux(5)-关闭防火墙命令

关闭服务器上的防火墙:

/etc/init.d/iptables stop 

PS:如若访问不了,有可能是防火墙开启的原因,则需关闭防火墙

systemctl status firewalld  查看防火墙状态,如果开启则需关闭
systemctl stop firewalld    暂时关闭防火墙
systemctl disable firewalld   永久关闭防火墙

 

实际上对防火墙还是不了解,每次虚拟机重启都需要执行

service iptables stop

systemctl disable firewalld   永久关闭防火墙   也不知道是哪句起了作用!!

 

 

 

此处我遇到了问题:
CentOS 7 执行service iptables start出现redirecting to systemctl ...Failed to ...not loaded.

在centOS 7系统中运行

service iptables stop

发现出错:出现redirecting to systemctl ...Failed to ...not loaded.

解决办法

1. 使用systemctl

systemctl [start|stop|restart|save|status] iptables.service

2. 安装iptables-services

切换到root用户下,执行:

yum install iptables-services
systemctl enable iptables.service //设置开机启动

之后就可以使用以下指令了:

service iptables [start|stop|restart|save|status]

 

 

 

iptables常用命令

查看是否已经安装了iptables以及iptables版本号 

iptables -V (注意:V是大写字母V)
 

关闭iptables

service iptables stop


启动iptables

service iptables start


重启iptables

service iptables restart

 

 

posted @ 2020-03-09 19:08  阳光美美哒  阅读(1602)  评论(0编辑  收藏  举报