关键词:
- 清除所有规则:
iptables -F
- 开放常用tcp端口:
iptables -I INPUT -p tcp -m multiport --dports 20,21,22,3690,80,443,4443,8023,8888,25,110,30000:30999 -j ACCEPT iptables -I OUTPUT -p tcp -m multiport --sports 20,21,22,3690,80,443,4443,8023,8888,25,110,30000:30999 -j ACCEPT
- 开放常用udp端口:
iptables -I INPUT -p udp -m multiport --dports 53,123,8571,8888 -j ACCEPT iptables -I OUTPUT -p udp -m multiport --sports 53,123,8571,8888 -j ACCEPT
- 开放特殊udp端口(如:dns):
iptables -I INPUT -p udp --sport 53 -j ACCEPT iptables -I OUTPUT -p udp --dport 53 -j ACCEPT
- 开放vrrp协议:
iptables -I INPUT -p vrrp -j ACCEPT
- 允许服务器互ping:
iptables -A OUTPUT -p icmp -j ACCEPT iptables -A INPUT -p icmp -j ACCEPT
- 允许握手成功的数据通过:
iptables -I INPUT -p tcp -m state --state RELATED,ESTABLISHED -j ACCEPT iptables -I OUTPUT -p tcp -m state --state RELATED,ESTABLISHED -j ACCEPT
- 设置默认关闭所有端口:
iptables -P FORWARD DROP iptables -P OUTPUT ACCEPT iptables -P INPUT DROP
- 防syn***:
iptables -N syn-flood iptables -A INPUT -p tcp --syn -j syn-flood iptables -I syn-flood -p tcp -m limit --limit 3/s --limit-burst 6 -j RETURN iptables -A syn-flood -j REJECT
- 防ddos***:
iptables -A INPUT -i eth0 -p tcp --syn -m connlimit --connlimit-above 15 -j DROP iptables -A INPUT -p tcp -m state --state ESTABLISHED,RELATED -j ACCEPT iptables -A INPUT -p tcp --syn -m limit --limit 12/s --limit-burst 24 -j ACCEPT iptables -A FORWARD -p tcp --syn -m limit --limit 1/s -j ACCEPT
- 防cc***:
iptables -I INPUT -p tcp --dport 80 -m connlimit --connlimit-above 50 -j REJECT # 允许单个IP的最大连接数为30 iptables -A INPUT -p tcp --dport 80 -m recent --name BAD_HTTP_ACCESS --update --seconds 60 --hitcount 30 -j REJECT iptables -A INPUT -p tcp --dport 80 -m recent --name BAD_HTTP_ACCESS --set -j ACCEPT #单个IP在60秒内只允许最多新建30个连接
- 保存:
iptables-save > /etc/sysconfig/iptables
centos7开放端口
...效,没有此参数重启后失效刚修改完的端口需要重新加载防火墙才生效至此,开放端口已经完成了。检查防火墙状态关闭防火墙开启防火墙设置开机启动防火墙设置禁止开机启用防火墙 查看详情
centos7开放3306端口访问
CentOS7.0默认使用的是firewall作为防火墙,这里改为iptables防火墙。1、关闭firewall:systemctlstopfirewalld.servicesystemctldisablefirewalld.servicesystemctlmaskfirewalld.service 2、安装iptables防火墙yuminstalliptables-services- 查看详情
centos7开放3306端口访问
CentOS7.0默认使用的是firewall作为防火墙,这里改为iptables防火墙。1、关闭firewall:systemctlstopfirewalld.servicesystemctldisablefirewalld.servicesystemctlmaskfirewalld.service2、安装iptables防火墙yuminstalliptables-services-y3.启动设 查看详情
centos7开放防火墙端口命令
CentOS7开放防火墙端口 命令 最近公司新的server要求用CentOS7,发现以前CentOS6系列中的iptables相关命令不能用了,查了下,发现Centos7使用firewalld代替了原来的iptables。使用方法如下:>>>关闭防火墙syst... 查看详情
centos7开放防火墙端口命令(转载)
CentOS7开放防火墙端口 命令 最近公司新的server要求用CentOS7,发现以前CentOS6系列中的iptables相关命令不能用了,查了下,发现Centos7使用firewalld代替了原来的iptables。使用方法如下:>>>关闭防火墙syst... 查看详情
centos7防火墙开放端口等命令
CentOS7开放防火墙端口 命令 最近公司新的server要求用CentOS7,发现以前CentOS6系列中的iptables相关命令不能用了,查了下,发现Centos7使用firewalld代替了原来的iptables。使用方法如下:>>>关闭防火墙syst... 查看详情
centos7通过firewall开放防火墙端口
...没效果(或者是sodino没找到正确的命令,传说Centos7下默认的防火墙是Firewall,替代了之前的iptables)…使用firewall-cmd开放端口则立即就生效了。见下操作: 1234567firewall-cmd--state//查看运行状态 //开放1024的端口firewall-cmd--add-port=1 查看详情
centos7防火墙快速开放端口配置方法(代码片段)
▲这篇文章主要为大家详细介绍了Centos7防火墙开放端口的快速方法,感兴趣的小伙伴们可以参考一下!一、CentOS7快速开放端口:CentOS升级到7之后,发现无法使用iptables控制Linuxs的端口,baidu之后发现Centos7使用firewalld代替了原来的... 查看详情
centos7上开放端口
...没效果(或者是sodino没找到正确的命令,传说Centos7下默认的防火墙是Firewall,替代了之前的iptables)…使用firewall-cmd开放端口则立即就生效了。见下操作: 1234567firewall-cmd--state//查看运行状态 //开放1024的端口firewall-cmd--add-port=1 查看详情
centos7.3下开放防火墙的端口(代码片段)
CentOS7.3默认使用的是firewall作为防火墙,这里改为iptables防火墙。1:关闭firewall:systemctlstopfirewalld.servicesystemctldisablefirewalld.servicesystemctlmaskfirewalld.service2、安装iptables防火墙yuminstalliptables-services-y3.启动设 查看详情
centos7安装iptables防火墙(代码片段)
CentOS7默认的防火墙不是iptables,而是firewalle.安装iptableiptable-service#先检查是否安装了iptablesserviceiptablesstatus#安装iptablesyuminstall-yiptables#升级iptablesyumupdateiptables#安装iptables-servicesyuminstalliptables-services禁用/停止自带的firewalld服务#停止... 查看详情
linux:centos7防火墙开放端口操作(代码片段)
...ld代替了原来的iptables。 但是在CentOS7中也可以iptables控制防火墙,只不过需要安装iptables模块,具体做法请参考:Linux:CentOS7下配置iptables一、系统命令firewalld的基本使用systemctlstartfirewalld#启动systemctlstopfirewalld#关... 查看详情
centos6与centos7防火墙设置与端口开放的方法
Centos升级到7之后,内置的防火墙已经从iptables变成了firewalld。所以,端口的开启还是要从两种情况来说明的,即iptables和firewalld。更多关于CentOs防火墙的最新内容,请参考Redhat官网。一、iptables1.打开/关闭/重启防火墙 开启防... 查看详情
centos7开放防火墙端口
...,以上是我的操作,修改后访问成功 CentOS7开放防火墙端口 命令 最近公司新的server要求用CentOS7,发现以前CentOS6系列中的iptables相关命令不能用了,查了下,发现Centos7使用fir 查看详情
centos7防火墙快速开放端口配置方法(代码片段)
...号80是否开启:[root@centos7~]#firewall-cmd--query-port=80/tcp重启防火墙:[root@centos7~]#firewall-cmd--reload查询有哪些端口是开启的:[root@centos7~]#firewall-cmd--list-port命令含义:--zone#作用域--add-port=80/tcp#添加端口,格式为:端口/通讯协议--permanent... 查看详情
centos7开放防火墙端口命令
Centos7使用firewalld代替了原来的iptables,使用方法如下:>>>关闭防火墙systemctlstopfirewalld.service #停止firewallsystemctldisablefirewalld.service #禁止firewa 查看详情
linuxcentos7通过firewall开放防火墙端口
...没效果(或者是sodino没找到正确的命令,传说Centos7下默认的防火墙是Firewall,替代了之前的iptables)…使用firewall-cmd开放端口则立即就生效了。见下操作:1234567firewall-cmd--state//查看运行状态//开放1024的端口firewall-cmd--add-port 查看详情
centos7设置开放端口以及常用的命令记录
CentOS7与以前常用的CentOS6还是有一些不同之处的,比如在设置开放端口的时候稍许有些不同,常用的iptables命令已经被firewalld代替。这几天正好有在CentOS7系统中玩Seafile自建网盘,默认的时候是没有开启8082端口的,然后看到CentOS7... 查看详情