您的位置:首页 > 运维架构 > Linux

linux基础之iptables

2015-05-04 09:52 375 查看
Linux iptables相关:
iptables用法
iptables [-ttable] command chain(链) [cretiria(匹配标准)] –jaction
-t [raw,mangle,net ,filter]
Command: 对链,或者对链中的规则进行管理操作
链中规则:
-A 添加一条规则
-I # 在第几条规则后插入一条规则
-R # 修改第几条规则
-D # 删除第几条规则
链:
-N 增加
-X 删除空链
-E 重命名一条自定义链
-F 清空指定链,如果不指定,则清空表中所有链
-P 设定链的默认策略
-Z 置零(每条规则,包括默认策略,都有两个计数器,一个是被本规则匹配到的所有数据包的个数,另一个是被本规则匹配到的数据包的大小之和)
-L 查看
-v 详细信息
-n 数字标准
iptables对应服务脚本:/etc/rc.d/init.d/iptables
服务脚本配置文件:/etc/rc.d/init.d/iptables-config
规则保存位置:/etc/sysconfig/iptables
匹配标准:
基本匹配 -s 源地址 -d 目标地址 -p [icmp|tcp|udp] 协议 -i 进来网络接口 -o 出去网络接口扩展匹配隐式扩展 -p tcp --sportport [port2] --dportport [port2] -p udp --sport --dport -p icmp --icmp-type 0:响应 8:请求显式扩展(/lib/iptables) netfilter扩展模块引入的扩展,用于扩展匹配条件,通常需要额外选项来定义 -m 指定模块 -m state 用于实现链接的状态检测 --state -mmultiport --source-ports 源端口 --destination-ports 目标端口 --ports -m limit --limit 3/min --limit-burst 30 -mconnlimit --connlimit-above n 连接上限n -m iprange --src-range ip-ip 一段范围ip --dst-range ip-ip -m string --algo --stringAction: ACCEPT DROP REJECT REDIRECT DNET SNET MASQUERADE LOG RETURN
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  linux iptables