欢迎来到天天文库
浏览记录
ID:57686957
大小:14.50 KB
页数:2页
时间:2020-09-01
《Centos7防火墙设置,关闭,修改,安装.doc》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、一、配置防火墙,开启80端口、3306端口CentOS7.0默认使用的是firewall作为防火墙,这里改为iptables防火墙。1、关闭firewall:systemctlstopfirewalld.service #停止firewallsystemctldisablefirewalld.service #禁止firewall开机启动 2、安装iptables防火墙yuminstalliptables-services #安装vi/etc/sysconfig/iptables #编辑防火墙配置文件#Firewallcon
2、figurationwrittenbysystem-config-firewall#Manualcustomizationofthisfileisnotrecommended.*filter:INPUTACCEPT[0:0]:FORWARDACCEPT[0:0]:OUTPUTACCEPT[0:0]-AINPUT-mstate--stateESTABLISHED,RELATED-jACCEPT-AINPUT-picmp-jACCEPT-AINPUT-ilo-jACCEPT-AINPUT-mstate--stateNEW-mtc
3、p-ptcp--dport22-jACCEPT-AINPUT-mstate--stateNEW-mtcp-ptcp--dport80-jACCEPT-AINPUT-mstate--stateNEW-mtcp-ptcp--dport3306-jACCEPT-AINPUT-jREJECT--reject-withicmp-host-prohibited-AFORWARD-jREJECT--reject-withicmp-host-prohibitedCOMMIT:wq! #保存退出systemctlrestartiptables
4、.service #最后重启防火墙使配置生效systemctlenableiptables.service #设置防火墙开机启动 二、关闭SELINUXvi/etc/selinux/config#SELINUX=enforcing #注释掉#SELINUXTYPE=targeted #注释掉SELINUX=disabled #增加:wq! #保存退出setenforce0 #使配置立即生效查询防火墙状态:[root@localhost~]#service iptablesstatus<回车> 停止防火墙:[root@loca
5、lhost~]#service iptablesstop<回车> 启动防火墙:[root@localhost~]#service iptablesstart<回车> 重启防火墙:[root@localhost~]#service iptablesrestart<回车> 永久关闭防火墙:[root@localhost~]#chkconfig iptablesoff<回车> 永久关闭后启用:[root@localhost~]#chkconfig iptableson<回车>
此文档下载收益归作者所有