zoukankan      html  css  js  c++  java
  • centos6,7中防火墙基本用法

     

    centos 7中

    1.永久开放端口8080

    firewall-cmd --zone=public --add-port=8080/tcp --permanent (添加端口后,重启防火墙后才能查看)

    2.查看开放的端口

    firewall-cmd --list-ports

    3.重启

    firewall-cmd --reload

    4.停止防火墙

    systemctl stop firewalld.service

    5.禁止防火墙开机启动

    systemctl disable firewalld.service

    6.删除

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

    centos6中

    1. 开放80,关闭22 端口

    /sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT
    /sbin/iptables -I INPUT -p tcp --dport 22 -j DROP

    2. 保存:

    /etc/rc.d/init.d/iptables save

    3. 查看打开的端口:

    /etc/init.d/iptables status

    4. 关闭防火墙 
    1) 永久性生效,重启后不会复原

    开启: chkconfig iptables on

    关闭: chkconfig iptables off

    2) 即时生效,重启后复原

    开启: service iptables start

    关闭: service iptables stop

    5. 查看防火墙状态: 

    service iptables status

  • 相关阅读:
    hdu 1240 Asteroids!
    hdu 1253 胜利大逃亡
    hdu 1035 Robot Motion
    hdu 1181 变形课
    hdu 1548 A strange lift
    DFS Sum It Up
    hdu 3278 Catch That Cow
    hdu 1312 Red and Black
    ACM菜鸟
    eclipse新建安卓项目点击finish后窗口无法关闭
  • 原文地址:https://www.cnblogs.com/regit/p/8508141.html
Copyright © 2011-2022 走看看