iptables

                                                 基本使用

iptables -L # 查看当前rules
iptabels -F # 清除当前rules
service iptables save 保存规则

service iptables status #看iptables当前状态
systemctl start iptables #iptable 开启
systemctl stop iptables #iptable 关闭


-s 是来源
-d 是目标
INPUT 是入网口
OUTPUT 是出网口
使用-p指定端口类型,
--dport	指目标端口号
--sport	指来源端口号

127.0.0.1 是本机内网ip
0.0.0.0/0 是所有网络


iptables -nvxL   #看流量
iptabels -Z        #将流量统计信息清零

iptables -I INPUT -s 52.175.21.71      #统计 《ip:52.175.21.71》发来的流量:--在入网口检测
iptables -I OUTPUT -d 52.175.21.71  #统计 发向《ip:52.175.21.71》的流量: --在出网口检测




iptables -I INPUT -s 192.168.0.10 -p tcp --dport 22   #统计ip为192.168.0.10入网流量(仅tcp 22)

限制流量(输入禁)
iptables -A INPUT -p udp --dport 1194 -m limit --limit 60/s -j ACCEPT
iptables -A INPUT -p udp --dport 1194 -j DROP

输出禁
iptables -A OUTPUT -p udp --sport 1194 -m limit --limit 60/s -j ACCEPT
iptables -A OUTPUT -p udp --sport 1194 -j DROP

限制连接数
iptables INPUT -p tcp --dport 8388 -m connlimit --connlimit-above 5 -j DROP
iptables -I OUTPUT -p tcp --sport 8388 -m connlimit --connlimit-above 5 -j DROP

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值