iptables 怎么限制一个端口只能一个 ip 连接 求解 网上找了很多都是限制连接数的 不是限制 ip 的 想一个端口就只能一个 ip 连接
|
kimwOct 21, 2015
1
iptables -I INPUT -s IP_ADDRESS -j ACCEPT
iptables -A INPUT -j DROP --reject-with icmp-port-unreachable |
|
kimwOct 21, 2015
2
上面一个不算不算。重来。
iptables -I INPUT -s IP_ADDRESS -p all --dport PORT -j ACCEPT # please fill up the IP_ADDRESS and PORT iptables -A INPUT -j DROP --reject-with icmp-port-unreachable |
|
kimwOct 22, 2015
4
> @kimw 怎么限制一段端口比如 20000-30000 的端口只能一个 ip 连接
iptables -I INPUT -s IP_ADDRESS -p all --dport PORT1:PORT2 -j ACCEPT # please fill up the IP_ADDRESS, PORT1 and PORT2 iptables -A INPUT -j REJECT --reject-with icmp-port-unreachable PORT1-PORT2 就是范围。 另, 1L 、 2L 的最后一行的 -j DROP 应该是 -j REJECT 。之前有笔误。 |