centos7的一些基本操做

  1. 防火牆的開啓與關閉

  2.     centos7的防火牆設置和之前不同了,必定要注意。</br>
        

    It is possible to go back to a more classic iptables setup. First, stop and mask the firewalld service:php

    systemctl stop firewalld
    systemctl mask firewalld

    Then, install the iptables-services package:html

    yum install iptables-services

    Enable the service at boot-time:centos

    systemctl enable iptables

    Managing the serviceapp

    systemctl [stop|start|restart] iptables

    Saving your firewall rules can be done as follows:tcp

    service iptables save

    oride

    /usr/libexec/iptables/iptables.init save

    2.開啓端口

    開啓端口
    firewall-cmd --zone=public --add-port=80/tcp --permanentui

    命令含義:
    --zone #做用域
    --add-port=80/tcp #添加端口,格式爲:端口/通信協議
    --permanent #永久生效,沒有此參數重啓後失效url

    重啓防火牆
    firewall-cmd --reloadcentos7

    參考:https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Security_Guide/sec-Using_Firewalls.htmlspa

相關文章
相關標籤/搜索