First, I'm not a computer expert, I know a bit about networking and its stuff. I'm just an average computer user. So here's the question, I set up an ssh tunnel on my Linux machine with the following command:

 ssh -o "ProxyCommand /usr/bin/corkscrew 3339 SERVERIP 443"

How can I redirect all my internet traffic through that ssh tunnel? so that when I'm browsing google / facebook or any other sites my IP will be detected as SEVERIP instead of my real IP address ? It's different from connecting with openvpn where you can just connect to your openvpn account and you're good to go, with ssh tunnel, I have to set all my apps to socks which I'd like to avoid doing that.

  • Well, VPN gives you a separate IP address in the VPN. That then becomes the 'default route' for traffic (see ip route for a full list of IP interfaces, and look for a line like this: default via dev tun0 proto static). An SSH tunnel isn't a 'route' per se, as it's not 'configured' to work as a VPN route. – Thomas Ward Jun 24 '15 at 23:00

One way would be to create .desktop files. You can copy the google-chrome-stable to your desktop by typing in from a terminal window:

cp /usr/share/applications/google-chrome.desktop /home/username/Desktop

Open the google-chrome.desktop file with your favorite editor, and change the following line:

Exec=/usr/bin/google-chrome-stable %U


Exec=/usr/bin/google-chrome-stable --proxy-server="socks://"

you might also want to change this line close to the beginning of the .desktop file from:

Name=Google Chrome


Name=Google Chrome (Tunnel)

save the file and exit. Then make the file executable so it can be run:

sudo chmod +x /home/username/Desktop/google-chrome.desktop

any time you want it to connect through your tunnel you just launch that one instead.


If you want to traffic from all applications through the SOCKS proxy server tsocks would do the trick.

tsocks is a library to allow transparent SOCKS proxying. It wraps the normal connect() function. When a connection is attempted, it consults the configuration file (which is defined at configure time but defaults to /etc/tsocks.conf) and determines if the IP address specified is local. If it is not, the library redirects the connection to a SOCKS server specified in the configuration file. It then negotiates that connection with the SOCKS server and passes the connection back to the calling program.

Dns Issues

tsocks will normally not be able to send DNS queries through a SOCKS server since SOCKS V4 works on TCP and DNS normally uses UDP. Version 1.5 and up do however provide a method to force DNS lookups to use TCP, which then makes them proxyable. This option can only enabled at compile time, please consult the INSTALL file for more information.

If you just want to tunnel browser traffic you should be able to configure a SOCKS proxy in the browser settings.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.