常用命令,防火墙的启动

By admin in 澳门新葡亰官网app on 2019年5月6日

centos 6.8 [centos6.5]:

centos 6.8 [centos6.5]:

linux 常用命令(贰)——防火墙的起步、关闭,linux常用命令

centos 6.8 [centos6.5]:

  查看chkconfig列表里面是还是不是有iptables的劳动:

chkconfig | grep iptables

  查看防火墙状态:

service iptables status  OR  /etc/init.d/iptables status

  暂时关门防火墙:

service iptables stop  OR  /etc/init.d/iptables stop

  重启防火墙:

service iptables restart  OR  /etc/init.d/iptables restart

  运转防火墙:

service iptables start  OR  /etc/init.d/iptables start 

  永世关闭防火墙:

chkconfig iptables off 

  长久关闭后启用:

chkconfig iptables on

centos 7:[centos7.0暗中认可使用firewall作为防火墙]

firewall:

  查看默许防火墙状态:(关闭后出示notrunning,开启后展现running)

firewall-cmd --state

  查看已经开放的端口:

firewall-cmd --list-ports

  开启端口:

firewall-cmd --zone=public --add-port=80/tcp --permanent

命令含义: 
–zone #作用域 
–add-port=80/tcp #添加端口,格式为:端口/通讯协议 
–permanent #永久生效,没有此参数重启后失效

  重启防火墙:

firewall-cmd --reload #重启firewall

systemctl:

  查看防火墙状态:

systemctl list-unit-files|grep firewalld.service             #disabled防火墙处于关闭状态

OR

systemctl status firewalld.service                           #dead防火墙处于关闭状态

  停止firewall:

systemctl stop firewalld.service

  启动firewall:

systemctl start firewalld.service

  重启firewall:

systemctl restart firewalld.service

  开机运营firewall:

systemctl enable firewalld.service

  禁止firewall开机运行:

systemctl disable firewalld.service

  查看firewall是不是开机运行:

systemctl is-enabled firewalld.service;echo $?

  

 

 

 

  

 

 

  

常用命令(二)——防火墙的运行、关闭,linux常用命令 centos 陆.八
[centos6.5]: 查看chkconfig列表里面是还是不是有iptables的劳动: chkconfig |
grep iptab…

  查看chkconfig列表里面是还是不是有iptables的劳动:

  查看chkconfig列表里面是否有iptables的劳动:

chkconfig | grep iptables
chkconfig | grep iptables

  查看防火墙状态:

  查看防火墙状态:

service iptables status  OR  /etc/init.d/iptables status
service iptables status  OR  /etc/init.d/iptables status

  权且关闭防火墙:

  暂时关闭防火墙:

service iptables stop  OR  /etc/init.d/iptables stop
service iptables stop  OR  /etc/init.d/iptables stop

  重启防火墙:

  重启防火墙:

service iptables restart  OR  /etc/init.d/iptables restart
service iptables restart  OR  /etc/init.d/iptables restart

  运转防火墙:

  运行防火墙:

service iptables start  OR  /etc/init.d/iptables start 
service iptables start  OR  /etc/init.d/iptables start 

  长久关闭防火墙:

  永世关闭防火墙:

chkconfig iptables off 
chkconfig iptables off 

  永远关闭后启用:

  永世关闭后启用:

chkconfig iptables on
chkconfig iptables on

centos 7:[centos七.0暗许使用firewall作为防火墙]

centos 7:[centos7.0暗中认可使用firewall作为防火墙]

firewall:

firewall:

  查看暗许防火墙状态:(关闭后显得notrunning,开启后彰显running)

  查看暗许防火墙状态:(关闭后出示notrunning,开启后展现running)

firewall-cmd --state
firewall-cmd --state

  查看已经开放的端口:

  查看已经开放的端口:

firewall-cmd --list-ports
firewall-cmd --list-ports

  开启端口:

  开启端口:

firewall-cmd --zone=public --add-port=80/tcp --permanent

命令含义: 
–zone #作用域 
–add-port=80/tcp #添加端口,格式为:端口/通讯协议 
–permanent #永久生效,没有此参数重启后失效
firewall-cmd --zone=public --add-port=80/tcp --permanent

命令含义: 
–zone #作用域 
–add-port=80/tcp #添加端口,格式为:端口/通讯协议 
–permanent #永久生效,没有此参数重启后失效

  重启防火墙:

  重启防火墙:

firewall-cmd --reload #重启firewall
firewall-cmd --reload #重启firewall

systemctl:

systemctl:

  查看防火墙状态:

  查看防火墙状态:

systemctl list-unit-files|grep firewalld.service             #disabled防火墙处于关闭状态

OR

systemctl status firewalld.service                           #dead防火墙处于关闭状态
systemctl list-unit-files|grep firewalld.service             #disabled防火墙处于关闭状态

OR

systemctl status firewalld.service                           #dead防火墙处于关闭状态

  停止firewall:

  停止firewall:

systemctl stop firewalld.service
systemctl stop firewalld.service

  启动firewall:

  启动firewall:

systemctl start firewalld.service
systemctl start firewalld.service

  重启firewall:

  重启firewall:

systemctl restart firewalld.service
systemctl restart firewalld.service

  开机运维firewall:

  开机运营firewall:

systemctl enable firewalld.service
systemctl enable firewalld.service

  禁止firewall开机运转:

  禁止firewall开机运维:

systemctl disable firewalld.service
systemctl disable firewalld.service

  查看firewall是不是开机运转:

  查看firewall是或不是开机运转:

systemctl is-enabled firewalld.service;echo $?
systemctl is-enabled firewalld.service;echo $?

  

  

 

 

 

 

 

 

  

  

 

 

 

 

  

  

发表评论

电子邮件地址不会被公开。 必填项已用*标注

网站地图xml地图
Copyright @ 2010-2019 澳门新葡亰官网app 版权所有