Link to home
Start Free TrialLog in
Avatar of hacktek
hacktek

asked on

Using iptables to route traffic through a proxy

Hey guys. I'm wondering if it's possible to route a specific address in my network through a proxy directly on the router. I need this because the device does not support entry of a proxy server to connect to the net and i want to anonymise it.

How would i go about doing that? I have been experimenting but haven't been able to. The proxy would be outside of my network and i need the rule to affect only one IP address in my network, on port 3074 udp.

Any ideas are appreciated! Thanks a lot!
Avatar of chuckyh
chuckyh
Flag of United States of America image

Maybe you should describe what you are trying to do so we can get a bigger picture. What kind of router is this?
Avatar of hacktek
hacktek

ASKER

Sorry about that, i should have specified that since not all routers are equal. I have a Linksys WRT54G v4 running HyperWRT, which has a telnet mode on which i can access the modem's shell. From here i can manipulate iptables in the same fashion one would do on a linux workstation or server. Basically i want to route traffic from a certain device in my network and on a certain port (192.168.1.115:3074) through a transparent proxy, which could be on my own network or outside of it.
Avatar of hacktek

ASKER

Wow this can't be THAT hard that nobody has an answer =/
Port 3074 is that the source port of the traffic or the destination port on the proxy? (Web traffic is

Do you know what the interface names on that router (I can't remember what they are - could be wan0 lan0 ... maybe)?
Avatar of hacktek

ASKER

Port 3074 is the source of the traffic and the interface would be br0. The destination port of the proxy would most likely be 3128 or something along those lines, although that's not all that important for now. :)
ASKER CERTIFIED SOLUTION
Avatar of gb-sdc
gb-sdc

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of hacktek

ASKER

Thx! A couple more questions though:

1- The source ip address for the prerouting rule is the device's internal ip address or the public ip the router uses?

2- Is it possible that i can route the packets from one protocol to another (or is it possible to set up a proxy that accepts connections on an udp port?

Thanks a lot, the points are almost yours :P
Avatar of hacktek

ASKER

I ask the second question because the protocol of port 3074 is udp and the proxy i set up (Tor) listens on 8118 tcp.
1 = internal ip of the device that you want to redirect to the proxy
2 = I don't think so. The proxy needs to be able to handle UDP traffic.
Avatar of hacktek

ASKER

Thank you! You've been a great help! :)
Avatar of hacktek

ASKER

By the way, z.z.z.z would be the router's ip address right? (192.168.1.1)
Yup, that's the one.