zoukankan      html  css  js  c++  java
  • 「Linux学习」之防火墙服务设置

    设置永久生效主机名:
    方式一:
    hostnamectl set-hostname master
    hostname master
    vim /etc/hostname --- >> 有则编辑更改, 没有则可以新增主机名
     
    查看防火墙默认设置:
    firewall-cmd --get-default-zone
    查看当前默认配置下已有服务:
    firewall-cmd --zone=public --list-all
    firewall-cmd --zone=public --add- 双击table键,选择要添加的服务类型
    添加服务:
    firewall-cmd --zone=public --add-service=ftp
    firewall-cmd --zone=public --add-service=http
    mster访问客户机slave成功
     
    添加完成后查看:
    public (active)
    target: default
    icmp-block-inversion: no
    interfaces: ens33
    sources:
    services: ssh dhcpv6-client http ftp
    ports:
    protocols:
    masquerade: no
    forward-ports:
    source-ports:
    icmp-blocks:
    rich rules:
     
    注意问题: slave不要开设任何端口号, 否则当前设置http设置无效, 由于笔者的master机修改过端口号http端口号888,
    导致笔者slave机无法正常访问master机的http服务, 这里需要在防火墙里添加修改过的端口号,这里介绍一种直接了当的方式, 
    编辑
    vim /etc/httpd/conf/httpd.conf  --- >> 端口改回80, systemctl restart httpd  --- >> 重启服务刷新页面, slave 正常访问master的http服务
     
     

    最后, 使策略永久生效:

    firewall-cmd --permanent --zone=public --add-service=http
    firewall-cmd --permanent --zone=public --add-service=ftp

    查看
    [root@master ~]# firewall-cmd --zone=public --list-all
    public (active)
    target: default
    icmp-block-inversion: no
    interfaces: ens33
    sources:
    services: ssh dhcpv6-client http ftp
    ports:
    protocols:
    masquerade: no
    forward-ports:
    source-ports:
    icmp-blocks:
    rich rules:

  • 相关阅读:
    hdoj_1711Number Sequence
    心痛
    2012国信蓝桥初赛试题
    poj_2524Ubiquitous Religions
    poj_2406Power Strings && poj_1961Period && poj_2752Seek the Name, Seek the Fame(KMP)
    POJ并查集小结
    并查集模版
    hdoj_1232畅通工程 && hdoj_1272小希的迷宫 && hdoj_1213How Many Tables && Is It A Tree?
    poj_1611The Suspects
    KMP模版
  • 原文地址:https://www.cnblogs.com/mixiu26/p/10697338.html
Copyright © 2011-2022 走看看