• Linux实战案例(5)关闭Centos的防火墙


    1、检查防火墙的状态

    [root@LxfN1 ~]# service iptables status
    表格:filter
    Chain INPUT (policy ACCEPT)
    num target prot opt source destination

    Chain FORWARD (policy ACCEPT)
    num target prot opt source destination
    1 DOCKER all -- 0.0.0.0/0 0.0.0.0/0
    2 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 ctstate RELATED,ESTABLISHED
    3 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0
    4 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0

    Chain OUTPUT (policy ACCEPT)
    num target prot opt source destination

    Chain DOCKER (1 references)
    num target prot opt source destination

    表格:nat
    Chain PREROUTING (policy ACCEPT)
    num target prot opt source destination
    1 DOCKER all -- 0.0.0.0/0 0.0.0.0/0 ADDRTYPE match dst-type LOCAL

    Chain INPUT (policy ACCEPT)
    num target prot opt source destination

    Chain OUTPUT (policy ACCEPT)
    num target prot opt source destination
    1 DOCKER all -- 0.0.0.0/0 !127.0.0.0/8 ADDRTYPE match dst-type LOCAL

    Chain POSTROUTING (policy ACCEPT)
    num target prot opt source destination
    1 MASQUERADE all -- 172.17.0.0/16 0.0.0.0/0

    Chain DOCKER (2 references)
    num target prot opt source destination

    2、以管理员身份关闭防火墙

    [root@LxfN1 ~]# service iptables stop
    iptables:将链设置为政策 ACCEPT:filter nat [确定]
    iptables:清除防火墙规则: [确定]
    iptables:正在卸载模块: [确定]

    3、检查防火墙是否运行中

    [root@LxfN1 ~]# service iptables status
    iptables:未运行防火墙。

    4、永久关闭防火墙

    [root@LxfN1 ~]# chkconfig iptables off

    5、关闭selinux

    vi /etc/selinux/config

    将SELINUX=enforcing改为SELINUX=disabled
    需要重启机器生效!

    CentOS 6:

    1) 永久性生效,重启后不会复原

    开启: chkconfig iptables on

    关闭: chkconfig iptables off

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

    开启: service iptables start

    关闭: service iptables stop

    CentOS 7:

    systemctl start firewalld.service#启动firewall
    systemctl stop firewalld.service#停止firewall
    systemctl disable firewalld.service#禁止firewall开机启动

    查询TCP连接情况:

     netstat -n | awk '/^tcp/ {++S[$NF]} END {for(a in S) print a, S[a]}'

    查询端口占用情况:

     netstat   -anp   |   grep  portno(例如:netstat –apn | grep 80)

  • 相关阅读:
    适配器模式
    注册模式
    工厂模式
    策略模式和注入控制反转
    验签
    php中加密和解密
    asp.net textbox keyup事件触发后台的textchange事件
    jquery $.post 返回json数据
    网页播放音频、视频文件——基于web的html 5的音乐播放器(转载)
    c# 柱状图(转载)
  • 原文地址:https://www.cnblogs.com/lexiaofei/p/6757352.html
Copyright © 2020-2023  润新知