9

I brought a VPN service that I want to use on VPS for web bots.

I've installed OpenVPN and config from the VPN Service, but openVPN is tunneling with the VPN service for all services even for remote desktop connection, so now it is hard to manage Windows VPS from my local because of a 500+ ms latency.

So is there any way to exclude the remote desktop service or my IP, so I can manage VPS in normal way, but in VPS other things could be with the VPN?

2 Answers 2

6

You can exclude single IP addresses or address ranges by adding a new entry to the routing table.

  1. Find out your usual "default gateway" (usually your router's IP address) from ipconfig.

  2. Connect to VPN.

  3. Run route add <vps-address> mask 255.255.255.255 <gateway> in Command Prompt.

    If you want to add an entire subnet, adjust the netmask accordingly. (For example, add 198.51.100.0 mask 255.255.255.0)

  4. If it works, add it again with route add -p so that Windows will remember it for the future.

2
  • 8
    I personally prefer adding the appropriate line to the OpenVPN config file: (example for 192.168.1.0/24 subnet) route 192.168.1.0 255.255.255.0 net_gateway OpenVPN will then use the system's commands to add this to the routing table. The advantage to doing it this way is the config is portable without manual routing and the route will be removed when OpenVPN is disconnected. Also, net_gateway serves as a convenient alias for The pre-existing IP default gateway, read from the routing table. See community.openvpn.net/openvpn/wiki/Openvpn23ManPage for more information.
    – Bob
    Oct 15, 2012 at 8:59
  • @Bob, you should make that an answer instead of a comment. Sep 8, 2016 at 18:44
0

In macOS 10.15.7 with OpenVPN connection using Tunnelblick:

  1. Find the default gateway (192.168.1.1):

    $ netstat -rn | grep default
    default            192.168.1.1       UGSc           en1
    default                                 fe80::%utun0                    UGcI          utun0
    default                                 fe80::%utun1                    UGcI          utun1
    
  2. Use this command in the terminal to exclude an IP range (for example 192.168.100.0 to 192.168.100.255) from tunneling:

    $ sudo route add 192.168.100.1/24 192.168.1.1
    add net 192.168.100.1: gateway 192.168.1.1
    

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.