Re: PSA: Simple Wi-Fi gateway killswitch that works with OpenVPN config files
Maria Sophia <[email protected]> Fri, 17 Jul 2026 14:23:21 -0400
| Newsgroups | alt.comp.os.windows-10,alt.comp.os.windows-11,alt.comp.microsoft.windows |
|---|---|
| Organization | BWH Usenet Archive (https://usenet.blueworldhosting.com) |
| Message-ID | <[email protected]> |
Maria Sophia wrote:
> Drat. I ran a comprehensive set of tests with this nettest.bat script, and
> it turned out that I needed to *remove* the openvpn directive I had added.
Oops. I forgot to add the nettest.bat script I used to debug the network.
:: ------------------------------------------------------------------------
:: nettest.bat
:: Diagnostic file for debugging VPN-killswitch and VPN-routing analysis.
:: Designed to output important network metrics into a short log file.
:: Designed to be easily customizable to add/subtract commands as needed.
:: ------------------------------------------------------------------------
:: v1p4 20260717
:: Adds additional debugging that has reasonably short output
:: arp -a
:: netsh interface ipv4 show subinterfaces
:: netsh interface ipv4 show interfaces
:: netsh interface ipv4 show addresses
:: netsh interface ipv4 show route
:: netsh interface ipv4 show wins
:: netstat -rn
:: powershell Get-NetAdapter
:: v1p3 20260716
:: Adds a user comment field at the top of the log for the future you.
:: v1p2 20260715
:: Prints the filename at the top of the log and pauses so the gvim
:: line remains so it can be copied & pasted to Win+R for efficiency.
:: v1p1 20260714
:: Outputs to a single short log file timestamped as YYYYMMDDHHMM,
:: prints commands, and outputs where to find the logfile for viewing.
:: v1p0 20260713
:: Outputs network debugging into short individual log files.
:: netsh interface ipv4 show route
:: netsh interface ipv4 show interfaces
:: netsh interface ipv4 show addresses
:: curl icanhazip.com
:: tracert 8.8.8.8
:: These useful commands output too much to keep the log file short.
:: route print -4
:: ipconfig /all
:: netstat -an
:: ------------------------------------------------------------------------
@echo off
setlocal enabledelayedexpansion
:: Ask user for a comment
set /p usercomment=Enter comment for this log (e.g., "before VPN"):
:: Extract date parts from locale-dependent %date%
for /f "tokens=2-4 delims= " %%a in ("%date%") do (
for /f "tokens=1-3 delims=/" %%x in ("%%a") do (
set mm=%%x
set dd=%%y
set yyyy=%%z
)
)
:: Extract time parts from %time%
for /f "tokens=1-2 delims=: " %%a in ("%time%") do (
set hh=%%a
set nn=%%b
)
:: Remove leading spaces from hour
set hh=%hh: =%
:: Build timestamp YYYYMMDDHHMM
set stamp=%yyyy%%mm%%dd%%hh%%nn%
:: Define the output directory
set out=C:\tmp\nettest
if not exist "%out%" mkdir "%out%"
:: Define the output file
set logfile=%out%\%stamp%nettest.log
echo Writing diagnostics to %logfile%
echo.
:: Write filename and user comment at top of log
echo LOGFILE: %logfile% > "%logfile%"
echo COMMENT: %usercomment% >> "%logfile%"
echo. >> "%logfile%"
:: Commands to run
for %%C in (
"netsh interface ipv4 show route"
"netsh interface ipv4 show interfaces"
"netsh interface ipv4 show addresses"
"arp -a"
"netsh interface ipv4 show subinterfaces"
"netstat -rn"
"powershell Get-NetAdapter"
"route print -4"
"curl icanhazip.com"
"tracert 8.8.8.8"
) do (
echo =============================================================== >> "%logfile%"
echo COMMAND: %%~C >> "%logfile%"
echo --------------------------------------------------------------- >> "%logfile%"
%%~C >> "%logfile%"
echo. >> "%logfile%"
)
echo.
echo Log complete.
echo gvim "%logfile%" >> "%logfile%"
echo gvim "%logfile%"
echo.
pause
endlocal
exit /b
:: end of nettest.bat
--
Usenet allows purposefully helpful people to pool their experiences.