- 1
- 0
- 约6.69千字
- 约 30页
- 2017-06-27 发布于湖北
- 举报
iptables命令参数 iptables命令参数: -p [!]protocol 指定协议 -s [!]address [/mask] 指定源IP地址 -d [!]address [/mask] 指定目标IP地址 -j target 指定跳转目标(动作/自定义规则链) -i [!] name 指定进接口 -o [!] name 指定出接口 --sport port 指定源端口 --dport port 指定目标端口 --sports port[,port[,port...]] 指定多个源端口 --dports port[,port[,port...]] 指定多个目录端口 --ports port[,port[,port...]] 指定多个双向端口 --icmp-type [!] typename 指定icmp类型 --mac-source [!] address 指定源MAC地址 --tcp-flags [!] mask comp 指定TCP协议标志 … iptables命令的使用(一) 查看规则表的内容 基本语法: iptables [-t table] -L [chain] [options] 不指定表名称时查看filter表的内容 #iptables -L 查看指定的规则表 #iptables -t filter -L #iptables -t nat -L #iptables -t mangle -L iptables命令的使用(二) 清空表中的规则 命令格式: iptables [-t table] -F [chain] [options] 清空filter表中的所有规则 # iptables -F 清空指定表中的所有规则 #iptables -t filter -F #iptables -t nat -F #iptables -t mangle -F iptables命令的使用(三) 删除表中的自定义规则链 命令格式: iptables [-t table] -X [chain] 删除filter表中的规则链 #iptables -X 删除指定表中的规则链 #iptables -t filter -X #iptables -t nat -X #iptables -t mangle -X iptables命令的使用(四) 设置默认规则: #iptables -t filter -P INPUT DROP #iptables -t filter -P FORWARD ACCEPT #iptables -t filter -P OUTPUT ACCEPT #iptables -t nat -P PREROUTING ACCEPT … #iptables -t mangle -P PREROUTING ACCEPT … 只有内建规则链才能够设置“缺省策略” 将filter表的INPUT缺省策略设置为“DROP”,比较严谨 数据包的过滤由上至下进行 前允许后拒绝 两条规则都有效 前拒绝后允许 后条规则无效 iptables命令的使用(五) 添加规则: 命令格式: iptables [-t table] -A chain rule-specification [options] 在INPUT规则链中添加规则,允许来自“lo”网络接口中所有数据包 # iptables -A INPUT -i lo -j ACCEPT 在INPUT规则链中添加规则,允许“eth0”网络接口中来自“/24”子网的所有数据包 # iptables -A INPUT -i eth0 -s /24 -j ACCEPT iptables命令的使用(六) 删除规则: 命令格式: iptables [-t table] -D chain rule-specification [options] 删除规则的iptables命令与添加规则的命令格式类似 删除INPUT规则表中已有的规则 # iptables -D INPUT -i eth0 -s /24 -j ACCEPT 实例2-1 # iptables -F # iptables -X # iptables -Z # iptables -P INPUT DROP # iptables -A INPUT -i lo -j ACCEPT # iptables -A INPUT -i eth0 -p tcp --dport 22 -j ACCEPT # iptables -A INPUT -i eth0 -p tcp --dport 80 -j ACCEPT # iptables -A IN
您可能关注的文档
- 甘肃省临夏中学高三《世界近现代史》下册检测试题教案.doc
- 电脑串口和并口USB连接线缆VGA 高清线大全.doc
- 第六章 信息技术复习要点.doc
- Science与Nature杂志介绍.doc
- 南开17春秋学期《当今饭店业》在线作业资料.doc
- 如何将光盘刻录到新的光盘里.doc
- 第六章 新课标物理选修3-2目录.ppt
- 电脑点歌系统组建方案要领.doc
- 格式化工作表公开课教案教案.doc
- 化学必修第一轮复习_第13讲_化学键(含答案)概论.doc
- 2025-2026学年天津市和平区高三(上)期末数学试卷(含解析).pdf
- 2025-2026学年云南省楚雄州高三(上)期末数学试卷(含答案).pdf
- 2025-2026学年甘肃省天水市张家川实验中学高三(上)期末数学试卷(含答案).docx
- 2025-2026学年福建省厦门市松柏中学高二(上)期末数学试卷(含答案).docx
- 2025-2026学年广西钦州市高一(上)期末物理试卷(含答案).docx
- 2025-2026学年河北省邯郸市临漳县九年级(上)期末化学试卷(含答案).docx
- 2025-2026学年河北省石家庄二十三中七年级(上)期末历史试卷(含答案).docx
- 2025-2026学年海南省五指山市九年级(上)期末化学试卷(含答案).docx
- 2025-2026学年河北省唐山市玉田县九年级(上)期末化学试卷(含答案).docx
- 2025-2026学年河北省邢台市市区九年级(上)期末化学试卷(含答案).docx
最近下载
- 高等学校中医临床教学基地教学工作水平评估指标体系与标准.pdf
- 2022届高考物理一轮复习图像经典100题.pdf VIP
- 新能源汽车电气技术 配套课件.pptx
- 2025年高考语文备考之300个文言实词汇编(含课内句子).pdf VIP
- DB11∕T2293-2024住宅工程质量品质提升技术标准.pdf VIP
- Marantz马兰士家庭影院 AV 擴音機 SR8012 SR8012 Quick Start Guide English说明书用户手册.pdf
- 人教八上:专题六 无刻度直尺作图(含解析).docx VIP
- 2023年江西省中考语文试卷及答案解析.pdf VIP
- 2025年山东劳动职业技术学院高职单招笔试语文试题库含答案解析(5套共100道单选合辑).docx VIP
- 2025-2026学年七年级英语春季开学第一课 课件:马踏新春,趣学英语(全国通用版).pptx
原创力文档

文档评论(0)