iptables防火墙

1、基本操作

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

2、查看防火墙状态,防火墙处于开启状态并且只开放了22端口

3、开启80端口

 vim /etc/sysconfig/iptables
# 加入如下代码,比着两葫芦画瓢 :)
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT

保存退出后重启防火墙

service iptables restart

firewall防火墙

1、查看firewall服务状态

systemctl status firewalld

2、查看firewall的状态

firewall-cmd --state

3、开启、重启、关闭、firewalld.service服务

# 开启
service firewalld start
# 重启
service firewalld restart
# 关闭
service firewalld stop

4、查看防火墙规则

firewall-cmd --list-all 

5、查询、开放、关闭端口

# 查询端口是否开放
firewall-cmd --query-port=8080/tcp
# 开放80端口
firewall-cmd --permanent --add-port=80/tcp
# 移除端口
firewall-cmd --permanent --remove-port=8080/tcp
#重启防火墙(修改配置后要重启防火墙)
firewall-cmd --reload # 参数解释
1、firwall-cmd:是Linux提供的操作firewall的一个工具;
2、--permanent:表示设置为持久;
3、--add-port:标识添加的端口;

CentOS 7 开放防火墙端口 命令的更多相关文章

  1. CentOS 7 开放防火墙端口命令

    CentOS 7 开放防火墙端口 命令 最近公司新的server要求用CentOS7, 发现以前CentOS 6 系列中的 iptables 相关命令不能用了,查了下,发现Centos 7使用fire ...

  2. CentOS 7 开放防火墙端口 命令(转载)

    CentOS 7 开放防火墙端口 命令 最近公司新的server要求用CentOS7, 发现以前CentOS 6 系列中的 iptables 相关命令不能用了,查了下,发现Centos 7使用fire ...

  3. linux 安装禅道 和 CentOS 7 开放防火墙端口 命令

    linux 安装禅道链接:  https://www.cnblogs.com/maohuidong/p/9750202.html CentOS 7 开放防火墙端口 命令 链接:https://www. ...

  4. CentOS 7 开放防火墙端口

    我:最近在使 CentOS 7时发现在本地不能访问linux上8080端口,以上是我的操作,修改后访问成功 CentOS 7 开放防火墙端口 命令 最近公司新的server要求用CentOS7, 发现 ...

  5. Centos7 开放防火墙端口命令

    Centos 7 使用firewalld代替了原来的iptables,使用方法如下: >>>关闭防火墙 systemctl stop firewalld.service       ...

  6. centos7安装 ftp 组件与开放防火墙端口命令

    Linux 安装 ftp 组件 安装完后,有/etc/vsftpd/vsftpd.conf 文件,是 vsftp 的配置文件. 1.执行 yum -y install vsftpd 2. 添加一个 f ...

  7. CentOS/Linux开放某些端口

    CentOS/Linux开放某些端口 CentOS/Linux 装载系统的时候只开启了少数端口如22,80(有些连80都没有开放)等. 结果再装完Nginx+PHP+MySQL 后不能访问网站. 当然 ...

  8. Centos 7和 Centos 6开放查看端口 防火墙关闭打开

    Centos 7 firewall 命令: 查看已经开放的端口: firewall-cmd --list-ports 开启端口 firewall-cmd --zone=public --add-por ...

  9. Centos 7 开放查看端口 防火墙关闭打开

    Centos 7 firewall 命令: 查看已经开放的端口: firewall-cmd --list-ports 开启端口 firewall-cmd --zone=public --add-por ...

随机推荐

  1. svn 和 git的区别

    1.速度: 克隆一份全新的目录,以同样拥有五个(才五个)分支来说,SVN是同时复製5个版本的文件,也就是说重复五次同样的动作.而Git只是获取文件的每个版本的元素,然后只载入主要的分支(master) ...

  2. java格式化百分比

    NumberFormat nf = NumberFormat.getPercentInstance(); System.out.println(nf.format(0.47)); 显示:47% Dec ...

  3. windows命令行设置IP与DNS

    用dos命令修改IP等本地连接属性 平时我们改IP通常都在是窗口界面本地连接直接修改, 那在命令行也可以设置IP地址?当然可以,这里要用到netsh命令 .点击“开始”->“运行”,输入“cmd ...

  4. hosts.allow hosts.deny

    简单控制访问ip,hosts.allow/hsots.deny  a simple access control language that is based on client (host name ...

  5. C++ 智能指针Auto_PTR 分析

    C++的动态内存的分配与释放是个挺折磨人的事情,尤其异常分支复杂时(比如一堆try catch中,各catch里需要做delete 掉相关的堆上分配的内存),极有可能产生内存泄露的情况.C++中提供了 ...

  6. JDK 生成数字证书

    JDK(keytool.exe)生成数字证书 2010-11-21 15:52 QUOTE: keytool JAVA是个密钥和证书管理工具.它使用户能够管理自己的公钥/私钥对及相关证书,用于(通过数 ...

  7. xml2-config not found.

    在Ubuntu下接着安装php时候,在configure后,又出现错误提示:error: xml2-config not found. Please check your libxml2 instal ...

  8. web项目在eclipse workspace中的位置

    workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\项目名

  9. Eureka常见问题总结

    在Spring-cloud做微服务架构时,会碰到各种坑.下面总结一下Eureka的常见问题. 一.Eureka的自我保护模式   如果在Eureka Server的首页看到以下这段提示,则说明Eure ...

  10. Python学习笔记015——文件file的常规操作(二进制文件)

    有时候诸如图片.音乐等信息不是以文本的形式存储的,而是二进制文件格式存储的. 有时候很多信息不是以文本文件的形式存储的 很多时候,都需要用到二进制读取文件.毕竟很多信息不是以文本的形式存储.例如:图片 ...