• Linux关闭防火墙


    Centos 6.x版本 iptables

    查看防火墙状态:service iptables tatus

    iptables:Firewall is not runing. 说明防火墙没有开启

    开启防火墙:service iptables start

    关闭防火墙:service iptables stop

    Centos 7版本 firewall

    查看当前防火墙状态:systemctl status firewalld

    执行后可以看到绿色字样标注的“active(running)”,说明防火墙是开启状态

     

    关闭防火墙命令:systemctl stop firewalld.service

    关闭后,使用命令systemctl status firewalld.service

    可以看到,disavtive(dead)的字样,说明防火墙已经关闭

     

    开启防火墙:systemctl start firewalld.service

     

    怎么设置才能永久关闭防火墙呢?

    关闭开机自启动,禁止防火墙服务器:systemctl disable firewalld.service

     

    开启开机启动:systemctl enable firewalld.service

     

    CentOS7 默认使用firewalld防火墙,如果想换回iptables防火墙,可关闭firewalld并安装iptables。

    安装iptables-services

    yum install iptables-services

    修改防火墙配置文件

    vi /etc/sysconfig/iptables

    默认的文件为:

    在修改之前使用telnet命令查看端口是否开放。

    1.启动telnet。控制面板-->程序和功能-->打开或关闭windows功能-->勾选Telnet的两个选项。
    2.打开cmd窗口,输入telnet,如果端口关闭或者无法连接,则显示不能打开到主机的链接,链接失败;端口打开的情况下,链接成功,则进入telnet页面(全黑的),证明端口可用。

    (1)telnet IP 端口。

    (2)telnet 域名 端口。

     添加端口80、8080、3306、3690端口:

     esc :wq! 退出保存修改。

    注意:添加在端口22上面或者下面,不要放在最后,不然不起作用。

     重启防火墙使配置生效

    systemctl restart iptables.service

    刚刚yum install iptables.service之后系统如果没有重启,iptables.service是找不到的,会报unit not fount。耽误时间的小坑!

    设置防火墙开机启动:
    systemctl enable iptables.service

  • 相关阅读:
    jquery实现选项卡(两句即可实现)
    常用特效积累
    jquery学习笔记
    idong常用js总结
    织梦添加幻灯片的方法
    LeetCode "Copy List with Random Pointer"
    LeetCode "Remove Nth Node From End of List"
    LeetCode "Sqrt(x)"
    LeetCode "Construct Binary Tree from Inorder and Postorder Traversal"
    LeetCode "Construct Binary Tree from Preorder and Inorder Traversal"
  • 原文地址:https://www.cnblogs.com/niuben/p/13168708.html
Copyright © 2020-2023  润新知