Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I think I have Virtualbox set up so that all traffic originating from the guest OS is routed through Tor. Tor is only installed on the host OS and the web browsers on the guest OS all report Tor IP's in Europe when I test with The host OS shows my real IP when going to the same sites.

But I initiate a lot of requests from the Linux command line and I haven't been able to confirm to my satisfaction that these are routing through Tor, though I have no reason to think they do not.

When I use this command I get no output from the guest OS, but my real IP from the host OS:

dig +short

This bash file gives no output from either OS:


echo Your external IP Address is:
wget -O - -o /dev/null | grep '<TITLE>' |\
  sed -r 's/<TITLE>WhatIsMyIP\.com \- //g' | sed -r 's/<\/TITLE>//g'

exit 0


share|improve this question
Are you sure the global proxy settings are set to route through TOR? Or are the browsers using their individual proxy support? – adempewolff Jun 2 '12 at 14:44
Sorry for the delay in responding the ISP was down here for a couple of days.I'm sure the proxy settings are global. TOR is not installed on the guest OS and there are no proxy settings configured on the browsers. I used a tutorial from How-to-Forge to route all virtualbox traffic through TOR, now I'm just looking for a way to check that is doing that from the command line. – Chris Jun 5 '12 at 16:24

Usually software which is called from your shell doesn't know about about Tor or any other proxy. So you have to tell it. The bad thing is that many software has specific ways to set a proxy up. Below you find some ways to get Tor working on commandline. I assume that you run a combination of Tor and Privoxy at the IP address and port 8118. This might not true in your case. So you should enter the correct values.

Proxy environment variable

There is a special environment variable which is respected by some shell software. Open your .bashrc (or other shell rc file) and enter the following lines.

export http_proxy=""
export https_proxy=${http_proxy}
export HTTP_PROXY=${http_proxy}
export HTTPS_PROXY=${http_proxy}

Applications like wget, GnuPG and curl are known to respect those values.


Torsocks is a helper software with re-routes all requests through Tor. Just prepend the software to any command line call.

torsocks your-shellscript
torsocks wget

Furthermore you can also use tor-resolve to get an IP address through Tor.

torsocks ssh $(tor-resolve


If you're using SSH, you can edit your $HOME/.ssh/config.

Host *
     ProxyCommand socat STDIO SOCKS4A:,socksport=9050

This setting sends every SSH connection through Tor. However the keyword Host in ssh_config allows you to set it up for special hosts. Please have a look at the manpage of ssh_config.

Further ressources

The TorifyHOWTO at has advice for setting up different services. The toraliases might also give some hints and has a setup for IPtables.

share|improve this answer

Use ProxyChains so that you can run any program through a proxy server.

From ProxyChains project

  • Allows TCP and DNS tunneling through proxies.
  • Supports HTTP, SOCKS4 and SOCKS5 proxy servers.
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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