I want to setup my OSX system such that all network traffic is done through an SSH tunnel.
I've written a small script for this purpose, and these are the commands executed by it:
# setup tunnel
ssh -fN -D 1080 -p 22 user@remote
start up redsocks
sudo redsocks -c /tmp/redsocks.conf -p /tmp/redsocks.pid
forward all tcp traffic to tunnel
sudo ipfw add 0010
fwd 127.0.0.1,12345
tcp from me
to any not dst-port 12345
not dst-port 1080
not dst-ip REMOTE_IP
I use redsocks to create an http proxy to my ssh-tunnel (so that i can forward all tcp traffic to it via ipfw), redsocks.conf looks like this:
base {
log_debug = on;
log_info = on;
log = "file:/tmp/redsocks.log";
redirector = generic;
}
redsocks {
local_ip = 127.0.0.1;
local_port = 55660;
ip = 127.0.0.1;
port = 1080;
type = socks4;
}
Everything seems to work so far, all TCP traffic on my OSX system is done through the ssh tunnel, but the problem is with UDP traffic and because of that DNS queries are not working.
How can I get DNS on my local machine to work through the SSH tunnel?