How to route all TCP traffic from a Windows guest system through Tor
- From the sandbox
- Tutorial
The virtual machine on which the anonymized system is installed is connected through the local network only to the host system (Host-only mode of the virtual network adapter), on which Tor is installed. Inside the guest OS, applications that need Internet access had the address of the Polipo proxy server installed with Tor on the host system. Thus, access to the Internet from the guest system is possible only through Tor. However, this method has a drawback. For each application, it is necessary to register proxies, in addition, not all applications have such settings. I did not want to resort to the use of proxy programs, because such a decision seemed to me not quite "natural." Below I will talk about a more “natural” way of TORIFICATION.
After intense googling, I came across tun2socks software. Using deviceTUN / TAP (virtual network adapter), it directs all tcp and udp traffic through SOCKS proxies. For the system, it looks like an Ethernet adapter connected to a router that distributes the Internet. Quite "natural", is not it?
We will need:
- Vidalia Bundle (Tor)
- BadVPN ( tun2socks is present inside the archive)
- OpenVPN (to create a TUN / TAP device).
So, let's get down to setting:
- Install Windows on your favorite virtual machine. In the settings of the network adapter of the virtual machine, set the Host-only mode (this means that only the host OS will be available from the guest OS over the network).
- We assign fixed IP addresses for adapters in the host and guest systems, for example, 192.168.220.1 and 192.168.220.2, respectively.
- Install on the host OS Vidalia Bundle. Then open the torrc file (% USERPROFILE% \ AppData \ Local \ Vidalia) and append the following lines to the end:
Run Tor.
SocksListenAddress 192.168.220.1 # Заставляем тор слушать порт 9050 на адресе 192.168.220.1
DNSListenAddress 192.168.220.1 # Вешаем встроенный в Tor DNS-сервер на указанный адрес
DNSPort 53 # Указываем на каком порту будет висеть DNS-сервер (почему-то без этой настройки тор выдает ошибку) - Install OpenVPN on the guest system. After that, the TUN / TAP network adapter with the status "network cable is not connected" should appear in network connections. Give him a shorter name, for example tor.
- Unpack somewhere badvpn. In the bin folder we find the badvpn-tun2sock.exe file and run it with the following parameters:
--tundev --netif-ipaddr 10.0.0.2 --netif-netmask 255.255.255.0 --socks-server-addr 192.168.220.1:9050
Here:This is the line tap0901: tor: 10.0.0.1: 10.0.0.0: 255.255.255.0, where tor is the name of our TUN / TAP adapter, 10.0.0.1 is the address of the adapter, 10.0.0.0 and 255.255.255.0 are the address and subnet mask. - 10.0.0.2 - the address of the virtual router, which acts as an Internet gateway.
- 255.255.255.0 - subnet mask.
- 192.168.220.1:9050 address of the proxy installed on the host OS. In our case, Tor acts as a proxy.
The tun2sock launch field, the status of the TUN / TAP adapter should change to “Connected”.
Now in the properties of this adapter you need to configure the gateway and DNS server:
The DNS server we have is the DNS built into Tor (192.168.220.1:53), and the gateway, as mentioned above, is a virtual router (10.0. 0.2). - In order for hidden tor services to work, the following lines must be added to torrc:
AutomapHostsOnResolve 1
AutomapHostsSuffixes .onion
VirtualAddrNetwork 10.192.0.0/10
The author of tun2socks writes that this program also supports udp redirection, but the tor does not support it. I suspect that precisely because of this I was not able to use WebICQ.
That's all. Internet anonymous to you.