我想通过squid代理重定向我的局域网网络中的流量,但我遇到了iptables
规则的一些问题。
当我使用以下规则时:
# iptables -I FORWARD -s 192.168.1.0/255.255.255.0 -p tcp --dport 80 -j DNAT --to-destination 192.168.1.196:3128
我收到以下错误:
x_tables: ip_tables: DNAT target: only valid in nat table, not filter
我尝试使用PREROUTING
链,但在我的iptables中没有这样的东西:
# iptables -I PREROUTING -s 192.168.1.0/255.255.255.0 -p tcp --dport 80 -j DNAT --to-destination 192.168.1.196:3128
iptables: No chain/target/match by that name.
我正在使用iptables版本v.1.4.10
答案 0 :(得分:0)
假设你的WAN在eth0上,而局域网在eth1上,而你的代理在8080端口上,你要找的是:
iptables A PREROUTING -i eth1 -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 8080