centos下设置iptables
来源:互联网 发布:vue.js 页面加载动画 编辑:程序博客网 时间:2024/06/02 09:11
Centos上配置防火墙,只需要把配置文件写入到/etc/sysconfig/iptables里即可,不需要输入额外的命令。当然,前提是你得安装上iptables。
1、安装iptables
yum install iptables
2、设置防火墙过滤规则
vi /etc/sysconfig/iptables
下面是一个现成的iptables配置文件,已经添加了pptpvpn穿透,可正常使用pptpvpn:
*filter# Allow loopback (lo0) traffic and drop all traffic to 127/8 that doesn't use the lo0 interface-A INPUT -i lo -j ACCEPT-A INPUT -i ! lo -d 127.0.0.0/8 -j REJECT# Accept established inbound connections-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT# Allow all outbound traffic-A OUTPUT -j ACCEPT# Allow HTTP and HTTPS connections-A INPUT -p tcp --dport 80 -j ACCEPT-A INPUT -p tcp --dport 443 -j ACCEPT# Allow SSH/SFTP# Change the value 22 if you are using a non-standard port-A INPUT -p tcp -m state --state NEW --dport 22 -j ACCEPT# Allow FTP# Purely optional, but required for WordPress to install its own plugins or update itself.-A INPUT -p tcp -m state --state NEW --dport 21 -j ACCEPT# Allow PING# Again, optional. Some disallow this altogether.-A INPUT -p icmp -m icmp --icmp-type 8 -j ACCEPT#Allow PPTP VPN-A INPUT -i eth0 -p tcp --dport 1723 -j ACCEPT-A INPUT -i eth0 -p gre -j ACCEPT-A FORWARD -i ppp+ -o eth0 -j ACCEPT-A FORWARD -i eth0 -o ppp+ -j ACCEPT# Reject ALL other inbound-A INPUT -j REJECT-A FORWARD -j REJECTCOMMIT
查看一下过滤规则是否已启用:
iptables -L
这样就完成了。VPS重启后,防火墙规则自动启用。不像debian里那样,必须添加启动命令才能启用防火墙规则。
- centos下设置iptables
- CentOS 设置 iptables
- centos iptables防火墙设置
- centos iptables 防火墙设置
- centos防火墙iptables设置
- CentOS 7.0 设置iptables防火墙
- CentOS下配置iptables防火墙
- CentOS下配置iptables防火墙
- CentOS下配置iptables防火墙
- CentOS下配置iptables防火墙
- CentOS下配置iptables防火墙
- CentOS下配置iptables防火墙
- CentOS下配置iptables防火墙
- CentOS下配置iptables防火墙
- CentOS下iptables的端口映射
- CentOS下配置iptables防火墙
- centos下Iptables学习记录
- CentOS下配置iptables防火墙
- 生成java在命令行下可执行的jar
- java中的多线程
- ubuntu12.04修复grub方法
- Makefile教程
- 双连通分量(DCC)
- centos下设置iptables
- hdu 1010 (DFS+剪枝)
- Rest风格的web服务开发-入门篇1
- 用例图、活动图和顺序图的关系
- 工作流三位一体的驱动方式- (表单)数据 状态 人工
- 黄生借书说
- 如何查找.NET程序内存不断上涨的原因(CLRProfiler)
- proxool详细配置
- 该刷一段时间的题了