Since the .ovpn have a setting with
redirect-gateway def1 bypass-dhcp
dhcp-option DOMAIN-ROUTE .
Therefore, your PC network route will all go through the VPN. Which make the connection failed in local
Cannot surfing the web π«π«π«π«
Note
This workaround not modify any content inside the .ovpn file or route table
The solution is very simple, use a docker container to run the ovpn
VPN setting will only apply inside the docker container environment
Expose the port & ip to let local network to access
Full Architechture
[ Host Machine (Your PC) ] βββ> Physical NIC (Wi-Fi/Ethernet) βββ> Normal Local Internet (Fast & Untouched)
β
ββββ> [ Proxifier (Host) ] βββ> Intercepts {your target device IP} βββ> Forwards to localhost:{your fav port}
β β
ββ> [ Docker Engine (WSL2) ] ββββββββββββββββββββββββββββββββββββββββ
β
ββ> [ Shared Network Space ]
β
βββ> [ Service 2: Gost (SOCKS5 Server) ] βββ> Listens on port {your fav port}
β β
βββ> [ Service 1: OpenVPN Client Container ] ββββββββ
β
βββ> Connects to {provided VPN domain}
βββ> Highjacks CONTAINER-ONLY routes & DNS
- Proxifier
- Docker Desktop
- Any Auth App (e.g. Google Auth, Authenticator>
if require 2FA access
Go to Menu, Open "Profile" > "Proxy Servers..."
"Add" a new server
Address: 127.0.0.1|port: {your fav port}|Protocol: SOCKS VERSION 5
OK to Save
Go to Menu, Open "Profile" > "Proxification Rules..."
"Add" a new rule
Name: {your fav name}|Target host: {your target device IP}|Action: {the proxy server create in part 1}
OK to Save
File Structure
Create the below structure in any directory of your PC
vpn-proxy/
βββ compose.yml
βββ vpn/
βββ {provided}.ovpn
βββ credentials.txt
βββ private_key_pwd.txt
Some value in template should change on your own
{port} β the port should be same as proxifier setting
{provided}.ovpn β the .ovpn file, use your own name
Download the
compose.yml
Change the{port}and{provided}
Download or create
credentials.txt
Fill in{user name}{password}
Download or create
password.txt
Fill in{private key password}
- Open & Start Docker Desktop
- Goto the
compose.ymldirectory.- open cmd/terminal run
docker compose up -d
Note
this part is start from the init state, no "already in use" application or process
- Open Docker Destop (MUST)
- Open Proxifier (MUST)
- Prepare your auth tools
MUST already open the Docker Desktop
- Goto the
compose.ymllocation - run
docker compose start - run
docker attach openvpn-client - Fill in the 6-digit Auth code & Press Enter (if any)
OpenVPN often doesn't automatically re-prompt or flush the stdout to show the 2FA
Enter Authenticator Codehint when a new terminal attaches, leaving you staring at a blank, frozen screen.- Even if the screen is blank or stuck on old logs, just type your 2FA code and hit Enter.
- OpenVPN will often accept the input anyway and proceed with the connection.
- Once connected, safely detach by pressing
Ctrl + PthenCtrl + Q.
if you input the wrong 2FA code, please detach first and do the following command docker compose restart docker attach openvpn-client
- Open your remote desktop tools, fill in the {target device IP}
