3

I have created a script in Node.js to remotely manage a server. To work the script needs to be connected to a VPN. The VPN it needs to connect to is different from the one I want Windows to use. Both VPNs use OpenVPN. I have successfully created two TAP adapters (TAP_WINDOWS and TAP_MYSCRIPT) that OpenVPN can be connected to simultaneously.

However, I am stuck trying to figure out how to specify which adapter to send traffic through. My script always needs to send traffic through the TAP_MYSCRIPT adapter, while all other traffic goes through TAP_WINDOWS.

I am aware Windows has some routing functionality but am unsure how to configure it or if it is what I need? Is it possible to do this by an app to app basis or is this something I will need to edit my script to be able to use?

  • Is the IP address inside the openvpn which is connected for server management is also fixed ? – Ahmet Özer Apr 19 '20 at 00:56
  • Deleting my previous comment because I misread yours. The IP I connect to for server management is fixed. – Settings Menu Hard to Find Apr 20 '20 at 06:01
  • Do you have a controls at VPN servers Configuration ? – Ahmet Özer Apr 21 '20 at 10:26
  • Sorry, could you clarify your question? I don't understand. – Settings Menu Hard to Find Apr 21 '20 at 10:44
  • Can you have permission to change your vpn server configuration ? if you have i give answer based on server side. If you don`t i will give answer for client side. And also can you write network blocks of your vpn server and does the both vpn server is redirect all traffic trough on vpn server or only local networks. – Ahmet Özer Apr 21 '20 at 10:50
  • I can edit the OpenVPN configuration file in Windows, for example if I set `dev-node TAP_WINDOWS` the TAP adapter used will be `TAP_WINDOWS`. I have no control over the VPN server itself. I specify the server address (`remote servername.net 443`) and get assigned an IP. – Settings Menu Hard to Find Apr 21 '20 at 11:39

2 Answers2

0

I know the questions I am asking belong in a comment, but unfortunately I don't have enough reputation to add a comment yet. However, I believe I can help you as I have a lot of experience with OpenVPN on Windows.

1) Does the app use a FQDN or an IP address to connect to the server?

2) What are the networks/subnets TAP_WINDOWS and TAP_MYSCRIPT are connected to?

CB_Ron
  • 313
  • 2
  • 10
  • Sorry in advance for butchering this response, networking/subnets is a new area for me. For 1), assuming you are talking about the server I am managing, it is accessed using a domain name (`https://example.com`). For 2), both adapters, I assume, connect to the VPN provider (which gives me a random public ip address depending on the country server I connect to). `TAP_WINDOWS` was created when I installed OpenVPN and `TAP_MYSCRIPT` was created by running `Program Files\TAP-Windows\bin\addtap.bat`. I am unsure how to see what networks/subnets the adapters connect/how I would apply that knowledge. – Settings Menu Hard to Find Apr 21 '20 at 01:14
0

You can run the script inside Windows container. This container should have only one interface available through a bridge. 1, 2

Windows does not expose network namespaces interface to a user, unfortunately. enter image description here

Artem K.
  • 115
  • 6