Back once more… so I have everything setup not sure why it randomly keeps failing. Right now this is the problem. I am checking my remote access tab it shows the following when the vpn is running
Private: 10.15.xx.xx: 32400 < Public: MY ACTUAL PUBLIC IP FROM MY ISP: 32400 X Internet
While my public ip is correct its forwarding the traffic to an ip (where it says private) that correlates to the VPN (in my case PIA). but should it not be forwarding to 192.168.1.222 which is the local ip for my plex server?
I did the override in the .bat by removing the :: and adding my actual default gateway to ensure I was using the correct gateway, This is how the bat looks that I am using right now and it is failing again. Any help? Nothing has been changed on the computer. If needed I can provide the results of routeprint
- Remote access tab now reads Not available outside your network
- My connection on my plex app on my phone now shows (Indirect)
- My parents can no longer access the plex app at their house (I set up manual connections in their roku plex app to connect to my real isp provided public IP with the right port and forwarded the port in my own router to my local ip of the computer running my plex sever)
@echo off
setlocal
set PATH=%SystemRoot%\system32;%SystemRoot%\system32\wbem;%SystemRoot%
chcp 437>nul
title VPN Bypass for Plex Media Server
chdir /d “%~dp0”
if not exist support cd…
echo VPN Bypass for Plex Media Server
echo by XFlak
echo.
::get Default Gateway
ipconfig|findstr /I /C:“Default Gateway”|findstr /I /C:“1”>“%temp%\gateway.txt”
set /p gateway= <“%temp%\gateway.txt”
set gateway=%gateway:*: =%
::echo %gateway%
::If gateway is detected incorrectly, override it by uncommenting the below like (delete :
and input your correct gateway
set gateway=192.168.1.1
echo Getting plex.tv’s current IP addresses…
echo.
echo Note: Log of plex.tv’s routed IP’s saved here:
echo %userprofile%\AppData\Local\Plex Media Server\PermittedPlexIPs.txt
echo.
nslookup “plex.tv”|findstr /I /V “Server: Address: Name: timeout” >“%temp% emp.txt”
findstr /I /C:" " “%temp% emp.txt” >“%temp%\plex.tv.txt”
echo.
cd /d “%temp%”
for /F “tokens=*” %%A in (plex.tv.txt) do call :list %%A
goto:donelist
:list
set PlexIP=%*
set PlexIP=%PlexIP:* =%
set zero=%PlexIP:.=%
set zero=%zero:.=%
set zero=%zero:*.=%
echo set PlexIP=%%PlexIP:%zero%=0%%>“%temp%\plex.bat”
call “%temp%\plex.bat”
echo %PlexIP%
if not exist “%userprofile%\AppData\Local\Plex Media Server\PermittedPlexIPs.txt” goto:skipcheck
findstr /I /C:“%PlexIP%” “%userprofile%\AppData\Local\Plex Media Server\PermittedPlexIPs.txt”>nul
IF NOT ERRORLEVEL 1 (echo IP already routed, skipping…) & (goto:EOF)
:skipcheck
echo route -p add %PlexIP% mask 255.255.255.0 %gateway%
route -p add %PlexIP% mask 255.255.255.0 %gateway%
echo.
echo %PlexIP% >>“%userprofile%\AppData\Local\Plex Media Server\PermittedPlexIPs.txt”
goto:EOF
:donelist
::clean no longer used IPs
echo.
echo Removing routed IPs no longer used by plex.tv
echo.
if exist “%userprofile%\AppData\Local\Plex Media Server\PermittedPlexIPs2.txt” del “%userprofile%\AppData\Local\Plex Media Server\PermittedPlexIPs2.txt”>nul
if not exist “%userprofile%\AppData\Local\Plex Media Server” goto:doneclean
if not exist “%userprofile%\AppData\Local\Plex Media Server\PermittedPlexIPs.txt” goto:doneclean
cd /d “%userprofile%\AppData\Local\Plex Media Server”
for /F “tokens=*” %%A in (PermittedPlexIPs.txt) do call :clean %%A
goto:doneclean
:clean
set PlexIP=%*
findstr /I /C:“%PlexIP:~0,-1%” “%temp%\plex.tv.txt” >nul
IF ERRORLEVEL 1 goto:remove
echo IP still used: %PlexIP%
echo %PlexIP% >>“%userprofile%\AppData\Local\Plex Media Server\PermittedPlexIPs2.txt”
goto:EOF
:remove
echo IP no longer used: route delete %PlexIP%
route delete %PlexIP%
goto:EOF
:doneclean
if exist “%userprofile%\AppData\Local\Plex Media Server\PermittedPlexIPs.txt” del “%userprofile%\AppData\Local\Plex Media Server\PermittedPlexIPs.txt”>nul
if exist “%userprofile%\AppData\Local\Plex Media Server\PermittedPlexIPs2.txt” move /y “%userprofile%\AppData\Local\Plex Media Server\PermittedPlexIPs2.txt” “%userprofile%\AppData\Local\Plex Media Server\PermittedPlexIPs.txt”>nul
echo.
echo Finished, exiting…
@ping 127.0.0.1 -n 3 -w 1000> nul
route print
pause
exit
::Other route commands
::route print
::route -p add 54.241.0.0 mask 255.255.0.0 192.168.2.1
::route delete 54.241.0.0 mask 255.255.0.0
::route -f