ICode9

精准搜索请尝试: 精确搜索
首页 > 系统相关> 文章详细

linux设置防火墙,自启动以及关闭禁止防火墙

2021-04-24 21:01:58  阅读:234  来源: 互联网

标签:iptables service stop 防火墙 firewalld systemctl linux 自启动


linux在安装完成后会自动开启防火墙(firewalld),这将导致外部网络无法连接到操作系统。
一般情况下,我们都会选择关闭并禁用防火墙。
本来是使用命令

service iptables stop
service ip6tables stop
chkconfig iptables off
chkconfig ip6tables off

但是linux下执行防火墙相关指令报错:Redirecting to /bin/systemctl restart iptables.service,应该是这个版本linux不支持这个命令了。
1,安装systemctl:yum install iptables-services
2,设置开机启动:systemctl enable iptables.service
重启
3.设置开机关闭:systemctl disable firewalld.service

需要换成以下命令:

systemctl stop iptables 
systemctl stop ip6tables
systemctl disable iptables
systemctl disable ip6tables

开启防火墙:

systemctl start firewalld.service

关闭防火墙:

systemctl stop firewalld.service

设置防火墙开机自启动:

systemctl enable firewalld.service

禁用防火墙自启动:

systemctl disable firewalld.service

Linux 服务管理有两种方式:service和systemctl

  • systemd:Linux系统最新的初始化系统(init),提高系统的启动速度,尽可能启动较少的进程,尽可能更多进程并发启动。
  • systemd对应的进程管理命令是systemctl,systemctl由上面可以知道,已经兼容了service命令了。
    此文章仅代表自己(本菜鸟)学习积累记录,或者学习笔记,如有侵权,请联系作者删除。人无完人,文章也一样,文笔稚嫩,在下不才,勿喷,如果有错误之处,还望指出,感激不尽~

技术之路不在一时,山高水长,纵使缓慢,驰而不息。


标签:iptables,service,stop,防火墙,firewalld,systemctl,linux,自启动
来源: https://blog.51cto.com/u_13604316/2729499

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有