首页 技术 正文
技术 2022年11月7日
0 收藏 905 点赞 1,071 浏览 1056 个字

#检查服务器是否安装了iptablessystemctl status iptables.service#安装iptablesyum install -y iptables#更新iptablesyum update iptables#安装iptables服务yum install iptables-services#停止firewalld防火墙服务systemctl stop firewalld#禁用firewalld防火墙服务systemctl mask firewalld#再次检查iptablessystemctl status iptables.service#查看iptables现有规则iptables -L -n#先允许所有的端口iptables -P INPUT ACCEPT#清空所有的默认规则iptables -F#清空所有的自定义规则iptables -X#所有的计数器归0iptables -Z#允许来自于lo接口的数据包(本地访问)iptables -A INPUT -i lo -j ACCEPT#开放22端口iptables -A INPUT -p tcp –dport 22 -j ACCEPT#开放21端口(FTP)iptables -A INPUT -p tcp –dport 21 -j ACCEPT#开放80端口(HTTP)iptables -A INPUT -p tcp –dport 80 -j ACCEPT#开放443端口(HTTPS)iptables -A INPUT -p tcp –dport 443 -j ACCEPT#允许pingiptables -A INPUT -p icmp –icmp-type 8 -j ACCEPT#允许接受本机请求之后的返回数据 RELATED,是为FTP设置的iptables -A INPUT -m state –state RELATED, ESTABLISHED -j ACCEPT#其他入站一律丢弃iptables -P INPUT DROP#所有出站一律放行iptables -P OUTPUT ACCEPT#所有转发一律丢弃iptables -P FORWARD DROP#保存service iptables save#注册iptables服务systemctl enable iptables.service#开启服务systemctl start iptables.service#查看状态systemctl status iptables.service 文章参考:

http://blog.csdn.net/l1028386804/article/details/50779761

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,086
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,561
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,410
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,183
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,820
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,903