Forward all traffic through an ssh tunnel
Posted
by
Eamorr
on Server Fault
See other posts from Server Fault
or by Eamorr
Published on 2011-07-01T13:00:47Z
Indexed on
2011/07/01
16:23 UTC
Read the original article
Hit count: 506
I hope someone can follow this and I'll explain as best I can.
I'm trying to forward all traffic from port 6999 on x.x.x.224, through an ssh tunnel, and onto port 7000 on x.x.x.218.
Here is some ASCII art:
|browser|-----|Squid on x.x.x.224|------|ssh tunnel|------<satellite link>-----|Squid on x.x.x.218|-----|www|
3128 6999 7000 80
When I remove the ssh tunnel, everything works fine.
The idea is to turn off encryption on the ssh tunnel (to save bandwidth) and turn on maximum compression (to save more bandwidth). This is because it's a satellite link.
Here's the ssh tunnel I've been using:
ssh -C -f -C -o CompressionLevel=9 -o Cipher=none [email protected] -L 7000:172.16.1.224:6999 -N
The trouble is, I don't know how to get data from Squid on x.x.x.224 into the ssh tunnel? Am I going about this the wrong way? Should I create an ssh tunnel on x.x.x.218? I use iptables to stop squid on x.x.x.224 from reading port 80, but to feed from port 6999 instead (i.e. via the ssh tunnel). Do I need another iptables rule?
Any comments greatly appreciated.
Many thanks in advance,
© Server Fault or respective owner