我正在尝试将任何单个 IP 在最近 50 秒内连接到我的 Ubuntu 服务器的数量限制为不超过 10 个。我正尝试使用 iptables 来做到这一点。我之前从未配置或输入过任何 iptables 命令。命令失败如下:
# /sbin/iptables -I INPUT -p tcp --dport 80 -i venet0:0 -m state --state NEW -m recent --set
iptables: No chain/target/match by that name.
# /sbin/iptables -I INPUT -p tcp --dport 80 -i venet0:0 -m state --state NEW -m recent --update --seconds 50 --hitcount 10 -j "DROP"
iptables: No chain/target/match by that name.
venet0:0 确实是一个接口:
# ifconfig | head -20
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:160410 errors:0 dropped:0 overruns:0 frame:0
TX packets:160410 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:10303872 (10.3 MB) TX bytes:10303872 (10.3 MB)
venet0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
inet addr:127.0.0.2 P-t-P:127.0.0.2 Bcast:0.0.0.0 Mask:255.255.255.255
UP BROADCAST POINTOPOINT RUNNING NOARP MTU:1500 Metric:1
RX packets:63699988 errors:0 dropped:0 overruns:0 frame:0
TX packets:44836148 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:61862863168 (61.8 GB) TX bytes:4519224195 (4.5 GB)
venet0:0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
inet addr:*.*.*.* P-t-P:*.*.*.* Bcast:0.0.0.0 Mask:255.255.255.255
UP BROADCAST POINTOPOINT RUNNING NOARP MTU:1500 Metric:1
答案1
请使用这种格式,假设。。。是 venet0:0 的 IP 地址
-i venet0 -d *.*.*.*