一、命令
- 查看某表中的规则:iptables  --line-number  -t  表名  -nL
- 添加新的入站规则:iptables  -A  INPUT  -s  ip地址  -p  协议  --dport  端口  -j  处理方式
- 替换规则:iptables  -R  INPUT  编号  -s  ip地址  -p  协议  --dport  端口  -j  处理方式
- 删除规则:iptables  -D  INPUT  编号
- 修改默认规则:iptables  -t  表名  -P  INPUT  处理方式
- 允许路由转发(由内向外):iptables  -t  nat  -A  POSTROUTING  -s  内网ip/网段  -j  SNAT  --to-source  外网ip
- 允许路由转发(由外向内):iptables  -t  nat  -A  POSTROUTING  -d  外网ip  -p  协议  -dport  端口  -j  DNAT  --to-destination  内网ip/网段
- 限制每秒钟接受到的数据包的个数(防止垃圾攻击):iptables  -I  INPUT  -m  limit  --limit  个数/sec  -j  ACCEPT
- 拒绝新的连接请求:iptables  -A  INPUT  -m  state  --state  NEW  -j  DROP
 二、备份:iptables-save  >  文件
 三、还原:iptables-restore  <  文件
 四、常用的文件:
- 查看系统中标准的端口信息:/etc/services
  
- 开启路由转发的文件:/etc/sysctl.conf
  
iptables 常用命令
原文:http://blog.51cto.com/12173069/2060597