ipables常用命令

//命令结构
iptables -t TABLE - 操作方式 规则条件
示例:
1.1列出filter表所有内容:
iptables -t filter -L  红色框内为默认路由,及无法匹配到任何一条规则时采用的策略

1.2列出filter表INPUT链内容:
iptables -t filter -L INPUT

1.3 清除filter表所有内容
iptables -t filter -F

1.4 将规则添加到filter表的input链中
iptables -t filter -A INPUT -p ICMP -j ACCEPT

 

1.5 将forword链的默认策略设置为DROP
iptables -t filter -P FORWORD DROP

1.6 在INPUT链中插入新规则
iptables -t filter -I INPUT 2 -p tcp -j ACCEPT

 

注意:在-L参数后面加上-line-number 会显示行号

 

1.7 取代INPUT链已经存在的规则

iptables -t filter -R INPUT 2 -p icmp -j ACCEPT

 

1.8 删除INPUT链中已经存在的规则

iptables -t filter -D INPUT 2

 

 2 nat表的操作

 

 

 

3 mangle表的操作

 

 

 

 

 

 3 raw表的操作

 

 

 

posted @ 2020-08-25 20:23  Anita光子  阅读(198)  评论(0编辑  收藏  举报