这里,我们常见的几个Linux系统的关闭防火墙的命令记录:
CentOS 6系统:service iptables stop
CentOS 7系统:systemctl stop firewalld.service
Ubuntu系统:ufw disable
Debian系:/etc/init.d/iptables stop
如果我们需要在服务器添加一个端口,这里我以CentOS7作为示范看看。目前我们用的较多的CentOS版本也是7。
启动防火墙:
systemctl start firewalld.service检查防火墙状态
firewall-cmd --state添加23端口:
firewall-cmd --zone=public --add-port=23/tcp --permanent重新加载生效
firewall-cmd --reload查看开启的端口:
[root@ecs-centos7 ~]# firewall-cmd --list-ports 23/tcp检查防火墙是否开启启动:
systemctl is-enabled firewalld.service;echo $?如果没有开机启动,我们可以设置:
systemctl disable firewalld.service