linux系统防火墙列表查看 Linux中防火墙的相关操作命令

一、iptables防火墙(需要安装防火墙sudo apt-get install firewalld命令查看插件)1、基本操作,我来为大家科普一下关于linux系统防火墙列表查看 Linux中防火墙的相关操作命令?下面希望有你要的答案,我们一起来看看吧!

linux系统防火墙列表查看 Linux中防火墙的相关操作命令

linux系统防火墙列表查看 Linux中防火墙的相关操作命令

一、iptables防火墙(需要安装防火墙sudo apt-get install firewalld命令查看插件)1、基本操作

# 查看防火墙状态 service iptables status # 停止防火墙 service iptables stop # 启动防火墙 service iptables start # 重启防火墙 service iptables restart # 永久关闭防火墙 chkconfig iptables off # 永久关闭后重启 chkconfig iptables on  

如果执行如上命令报错:

[root@localhost /]# service iptables status Redirecting to /bin/systemctl status iptables.service Unit iptables.service could not be found.

执行如下命令即可:

yum install iptables-services

2、开启80端口

vim /etc/sysconfig/iptables # 加入如下代码 -A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT #保存退出后重启防火墙 service iptables restart

二、firewall防火墙

#查看 systemctl status firewalld #开启防火墙 systemctl start firewalld.service #重启防火墙 systemctl restart firewalld.service #查看firewall防火墙的状态 firewall-cmd --state #查看防火墙开放端口规则 firewall-cmd --list-port #查看80端口是否开启 firewall-cmd --query-port=80/tcp #开放80端口 firewall-cmd --permanent --add-port=80/tcp #(–permanent永久生效,没有此参数重启后就失效) #加载生效开放的端口 firewall-cmd --reload #查询指定端口80是否开放 firewall-cmd --query-port=80/tcp # 移除端口 firewall-cmd --permanent --remove-port=8080/tcp

,

免责声明:本文仅代表文章作者的个人观点,与本站无关。其原创性、真实性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容文字的真实性、完整性和原创性本站不作任何保证或承诺,请读者仅作参考,并自行核实相关内容。文章投诉邮箱:anhduc.ph@yahoo.com

    分享
    投诉
    首页