How to send google or any website to default connection not vpn
Moderators: TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech
-
- OpenVpn Newbie
- Posts: 4
- Joined: Fri Feb 24, 2017 1:19 am
How to send google or any website to default connection not vpn
How to send google or any website to default connection not vpn ?
I trying to do like this but it's not bypass over vpn
FOR /F "tokens=1,2 delims=[]" %%o IN ('ping -n 1 www.google.com') DO (IF "%%p" NEQ "" set WWWGOOGLE=%%p)
ROUTE ADD %WWWGOOGLE% mask 255.255.255.255 192.168.126.2
FOR /F "tokens=1,2 delims=[]" %%o IN ('ping -n 1 google.com') DO (IF "%%p" NEQ "" set GOOGLE=%%p)
ROUTE ADD %GOOGLE% mask 255.255.255.255 192.168.126.2
FOR /F "tokens=1,2 delims=[]" %%o IN ('ping -n 1 www.gstatic.com') DO (IF "%%p" NEQ "" set WWWGSTATIC=%%p)
ROUTE ADD %WWWGSTATIC% mask 255.255.255.255 192.168.126.2
FOR /F "tokens=1,2 delims=[]" %%o IN ('ping -n 1 gstatic.com') DO (IF "%%p" NEQ "" set GSTATIC=%%p)
ROUTE ADD %GSTATIC% mask 255.255.255.255 192.168.126.2
FOR /F "tokens=1,2 delims=[]" %%o IN ('ping -n 1 googleapis.com') DO (IF "%%p" NEQ "" set GOOGLEAPIS=%%p)
ROUTE ADD %GOOGLEAPIS% mask 255.255.255.255 192.168.126.2
I trying to do like this but it's not bypass over vpn
FOR /F "tokens=1,2 delims=[]" %%o IN ('ping -n 1 www.google.com') DO (IF "%%p" NEQ "" set WWWGOOGLE=%%p)
ROUTE ADD %WWWGOOGLE% mask 255.255.255.255 192.168.126.2
FOR /F "tokens=1,2 delims=[]" %%o IN ('ping -n 1 google.com') DO (IF "%%p" NEQ "" set GOOGLE=%%p)
ROUTE ADD %GOOGLE% mask 255.255.255.255 192.168.126.2
FOR /F "tokens=1,2 delims=[]" %%o IN ('ping -n 1 www.gstatic.com') DO (IF "%%p" NEQ "" set WWWGSTATIC=%%p)
ROUTE ADD %WWWGSTATIC% mask 255.255.255.255 192.168.126.2
FOR /F "tokens=1,2 delims=[]" %%o IN ('ping -n 1 gstatic.com') DO (IF "%%p" NEQ "" set GSTATIC=%%p)
ROUTE ADD %GSTATIC% mask 255.255.255.255 192.168.126.2
FOR /F "tokens=1,2 delims=[]" %%o IN ('ping -n 1 googleapis.com') DO (IF "%%p" NEQ "" set GOOGLEAPIS=%%p)
ROUTE ADD %GOOGLEAPIS% mask 255.255.255.255 192.168.126.2
-
- OpenVPN Protagonist
- Posts: 11137
- Joined: Fri Jun 03, 2016 1:17 pm
Re: How to send google or any website to default connection not vpn
What does the script output ?
-
- OpenVPN Super User
- Posts: 310
- Joined: Tue Apr 12, 2011 6:22 am
Re: How to send google or any website to default connection not vpn
that doesn't look right
will run your DO for every line the ping command outputs , i'm not sure what you're trying to do but i would replace the FOR loops with thisFOR /F "tokens=1,2 delims=[]" %%o IN ('ping -n 1 http://www.google.com') DO (IF "%%p" NEQ "" set WWWGOOGLE=%%p)
FOR /F "tokens=1,2 delims=[]" %%o IN ('ping -n 1 www.google.com ^| FIND /I "pinging"') DO (IF "%%p" NEQ "" set WWWGOOGLE=%%p)
i don't know what that sentence meansHow to send google or any website to default connection not vpn ?
-
- OpenVpn Newbie
- Posts: 4
- Joined: Fri Feb 24, 2017 1:19 am
Re: How to send google or any website to default connection not vpn
Sorry it's batch script after connected VPN via openvpn
It's mean get ip from command ping http://www.google.com and set it to WWWGOOGLE
It's mean get ip from command ping http://www.google.com and set it to WWWGOOGLE
Code: Select all
FOR /F "tokens=1,2 delims=[]" %%o IN ('ping -n 1 http://www.google.com') DO (IF "%%p" NEQ "" set WWWGOOGLE=%%p)
-
- OpenVpn Newbie
- Posts: 4
- Joined: Fri Feb 24, 2017 1:19 am
Re: How to send google or any website to default connection not vpn
Sorry it's batch script after connected VPN via openvpn
It's mean get ip from command ping http://www.google.com and set it to WWWGOOGLE
I trying to connect vpn and except specific website connect through default internet connection not vpn
If i put this config it mean conect google.* in defult internet connection ?
Refer : https://serverfault.com/questions/63103 ... ip-filteri
So it's posible to do it in batch command(Route) in windows or not , and how to do
Thanks , best regard
It's mean get ip from command ping http://www.google.com and set it to WWWGOOGLE
Code: Select all
FOR /F "tokens=1,2 delims=[]" %%o IN ('ping -n 1 www.google.com') DO (IF "%%p" NEQ "" set WWWGOOGLE=%%p)
I trying to connect vpn and except specific website connect through default internet connection not vpn
If i put this config it mean conect google.* in defult internet connection ?
Code: Select all
# redirect a host using a domainname to NOT go via the VPN
route www.google.ca 255.255.255.255 net_gateway
So it's posible to do it in batch command(Route) in windows or not , and how to do
Thanks , best regard
-
- OpenVPN Super User
- Posts: 310
- Joined: Tue Apr 12, 2011 6:22 am
Re: How to send google or any website to default connection not vpn
i know what the batch script does ... i just wasn't sure what you are trying to do
so the answer is yes , try this
forget about up/down parameters , i always have issues with those on windows
lets say you have a config named myconfig.ovpn , create a batch file myconfig_up.bat in the same location where your config is with the following content
this will generate myconfig_down.bat , to delete the routes when you disconnect the VPN
be sure to replace myconfig_ with the name of your config , and also run openvpn as administrator even version 2.4
so the answer is yes , try this
forget about up/down parameters , i always have issues with those on windows
lets say you have a config named myconfig.ovpn , create a batch file myconfig_up.bat in the same location where your config is with the following content
Code: Select all
@echo off
FOR /F "tokens=1,2 delims=[]" %%o IN ('ping -n 1 www.google.com ^| FIND /I "pinging"') DO (IF "%%p" NEQ "" set WWWGOOGLE=%%p)
route add %WWWGOOGLE% mask 255.255.255.255 192.168.126.2
FOR /F "tokens=1,2 delims=[]" %%o IN ('ping -n 1 www.google.com ^| FIND /I "pinging"') DO (IF "%%p" NEQ "" set GOOGLE=%%p)
route add %GOOGLE% mask 255.255.255.255 192.168.126.2
echo @echo off > hyperion_down.bat
echo route delete %WWWGOOGLE% >> myconfig_down.bat
echo route delete %GOOGLE% >> myconfig_down.bat
be sure to replace myconfig_ with the name of your config , and also run openvpn as administrator even version 2.4
-
- OpenVpn Newbie
- Posts: 4
- Joined: Fri Feb 24, 2017 1:19 am
Re: How to send google or any website to default connection not vpn
Your script is correct and it look same my scirpt but i don't want delete, I want specific website connect through default internet connection not vpn. In your batch script it's mean when vpn disconnect it will delete route right ?TiTex wrote:i know what the batch script does ... i just wasn't sure what you are trying to do
so the answer is yes , try this
forget about up/down parameters , i always have issues with those on windows
lets say you have a config named myconfig.ovpn , create a batch file myconfig_up.bat in the same location where your config is with the following contentthis will generate myconfig_down.bat , to delete the routes when you disconnect the VPNCode: Select all
@echo off FOR /F "tokens=1,2 delims=[]" %%o IN ('ping -n 1 www.google.com ^| FIND /I "pinging"') DO (IF "%%p" NEQ "" set WWWGOOGLE=%%p) route add %WWWGOOGLE% mask 255.255.255.255 192.168.126.2 FOR /F "tokens=1,2 delims=[]" %%o IN ('ping -n 1 www.google.com ^| FIND /I "pinging"') DO (IF "%%p" NEQ "" set GOOGLE=%%p) route add %GOOGLE% mask 255.255.255.255 192.168.126.2 echo @echo off > hyperion_down.bat echo route delete %WWWGOOGLE% >> myconfig_down.bat echo route delete %GOOGLE% >> myconfig_down.bat
be sure to replace myconfig_ with the name of your config , and also run openvpn as administrator even version 2.4
-
- OpenVPN Super User
- Posts: 310
- Joined: Tue Apr 12, 2011 6:22 am
Re: How to send google or any website to default connection not vpn
it looks the same but it's not the same , so try it out and we'll see after that
i can't write in more plain english than i did above , sorry
i can't write in more plain english than i did above , sorry