zoukankan      html  css  js  c++  java
  • linux iptables开放/关闭端口命令

    在CentOS/RHEL 7以前版本上开启端口

    #开放端口:8080
    /sbin/iptables -I INPUT -p tcp --dport 8080 -j ACCEPT
    #将更改进行保存
    /etc/rc.d/init.d/iptables save
    #重启防火墙以便改动生效:(或者直接重启系统)
    /etc/init.d/iptables restart

    #关闭iptable防火墙
    /etc/init.d/iptables stop
    service iptables stop # 停止服务
    #查看防火墙信息
    /etc/init.d/iptables status

    在CentOS/RHEL 7上开启端口

    CentOS/RHEL 7后,防火墙规则设置由firewalld服务进程默认管理。一个叫做firewall-cmd的命令行客户端支持和这个守护进程通信以永久修改防火墙规则。

     使用下面命令来永久打开一个新端口(如TCP/9200)

    [root@localhost init.d]# firewall-cmd --zone=public --add-port=9200/tcp --permanent

      [root@localhost init.d]# firewall-cmd --reload 

    如果不使用“--permanent”标记,把么防火墙规则在重启后会失效。

  • 相关阅读:
    hibernate映射-单向多对一映射
    CSS
    HTML基础
    复习
    元类,单例
    数据类型,约束,存储引擎
    数据库概念,安装,基本操作
    IO模型
    异步回调,协程
    GIL锁,线程池,同步异步
  • 原文地址:https://www.cnblogs.com/zsg88/p/7810100.html
Copyright © 2011-2022 走看看