centos7禁用firewall防火墙启用iptables步骤

西北野狼 西北野狼     2022-09-17     413

关键词:

一、题目:CentOS7 禁用firewall防火墙 启用iptables 步骤

二、要求:CentOS7 的防火墙默认是firewall 防火墙,现在需要启用iptables防火墙并完成常用的配置。

三、步骤:

1. 关闭firewall

1 systemctl stop firewalld.service  # 停止firewall
2 systemctl disable firewalld.service # 禁止firewall 开机启动
3 systemctl status firewalld.service # firewall 服务启动状态

2. 安装iptables并配置

1 yum install iptables-services # 安装iptables服务

[root@localhost ~]# vi /etc/sysconfig/iptables # 修改iptables配置文件

# sample configuration for iptables service
# you can edit this manually or use system-config-firewall
# please do not ask us to add additional ports/services to this default configuration
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT 
-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT   
-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT  # 增加一些端口规范
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT

3. 重启服务并设置为开启启动

1 systemctl restart iptables.service # 最后重启使配置生效
2 systemctl enable iptables.service # 设置防火墙开启启动

四、参考文献

1 http://www.linuxidc.com/Linux/2015-05/117473.htm # 配置说明
2 http://www.linuxidc.com/Linux/2014-03/99159.htm # 使用规范说明

 

centos7使用firewall-cmd打开关闭防火墙与端口

一、centos7版本对防火墙进行加强,不再使用原来的iptables,启用firewalld1.firewalld的基本使用启动:systemctlstartfirewalld查状态:systemctlstatusfirewalld停止:systemctldisablefirewalld禁用:systemctlstopfirewalld在开机时启用一个服务:systemctlenablefire... 查看详情

centos7.0关闭默认防火墙启用iptables防火墙

 CentOS7.0默认使用的是firewall作为防火墙,这里改为iptables防火墙步骤。1、关闭firewall:systemctlstopfirewalld.service#停止firewallsystemctldisablefirewalld.service#禁止firewall开机启动firewall-cmd--state#查看默认防火墙状态(关闭后显示notrunning 查看详情

centos7防火墙关闭和启用iptables防火墙

操作系统环境:CentOS Linuxrelease7.0.1406(Core)64位CentOS7.0默认使用的是firewall作为防火墙,这里改为iptables防火墙步骤。1、关闭firewall:systemctlstopfirewalld.service#停止firewallsystemctldisablefirewalld.service#禁止firewall开机启动fir 查看详情

centos7.0关闭默认防火墙启用iptables防火墙

操作系统环境:CentOS Linuxrelease7.0.1406(Core)64位CentOS7.0默认使用的是firewall作为防火墙,这里改为iptables防火墙步骤。1、关闭firewall:systemctlstopfirewalld.service#停止firewallsystemctldisablefirewalld.service#禁止firewall开机启动fir 查看详情

centos7.0关闭默认防火墙启用iptables防火墙

CentOS7.0关闭默认防火墙启用iptables防火墙http://www.linuxidc.com/Linux/2015-05/117473.htm操作系统环境:CentOS Linuxrelease7.0.1406(Core)64位CentOS7.0默认使用的是firewall作为防火墙,这里改为iptables防火墙步骤。1、关闭firewall:systemctlstopfi 查看详情

centos7.0关闭默认防火墙启用iptables防火墙

本文从http://www.linuxidc.com/Linux/2015-05/117473.htm转载 操作系统环境:CentOSLinuxrelease7.0.1406(Core)64位CentOS7.0默认使用的是firewall作为防火墙,这里改为iptables防火墙步骤。1、关闭firewall:systemctlstopfirewalld.service#停止firewa 查看详情

centos7.0关闭默认防火墙启用iptables防火墙

http://www.linuxidc.com/Linux/2015-05/117473.htm  操作系统环境:CentOS Linuxrelease7.0.1406(Core)64位CentOS7.0默认使用的是firewall作为防火墙,这里改为iptables防火墙步骤。1、关闭firewall:systemctlstopfirewalld.service#停 查看详情

centos7.0关闭默认防火墙启用iptables防火墙

源地址:http://www.linuxidc.com/Linux/2015-05/117473.htm操作系统环境:CentOS Linuxrelease7.0.1406(Core)64位CentOS7.0默认使用的是firewall作为防火墙,这里改为iptables防火墙步骤。1、关闭firewall:systemctlstopfirewalld.service#停止firewal 查看详情

centos7防火墙相关命令

启动:systemctlstartfirewalld禁用:systemctlstopfirewalld重新载入规则:firewall-cmd--reload查看所有打开的端口:firewall-cmd--zone=public--list-ports临时开放端口:firewall-cmd--zone=public--add-port=3306/tcp永久开放端口:firewall-cmd--zon 查看详情

centos7开启关闭80端口

1.centos7版本对防火墙进行加强,不再使用原来的iptables,启用firewall1.查看已开放的端口(默认不开放任何端口)firewall-cmd--list-ports2.开启80端口firewall-cmd--zone=public(作用域)--add-port=80/tcp(端口和访问类型)--permanent(永久生效)3.重启防火墙fir... 查看详情

centos7的防火墙和ssh连接(代码片段)

Centos7的防火墙和ssh连接Centos7firewall:1、firewalld的基本使用启动:systemctlstartfirewalld关闭:systemctlstopfirewalld查看状态:systemctlstatusfirewalld 开机禁用 :systemctldisablefirewalld开机启用 : systemctlena 查看详情

centos7中firewall-cmd命令

安装firewalld防火墙yuminstallfirewalld开启服务systemctlstartfirewalld.service关闭防火墙systemctlstopfirewalld.service开机自动启动systemctlenablefirewalld.service关闭开机制动启动systemctldisablefirewalld.service使用firewall-cmd命令查看状态firewall-cmd--state//runni... 查看详情

centos7中firewall-cmd命令

安装firewalld防火墙   yuminstallfirewalld 开启服务   systemctlstartfirewalld.service 关闭防火墙systemctlstopfirewalld.service 开机自动启动systemctlenablefirewalld.service 关闭开机制动启动systemctldisablefirewalld.service&n... 查看详情

centos7防火墙firewalld开放80端口(转)(代码片段)

1、运行、停止、禁用firewalld启动:#systemctlstart firewalld查看状态:#systemctlstatusfirewalld 或者 firewall-cmd--state停止:#systemctldisablefirewalld禁用:#systemctlstopfirewalld 查看firewall是否运行,下面两个命令都可以 查看详情

centos7开放端口(代码片段)

CentOS7.0默认使用的是firewall作为防火墙查看防火墙状态:firewall-cmd--state停止firewall:systemctlstopfirewalld.service启用防火墙:systemctlstartfirewalld.service禁止firewall开机启动:systemctldisablefirewalld.service开机时启动firewall࿱... 查看详情

centos7使用firewalld打开关闭防火墙与端口

firewalld的基本使用启动systemctlstartfirewalld停止systemctldisablefirewalld禁用systemctlstopfirewalld查看状态systemctlstatusfirewalld配置firewalld-cmd查看版本firewall-cmd--version查看帮助firewall-cmd--help显示状态firewall-cmd--st 查看详情

rhel7/centos7防火墙之firewall-cmd命令详解(代码片段)

目录Firewalldzonefirewall-cmd开始配置防火墙策略总结RedhatEnterpriseLinux7已默认使用firewalld防火墙,其管理工具是firewall-cmd。使用方式也发生了很大的改变。基于iptables的防火墙已默认不启动,但仍然可以继续使用。RHEL7中有这几种防火... 查看详情

配置防火墙,开启端口

Centos7,配置防火墙,开启端口    centos7版本对防火墙进行加强,不再使用原来的iptables,启用firewall1.查看已开放的端口(默认不开放任何端口)firewall-cmd--list-ports2.开启80端口firewall-cmd--zone=public(作用域)--add-port=80/tcp(端口和访问类... 查看详情