I have one VPS, I run an OpenVPN and Proxy server on it. I can't use OpenVPN on my ISP to connect to it, the handshake always fails because the traffic is easily detected and dropped. So I use the same server to use a (Shadowsocks) proxy to initiate the OpenVPN connection. The proxy server runs on localhost:2080 on my client machine.
I searched for "excluding specific IP address from tunneling on OpenVPN" and I found a lot of results:
https://stackoverflow.com/questions/70224509/exclude-ip-from-openvpn-route OpenVPN: Only route a specific IP addresses through VPN? https://forums.openvpn.net/viewtopic.php?t=27618
So this is what I added to my client profile:
http-proxy 127.0.0.1 2080
route <server-ip> 255.255.255.255 net_gateway
It resolved 2 issues:
- It uses the proxy to connect to OpenVPN, and OpenVPN initializes successfully!
- The proxy server does not get blocked and I can still use it!
But one issue still persists, I don't have internet access! When I ping any IP that I could ping even without OpenVPN, all packets fail. I don't know what's the issue, I don't know what to search, traceroute 1.1.1.1 just shows 30 rows of 3 asterisks. All local IP's can be pinged and they work fine.
My route table looks fine:
0.0.0.0/1 via 10.8.0.1 dev tun0
default via 192.168.1.1 dev wlp9s0 proto dhcp metric 600
10.8.0.0/24 dev tun0 proto kernel scope link src 10.8.0.5
<server ip> via 192.168.1.1 dev wlp9s0
127.0.0.1 via 192.168.1.1 dev wlp9s0
128.0.0.1/1 via 10.8.0.1 dev tun0
169.24.0.0/16 dev wlp9s0 scope link metric 1000
172.17.0.0/16 dev docker0 proto kernel scope link src 172.17.0.1 linkdown
192.168.1.0/24 dev wlp9s0 proto kernel scope link src 192.168.1.25 metric 600