Linux iptables 设置
来源:互联网 发布:厦门广电网络4k机顶盒 编辑:程序博客网 时间:2024/05/16 18:26
编辑 /etc/sysconfig/iptables
然后运行 /sbin/service iptables restart
防火墙规则只有在 iptables 服务运行的时候才能被激活。要手工启动服务,使用以下命令:
/sbin/service iptables restart
要确保它在系统引导时启动,使用以下命令:
/sbin/chkconfig --level 345 iptables on
ipchains 服务不能和 iptables 服务同时运行。要确定ipchains 服务被禁用,执行以下命令:
/sbin/chkconfig --level 345 ipchains off
以下是比较常见的防火墙规则:iptables -F#删除已经存在的规则iptables -P INPUT DROP#配置默认的拒绝规则。基本规则是:先拒绝所有的服务,然后根据需要再添加新的规则。iptables -A INPUT -p tcp --dport 80 -j ACCEPT #打开WEB服务端口的tcp协议iptables -A INPUT -p tcp --dport 110 -j ACCEPT #打开POP3服务端口的tcp协议iptables -A INPUT -p tcp --dport 25 -j ACCEPT #打开SMTP服务端口的tcp协议iptables -A INPUT -p tcp --dport 21 -j ACCEPT#打开FTP服务端口的tcp协议iptables -A INPUT -p tcp -s 202.106.12.130 --dport 22 -j ACCEPT#允许IP地址为202.106.12.130这台主机连接本地的SSH服务端口iptables -A INPUT -p tcp --dport 53 -j ACCEPT#允许DNS服务端口的tcp数据包流入iptables -A INPUT -p udp --dport 53 -j ACCEPT#允许DNS服务端口的udp数据包流入iptables -A INPUT -p icmp -icmp-type echo-request -i eth1 -j DROP#防止死亡之ping,从接口eth1进入的icmp协议的请求全部丢弃。iptables -A FORWARD -p tcp --syn -m limit --limit 1/s -j ACCEPT#防止SYN Flood (拒绝服务攻击)根据服务器情况,你也可以自行添加规则。
iptables -I RH-Firewall-1-INPUT 20 -p TCP -s 211.161.250.232/32 -m state --state NEW --dport 3306 -j ACCEPT
iptables -I RH-Firewall-1-INPUT 20 -p TCP -s 211.161.192.0/24 -m state --state NEW --dport 3306 -j ACCEPT
- Linux iptables 设置
- linux-iptables设置NAT
- Linux iptables 设置
- Linux iptables 设置
- Linux VPS iptables 设置
- linux iptables 设置详解
- linux iptables 防火墙设置
- linux iptables端口映射设置
- linux IPTABLES 设置
- linux iptables 防火墙 设置
- linux iptables端口映射设置
- 【Linux】防火墙iptables设置
- linux iptables设置
- linux防火墙iptables设置
- Linux 下iptables 防火墙设置
- linux 防火墙 iptables 设置 (系统管理员)
- linux下IPTABLES设置详解
- linux下iptables防火墙设置
- 2013 暑假多校训练 3 总结
- php中is_null,empty,isset,unset 的区别详细介绍
- Android 智能指针
- 使用Tomcat+geoserver+openlayers建立GIS网站过程
- Android监听应用程序安装和卸载
- Linux iptables 设置
- 基于lmbench的loongson1B 系统性能测试
- Win 2008 R2 和 Win2003 SP2 自带FTP 的 设置技巧
- WCF之各种WCF引用方式
- 安装iptables防火墙
- ANDROID的 BLUETOOTH 实现机制--中介模式和代理模式 .
- 书评《DB2数据库性能调整和优化(第2版)》
- Win7环境下VS2010配置Cocos2d-x-2.1.4最新版本的开发环境
- B. Burning Midnight Oil