Advertisement
Paladinz2k

Enabling your VPN for a single program

Feb 6th, 2020
11,417
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.54 KB | None | 0 0
  1. Windows Guide: Enabling your vPN for a single program while letting everything else use your normal connection.
  2.  
  3. This guide was orignally written by myself in a thread on r/piracy, however i think many people would like a setup like this, hence this post.
  4.  
  5. Essentially this setup will let you run your VPN at all times without worrying about high ping in online games and the like, as only one (or more if you want) program will be using your VPN while the rest will be using your normal connection.
  6.  
  7. I learned how to set this up by experimenting as there was no guide for doing this on Windows on the internet last time i checked. Please send a link to such a guide if you find one, it might be better than mine :)
  8.  
  9. This guide is written for use with qBittorrent and privateinternetaccess(PIA) VPN, but the VPN provider doesn't matter alot as long as your VPN has config files that you can download for use with OpenVPN. I strongly recommend using qBittorrent as it can bind to a network interface which will become very useful later in the guide.
  10.  
  11. Part 1, Setting up OpenVPN:
  12.  
  13. Step 1 you need to use Openvpn instead of the PIA app. This gives us much more customizabilty and as far as i know the PIA app is built on openvpn anyways. So have Openvpn installed.
  14.  
  15. Step 2 you need to get the openvpn config files for PIA from PIA's website
  16.  
  17. Step 3 place the ".pem", ".ca" and one (Choose best location for you) of the ".ovpn" files in "C:\Program Files\OpenVPN\config" like so: http://i.imgur.com/1xZZAb5.png
  18.  
  19. Step 4 create a file called pass.txt in the same folder and insert your PIA username and password on two lines like so: http://i.imgur.com/Wpef5bP.png
  20.  
  21. Step 5 insert into the ".ovpn" file you placed in the "C:\Program Files\OpenVPN\config" folder: auth-user-pass pass.txt
  22.  
  23. Now you should be able to start Openvpn GUI, right click the icon in the taskbar and press connect and this will connect you to PIA servers with the Openvpn client instead of the PIA client.
  24.  
  25. Check if your IP has changed with https://ipleak.net or https://www.doileak.com/
  26.  
  27. Part 2, Setting network routes:
  28.  
  29. Step 1 Add these lines to the ".ovpn" file:
  30.  
  31. script-security 2
  32.  
  33. route-noexec
  34.  
  35. up up.bat
  36.  
  37. down down.bat
  38.  
  39. Step 2 create an "up.bat" and a "down.bat" in the config folder like so: http://i.imgur.com/k9mvC9g.png
  40.  
  41. Step 3 insert into the "up.bat":
  42.  
  43. ROUTE ADD 0.0.0.0 MASK 0.0.0.0 %ifconfig_remote%
  44.  
  45. Step 4 insert into the "down.bat":
  46.  
  47. ROUTE DELETE 0.0.0.0 MASK 0.0.0.0 %ifconfig_remote%
  48.  
  49. Step 5 This part is why using qBittorrent is a very good idea for this sort of setup but if you really don't want to switch you'll have to find a way to bind your torrent client to a network interface.
  50.  
  51. Open qBittorrent and go into settings, and then "advanced". Then you want to set the network interface to your VPN interface like so: http://i.imgur.com/T6y4B1P.png
  52.  
  53. This will make qBittorrent communcate via the VPN and ONLY the VPN, in my experience. This means that if the VPN tunnel goes down, qBittorrent will lose connection instead of connecting with your real IP. You will have to restart qBittorrent every time the VPN is restarted to connect to the new VPN ip though. (Make sure you have exited qBittorrent in the taskbar when restarting it).
  54.  
  55. Step 6 Try going to https://doileak.com and activate the torrent test. Add the magnet links to qBittorrent and start the test. If it worked the "Request IP" should be different from the "Torrent HTTP Request IP" and the "Torrent UDP Request IP"
  56.  
  57. Maybe you have noticed that qBittorrent is still using some of your non-VPN DNS servers though.
  58.  
  59. Step 7 My best solution to the DNS server problem is making everything on your PC use OpenDNS DNS servers instead of your ISP's or your VPN's. To do this add these lines to the ".ovpn" file:
  60.  
  61. dhcp-option DNS 208.67.222.222
  62.  
  63. dhcp-option DNS 208.67.220.220
  64.  
  65. block-outside-dns
  66.  
  67. Check with https://doileak.com again, all your dns requests from qBittorrent and from your browser should now come from OpenDNS making it harder (to the best of my knowledge) to correlate your normal IP with your VPN IP.
  68.  
  69. If you experience any issues with your DNS servers cutting out, remove these 3 lines again. I have only had these issues on one of the 2 PC's i use with this setup.
  70.  
  71. Step 8 Start OpenVPN as a service.
  72.  
  73. Go into Services in Windows.
  74.  
  75. Find OpenVPN Service and go into it's properties.
  76.  
  77. Set Startup type to automatic, press apply and press start. OpenVPN should now run in the background at all times.
  78.  
  79. PART 3, Making qBittorrent start and stop automatically with the VPN:
  80.  
  81. A command to start and stop qBittorrent can be added to the up.bat and down.bat files. This is neat because qBittorrent has to be restarted every time the VPN restarts and by adding it to the bat files you don't have to do it manually. However, when using openvpn as a service it doesn't start qBittorrent the same way as if you had started it yourself (because of the way services are handled in Windows).
  82.  
  83. Therefore it will not appear as "desktop program" but will still be running in the background.
  84.  
  85. This means that the only way to access qBittorrent is through the WebUI.
  86.  
  87. The command to add to "up.bat" is:
  88.  
  89. start /d "C:\Program Files (x86)\qBittorrent" qbittorrent.exe
  90.  
  91. http://i.imgur.com/IJCiGr3.png
  92.  
  93. The command to add to "down.bat" is:
  94.  
  95. taskkill /F /IM "qbittorrent.exe"
  96.  
  97. http://i.imgur.com/zDeb43M.png
  98.  
  99. Then there is a couple a steps you need to take to make sure the OpenVPN Service is logged in as your user:
  100.  
  101. Step 1 Go to services, right click OpenVPN Service and go to properties.
  102.  
  103. Step 2 In the "Log On" tab press "this account" and click browse.
  104.  
  105. Step 3 Press advanced and a large window will popup.
  106.  
  107. Step 4 In the large windows press find now and a list of users will appear at the bottom of the window.
  108.  
  109. It should look like this: http://i.imgur.com/jxrH3i9.png
  110.  
  111. Step 5 Double click your username("Hundter" in my case) in the list.
  112.  
  113. Step 6 Press Ok to close the large window. Press Ok again to close the smaller window. Your username should now be in the box next to "This account".
  114.  
  115. Step 7 Enter the password for the user in Password and Confirm Password and press Ok.
  116.  
  117. Assuming that you have enabled WebUI in qBittorrent you should be able to access the WebUI without starting qBittorrent yourself as long as the VPN is running.
  118.  
  119. Assuming you followed the guide you should now have an amazing VPN setup (in my opinion) that will let you use your PC for gaming, browsing and other activites where low latency or direct connection is preferred :)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement