-1

I want to redirect the traffic in my lan network through squid proxy but I am having some problems with iptables rules.

When I use the following rule:

# 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

I get the following error:

x_tables: ip_tables: DNAT target: only valid in nat table, not filter

I have tried using PREROUTING chain but there is nothing like this in my 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.

I am using iptables version v.1.4.10

Patryk
  • 22,602
  • 44
  • 128
  • 244

1 Answers1

0

Assuming that your WAN is on eth0 and LAN is on eth1 and that your proxy is on port 8080, what you're looking for is this:

iptables A PREROUTING -i eth1 -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 8080

George
  • 449
  • 3
  • 10