Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

MTU Checker

775 views
Skip to first unread message

MP

unread,
May 23, 2002, 4:26:36 PM5/23/02
to
I haven't seen one of these around so I decided to write my own. It is not
very effiencient and that is why I am posting it here. What I am trying to
do is check to see what the value of the MTU should be set to for a
particular network (in particular VPN networks). I am using the following
command to do this

ping -l 1400 -f server.mydomain.com

I was hoping someone could help me modify my batch file so that I can

1) use a loop to decriment the 1400 by 10 rather than hardcoding in
each value
2) Pop up a vb style window with the correct asnwer. I believe that
can done using Windows Scripting Host.

This is intended for 2000 and XP, but it would be nice if I could run it on
all platforms. Any help is always appreciated.

Here's my code.

@echo off
Echo Trying an MTU of 1500
set MTU=1500
ping -l 1500 -f 10.1.0.10 > test.txt
find "Reply" .\test.txt | sort /r | date | find "Reply from" > en#er.bat
echo set value=%%5> enter.bat
call en#er.bat
del en?er.bat > nul
REM echo The value is %value%
if '%value%'=='Reply' goto end

Echo Trying an MTU of 1450
set MTU=1450
ping -l 1450 -f 10.1.0.10 > test.txt
find "Reply" .\test.txt | sort /r | date | find "Reply from" > en#er.bat
echo set value=%%5> enter.bat
call en#er.bat
del en?er.bat > nul
REM echo The value is %value%
if '%value%'=='Reply' goto end

Echo Trying an MTU of 1400
set MTU=1400
ping -l 1400 -f 10.1.0.10 > test.txt
find "Reply" .\test.txt | sort /r | date | find "Reply from" > en#er.bat
echo set value=%%5> enter.bat
call en#er.bat
del en?er.bat > nul
REM echo The value is %value%
if '%value%'=='Reply' goto end

Echo Trying an MTU of 1350
set MTU=1350
ping -l 1350 -f 10.1.0.10 > test.txt
find "Reply" .\test.txt | sort /r | date | find "Reply from" > en#er.bat
echo set value=%%5> enter.bat
call en#er.bat
del en?er.bat > nul
REM echo The value is %value%
if '%value%'=='Reply' goto end

Echo Trying an MTU of 1300
set MTU=1300
ping -l 1300 -f 10.1.0.10 > test.txt
find "Reply" .\test.txt | sort /r | date | find "Reply from" > en#er.bat
echo set value=%%5> enter.bat
call en#er.bat
del en?er.bat > nul
REM echo The value is %value%
if '%value%'=='Reply' goto end

Echo Trying an MTU of 1250
set MTU=1250
ping -l 1250 -f 10.1.0.10 > test.txt
find "Reply" .\test.txt | sort /r | date | find "Reply from" > en#er.bat
echo set value=%%5> enter.bat
call en#er.bat
del en?er.bat > nul
echo The value is "%value%"
if '%value%'=='Reply' goto end

Echo Trying an MTU of 1200
set MTU=1200
ping -l 1200 -f 10.1.0.10 > test.txt
find "Reply" .\test.txt | sort /r | date | find "Reply from" > en#er.bat
echo set value=%%5> enter.bat
call en#er.bat
del en?er.bat > nul
REM echo The value is %value%
if '%value%'=='Reply' goto end
set MTU=Invalid


:end
cls
echo The value you should set the MTU to is %MTU%
pause

Dean Wells

unread,
May 23, 2002, 10:23:20 PM5/23/02
to
Here you go -

[[MTUCHECK.CMD]]
@echo off

:: Begin MTU value at 1500 and decrement by 10 through 1000
for /l %%m in (1500,-10,1000) do (
echo Attempting an MTU of %%m ...
ping -l %%m -f -n 1 google.com | find /i "Reply" >nul
if not errorlevel 1 (
set MTU=%%m
goto :END
) else (
echo FAILED!
echo.
)
)

:END
echo SUCCESS!
echo.
Dialog.vbs "MTU size" The maximum supported MTU is %MTU%.
[[/MTUCHECK]]

[[DIALOG.VBS]]
Option Explicit
' Define dialog timeout at 30 seconds
Const TIMEOUT = 30000

' Declare variables
Dim sBody
Dim oShell
Dim i

' Instantiate necessary object(s)
Set oShell=CreateObject("WScript.Shell")

' Check arguments
if WScript.Arguments.Count = 0 then
Wscript.Quit(0)
end If

' Ignore 1st argument, it's used for the dialog title
For i = 1 To (WScript.Arguments.Count-1)
sBody = sBody & " " & WScript.Arguments(i)
next

' Check arguments
oShell.PopUp sBody & vbCrLf,TIMEOUT,WScript.Arguments(0)

' Terminate the script
wscript.Quit 0
[[/DIALOG.VBS]]

I'm sure there are more efficient ways of handling this but, off the top
of my head, this should suffice.

HTH

Dean

--
Dean Wells [MVP / Windows platform]
MSEtechnology
[[ Please respond to the Newsgroup only regarding posts ]]
R e m o v e t h e m a s k t o s e n d e m a i l


"MP" <MPou...@acsisinc.com> wrote in message
news:ueqk428...@corp.supernews.com...
: I haven't seen one of these around so I decided to write my own. It

:
:
:
:
:


0 new messages