iptables命令示例


查看当前的iptables规则

命令:iptables -vnL

[root@centos ~]# iptables -vnL
Chain INPUT (policy ACCEPT 4629K packets, 1620M bytes)
 pkts bytes target     prot opt in     out     source               destination         
    0     0 DROP       tcp  --  *      *       172.16.0.0/16        172.16.100.10        multiport dports 20,22,80
    0     0 DROP       tcp  --  *      *       0.0.0.0/0            172.16.100.10        tcp dpt:80 source IP range 172.16.100.5-172.16.100.10
    0     0 DROP       all  --  *      *       0.0.0.0/0            172.16.100.10        source IP range 172.16.100.5-172.16.100.10
    0     0 ACCEPT     all  --  *      *       172.16.0.100         0.0.0.0/0            MAC 00:50:56:12:34:56
    0     0 REJECT     all  --  *      *       172.16.0.100         0.0.0.0/0            reject-with icmp-port-unreachable
    0     0 DROP       all  --  *      *       172.16.0.0/16        172.16.100.10        TIME from 23:00:00 to 23:59:59 on Sat,Sun UTC
    0     0 DROP       all  --  *      *       0.0.0.0/0            0.0.0.0/0            TIME from 23:00:00 to 23:59:59 on Sat,Sun UTC

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination         

Chain OUTPUT (policy ACCEPT 420 packets, 37668 bytes)
 pkts bytes target     prot opt in     out     source               destination        
相关字段 含义
pkts 发送的包数量
bytes 发送的包总共的大小
target 目标,即想要效果是drop还是accept或者其他
prot 协议
in 进来通过哪个网卡
out 出去通过哪个网卡
source 源ip地址
destination 目的ip地址

快速清除所有的iptables规则

命令:iptables -F
通过命令先清除所有的iptables规则限制

[root@centos ~]# iptables -F
[root@centos ~]# iptables -vnL
Chain INPUT (policy ACCEPT 2567 packets, 890K bytes)
 pkts bytes target     prot opt in     out     source               destination         
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值