Portable TOR relay

Version 0.5

Andrea Trentini - 2009



Create a qemu (http://www.qemu.org) image with a small/minimal linux distro and TOR (http://www.torproject.org) to have a “portable” TOR relay: just copy the qemu image and run it on any server (even/especially VPSes) you like.


  • Copy image
  • Launch qemu with port redirection (script available)
  • Edit TOR config inside guest machine
  • Activate TOR (symlink in /etc/rc2.d)
  • Start TOR service or reboot guest machine


Working, now disabled, I had a working image but I switched it off…

Idea (implementation)

  • Create qemu image
  • Install minimal GNU/Linux version (“Ubuntu JeOS” was chosen)
  • Check TOR is installed and updated…
  • Edit /etc/tor/torrc (see appendix 'TOR config')
  • Config GRUB to activate serial console (so that qemu can be run in the background with no window)
  • Install (usually already installed) and activate ssh server (/etc/rc2.d)


TOR config

Logs are optional…

Log notice file /var/log/tor/notices.log

Log debug file /var/log/tor/debug.log

RunAsDaemon 1

Nickname <whatever>

Address <FQDN of host machine>

ContactInfo <your contact>

ORPort <choose port and use the same number in the qemu activation script>

DirPort <choose port…>

Qemu activation

Shell command to launch qemu:

$ nohup qemu -localtime -redir tcp:<ORPort>::<ORPort> -redir tcp:<DirPort>::<DirPort> -redir tcp:<sshPort>::22 -nographic <imagename> &

ORPort, DirPort: see appendix 'TOR config'

sshPort: if you want (recommended!) to access your guest machine activate an ssh server and make it accessible through a qemu mapping

If you launch qemu without 'nohup' you can access the console directly.

GRUB config

Add this to activate serial console:

serial –unit=0 –speed=9600 –word=8 –parity=no –stop=1 terminal –timeout=10 –dumb serial console

And this must be appended to every kernel line:

console=tty0 console=ttyS0 vga=normal