• 用批处理测试MTU


    一个自动测试MTU的批处理。本地测试结果:

    ipaddress:192.168.1.1
    
    try : 1000 [0 , 2000]
    try : 1500 [1000 , 2000]
    try : 1250 [1000 , 1500]
    try : 1375 [1250 , 1500]
    try : 1437 [1375 , 1500]
    try : 1468 [1437 , 1500]
    try : 1484 [1468 , 1500]
    try : 1476 [1468 , 1484]
    try : 1472 [1468 , 1476]
    try : 1474 [1472 , 1476]
    try : 1473 [1472 , 1474]
    try : 1472 [1472 , 1473]
    
    package: 1472
    MTU : 1500
    
    Press any key to continue . . .
    

    脚本:

    @echo off
    chcp 437>nul
    set /p ip=ipaddress:
    if %ip%.==. goto:eof
    echo.

    set con=
    for /f "tokens=1 delims= " %%a in ('ping %ip% -n 1 ^| find "Reply"') do set con=%%a
    if %con%.==. goto:discon

    set min=0
    set max=2000

    :test
    call:try %min% %max%
    if %df%.==. (
    if %min%==%package% goto:result
    set min=%package%
    ) else (
    set max=%package%
    )
    goto:test
    goto:eof

    :result
    echo.
    echo package: %package%
    set /a mtu=%package% + 28
    echo MTU : %mtu%
    echo.
    pause
    goto:eof

    :try
    set /a package=(%1+%2)/2
    echo try : %package% [%1 , %2]
    call:ping %package%
    goto:eof

    goto:eof
    :ping
    set df=
    for /f "tokens=1 delims= " %%a in ('ping %ip% -f -l %1 -n 1 ^| find "DF"') do set df=%%a
    goto:eof

    :discon
    echo Error: can not connect to %ip%
    echo.
    pause
  • 相关阅读:
    数据库高级链表查询,重点可以多看看
    数据库多表查询,一对一关系,一对多关系,多对多关系
    Django基础
    前端之JavaScript
    前端之Jquery
    CF888E Maximum Subsequence-折半搜索
    HNOI2010 平面图判定
    CEOI 2011Traffic
    LuoguP1710 地铁涨价
    Luogu2059 卡牌游戏-概率DP
  • 原文地址:https://www.cnblogs.com/dishuostec/p/2003135.html
Copyright © 2020-2023  润新知