zoukankan      html  css  js  c++  java
  • Centos7 禁止firewalld并使用iptables 作默认防火墙

    一、停止并禁用firewalld

    [root@test ~]# systemctl stop firewalld
    [root@test ~]# systemctl disable firewalld
    Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
    Removed symlink /etc/systemd/system/basic.target.wants/firewalld.service.

    二、查看iptables 列表,并安装service 软件

    [root@test ~]# yum list all iptables*
    已加载插件:fastestmirror
    Loading mirror speeds from cached hostfile
     * base: mirrors.neusoft.edu.cn
     * extras: mirrors.tuna.tsinghua.edu.cn
     * updates: mirrors.sina.cn
    已安装的软件包
    iptables.x86_64                                   1.4.21-16.el7                           @base
    可安装的软件包
    iptables.i686                                     1.4.21-16.el7                           base 
    iptables-devel.i686                               1.4.21-16.el7                           base 
    iptables-devel.x86_64                             1.4.21-16.el7                           base 
    iptables-services.x86_64                          1.4.21-16.el7                           base 
    iptables-utils.x86_64                             1.4.21-16.el7                           base 

    安装service

    [root@test ~]# yum install iptablesyum install iptables-services.x86_64 -y

    三、启动iptables服务,并检查状态

    [root@test ~]# systemctl start iptables
    [root@test ~]# systemctl status iptables
    ● iptables.service - IPv4 firewall with iptables
       Loaded: loaded (/usr/lib/systemd/system/iptables.service; disabled; vendor preset: disabled)
       Active: active (exited) since 五 2016-08-05 07:54:57 CST; 9s ago
      Process: 8164 ExecStart=/usr/libexec/iptables/iptables.init start (code=exited, status=0/SUCCESS)
     Main PID: 8164 (code=exited, status=0/SUCCESS)
    
    8月 05 07:54:56 test systemd[1]: Starting IPv4 firewall with iptables...
    8月 05 07:54:57 test iptables.init[8164]: iptables: Applying firewall rules: [  OK  ]
    8月 05 07:54:57 test systemd[1]: Started IPv4 firewall with iptables.

    四、加入开机自启动

    [root@test ~]# systemctl enable iptables
    Created symlink from /etc/systemd/system/basic.target.wants/iptables.service to /usr/lib/systemd/system/iptables.service.
  • 相关阅读:
    OAuth 2.0 访问新浪、腾讯的资源服务器
    OAuth 2.0 Authorization Code授权方式详解
    linux权限补充:rwt rwT rws rwS 特殊权限
    异步服务器框架设计
    vsftpd常规操作指南
    folly学习心得
    中国人口趋势(19902035)
    hbase系统搭建
    过载保护
    穷人和富人
  • 原文地址:https://www.cnblogs.com/hanyifeng/p/5739846.html
Copyright © 2011-2022 走看看