Virtual Network Adapter that forwards request to a SOCKS proxy
Here is what I did to make it work.
- Use OpenVPN tap drivers to install a virtual network adapter(use NDIS5 drivers).
- Name it as
taplan
. - Assign 10.0.0.1 to your network adapter named
taplan
. Use 255.255.255.0 as subnet mask. - Have a socks server or use public server you owned to do a ssh tunnel socks proxy connection.
If you don't have a socks proxy, you need a public server. You can use putty to establish an ssh connection along with a tunnel which acts as a socks proxy. Sample command is something like this:
ssh -D 8123 -f -C -q -N socksserverip.com
After that, you have a socks proxy on your localhost
at port 8123
.
Check your socks proxy with Firefox by pointing
localhost:8123
as socks proxy. If you have an internet connection then so far so good.Download tun2socks from prebuilt windows binaries. For this question, I used
badvpn-1.999.128-win32.zip
file.
Extract bin/badvpn-tun2socks.exe
file to somewhere in system PATH and rename it as t2s.
- Configure tun2socks to make your taplan adapter to use socks proxy.
Enter command prompt with admin privileges and type:
$ t2s --tundev "tap0901:taplan:10.0.0.1:10.0.0.0:255.255.255.0" --netif-ipaddr 10.0.0.2 --netif-netmask 255.255.255.0 --socks-server-addr 127.0.0.1:8123
Now you have a virtual network adapter named as taplan
which uses the socks proxy configured as your localhost to connect to internet. All requests forwarded to this adapter will tunnel through your public/remote server.
- Configure your internet
routes
.
In command prompt type:
$ route PRINT
this will show you your current routes. The default gateway is the top one. Note that IP.
$ route CHANGE 0.0.0.0 MASK 0.0.0.0 your_current_gateway_ip METRIC 400
$ route ADD 0.0.0.0 MASK 0.0.0.0 10.0.0.2 METRIC 50
Now all your internet traffic will be using 10.0.0.2 as gateway which is configured in a virtual network adapter.
You are looking for a system-wide proxy for all programs, including those that bypass the Windows 10 proxy that is defined in Settings > Network & Internet > Proxy under "Manual proxy setup".
You will need for that a third party product, since Windows 10 does not have a built-in mechanism for that.
I list below the products I know of, although you will need to try them out to see how well they work with your environment:
- SocksCap64 (freeware dating from November 2017)
- WideCap and its much older predecessor FreeCap (freeware dating from 2009)
- AllProxy Lite (freeware dating from 2018) and its commercial brother AllProxy ($9.95)
- ProxyCap ($36 with 30 day trial)
- Proxifier ($36 with 30 day trial, dating from December 2016)