CentOS7防火墙firewalld 和 CentOS6防火墙iptables的一些配置命令
CentOS7 防火墙
一、防火墙的开启、关闭、禁用、查看状态命令
(1)启动防火墙:systemctl start firewalld
(2)关闭防火墙:systemctl stop firewalld
(3)设置开机启用防火墙:systemctl enable firewalld
(4)设置开机禁用防火墙:systemctl disable firewalld
(5)检查防火墙状态:systemctl status firewalld
二、使用firewall-cmd命令配置端口
(1)查看防火墙状态:firewall-cmd --state
(2)重新加载配置:firewall-cmd --reload
(3)查看已开放的端口:firewall-cmd --list-ports
(4)开放防火墙端口:firewall-cmd --zone=public --add-port=10050/tcp --permanent
命令含义:
–zone #作用域
–add-port=10050/tcp #添加端口,格式为:端口/通讯协议
–permanent #永久生效,没有此参数重启后失效
注意:添加端口后,必须用命令firewall-cmd --reload重新加载一遍 或者systemctl restart firewalld重启防火墙才会生效
(5)关闭防火墙端口:firewall-cmd --zone=public --remove-port=9200/tcp --permanent
CentOS6 防火墙
一、防火墙的开启、关闭、禁用、查看状态命令
[root@localhost ~]# cd ~ //注意:要进入到~目录 也就是家目录下才能查看防火墙
(1)启动防火墙:service iptables start
(2)关闭防火墙:service iptables stop
(3)设置开机启用防火墙:chkconfig iptables on
(4)设置开机禁用防火墙:chkconfig iptables off
(5)检查防火墙状态:service iptables status
二、添加需要放开的服务器端口
[root@localhost ~]# vi /etc/sysconfig/iptables
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT //比如我要添加80端口,其他端口只需要把80换成需要添加的端口就可以了
添加后重启防火墙:
[root@localhost ~]# service iptables start
以下为我的服务器的防火墙规则
[root@localhost ~]# vi /etc/sysconfig/iptables
# Firewall configuration written by system-config-firewall
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 60101 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 10050:10051 -j ACCEPT
-A INPUT -m state --state NEW -m udp -p udp --dport 10050:10051 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT
CentOS7防火墙firewalld 和 CentOS6防火墙iptables的一些配置命令的更多相关文章
- CentOS7 防火墙firewalld 和 CentOS6 防火墙iptables 开放zabbix-agent端口的方法
我们在生产环境中,一般都是把防火墙打开的,不像测试环境,可以直接关闭掉.最近安装zabbix ,由于公司服务器既有centos 7又有centos 6,遇到了一些防火墙的问题,现在正好把centos防 ...
- CentOS7使用firewalld打开关闭防火墙与端口(转载)
1.firewalld的基本使用 启动: systemctl start firewalld 查看状态: systemctl status firewalld 停止: systemctl disabl ...
- 关于学习CentOS7使用firewalld打开关闭防火墙和端口
1.firewalld简介 firewalld是centos7的一大特点,主要有两个优点:一是支持动态更新,不需要重启服务:二就是加入了防火墙的“zone”概念. firewalld有图形界面和工具界 ...
- CentOS7使用firewalld打开关闭防火墙与端口(转)
CentOS7使用firewalld打开关闭防火墙与端口 1.firewalld的基本使用 启动: systemctl start firewalld 关闭: systemctl stop ...
- 第一篇:动态防火墙firewalld和静态防火墙iptables
动态防火墙firewalld firewalld提供了一个动态管理的防火墙,它支持网络(network)/防火墙区域(firewall zones )来定义网络连接( network connecti ...
- 转 CentOS7使用firewalld打开关闭防火墙与端口
http://blog.csdn.net/huxu981598436/article/details/54864260 开启端口命令 输入firewall-cmd --query-port=6379/ ...
- CentOS7使用firewalld打开关闭防火墙与端口
1.firewalld的基本使用 启动: systemctl start firewalld 查看状态: systemctl status firewalld 停止: systemctl disab ...
- CentOS7 使用firewalld打开关闭防火墙与端口
1.firewalld的基本使用 启动: systemctl start firewalld 关闭: systemctl stop firewalld 查看状态: systemctl status f ...
- CentOS7 使用firewalld打开关闭防火墙以及端口
1.firewalld的基本使用 启动 systemctl start firewalld 关闭 systemctl stop firewalld 查看状态 systemctl status fire ...
随机推荐
- Linux的命令行基础
1.对于全局配置文件和用户配置文件的认识 全局配置都存储在etc目录下,如/etc/profile文件,/etc/bashrc文件以及/etc/profile.d/目录下的.sh文件 用户配置都存储在 ...
- 深入.NET框架与面向对象的回顾
.NET DOTNET DNET 点NET(.NET框架支持跨语言开发.如C#,VB .NET ,C++.NET,F# ,lronRuby,Others) 任何人,在任何地方,使用任何终端设备,都能访 ...
- pipeline groovy
目录 一.变量 一.变量 1.直接定义 def x="abc" 2.从脚本执行结果赋值变量 branch = "/jen_script/return-branch.sh ...
- Linux 文件权限、系统优化
目录 Linux 文件权限.系统优化 1.文件权限的详细操作 1.简介: 2.命令及归属: 3.权限对于用户和目录的意义 权限对于用户的意义: 权限对于目录的意义: 4.创建文件/文件夹的默认权限来源 ...
- Memcached 状态机分析
worker线程拿到了这个连接之后,就应该是分配给这个连接一个结构体,包括这个连接所有的状态,都写buf等,这个结构体就是conn,然后这个worker线程会在它自己的event_base加入对这个新 ...
- mrctf2020_shellcode_revenge(可见符shellcode)!!!!
第一次碰到这种题目,需要用可见符shellcode来做 题目我就不放了,我认为网上大佬会比我说的更加详细 [原创]纯字母shellcode揭秘-软件逆向-看雪论坛-安全社区|安全招聘|bbs.pedi ...
- [BUUCTF]PWN15——[BJDCTF 2nd]one_gadget
[BUUCTF]PWN15--[BJDCTF 2nd]one_gadget 附件 步骤: 例行检查,64位,保护全开 nc试运行一下程序,看看情况,它一开始给了我们一个地址,然后让我们输入one ga ...
- SourceTree Git可视化管理工具通过 ssh 密钥登录
整个流程分三步:① 生成SSH密钥:② Github/Gitee/Coding 代码托管平台绑定公钥:③ SourceTree 拉取代码 1.生成 SSH 密钥 这里直接使用 SourceTree 来 ...
- 主要视图展示(Project)
<Project2016 企业项目管理实践>张会斌 董方好 编著 有同学拿Excel做甘特图的(咳咳,我也做过),这行为,其实目的就是为了--消食-- 好吧,也是为了学习Excel中图表或 ...
- 【LeetCode】368. Largest Divisible Subset 解题报告(Python)
作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 题目地址:https://leetcode.com/problems/largest-d ...