iptables可以丢弃stream量,但不能redirect
假设TCP数据包被发送到目的ip(dest_ip)并且可以通过以下命令被丢弃: iptables -A INPUT -d dest_ip -p tcp -j DROP 但是,当我尝试使用iptables NAT将数据包redirect到不同的ip(diff_ip)时,数据包仍旧到达旧目标(dest_ip): iptables -t nat -A PREROUTING -d dest_ip -p tcp -j DNAT –to-destination diff_ip 有一些iptables,我不太明白在这里,因为我期待数据包不能再达到dest_ip。 有人能解释为什么这样吗? 谢谢。 可能相关的其他信息: / proc / sys / net / ipv4 / ip_forward已经设置为1 ifconfig显示两个接口:eth0和lo; dest_ip在eth0上,diff_ip是远程ip 更新1:使用telnet进一步testing 在12800上build立一个使用socat的监听器来接收telnet消息: socat -u TCP-LISTEN:12800,reuseaddr,keepalive,reuseaddr OPEN:/tmp/output.txt,creat,append Telnet连接使用随机消息进行: telnet 127.0.0.1 12800 1)testing使用: iptables -A INPUT […]