win10 自己DIY的arp绑定小脚本

@echo off&mode con cols=80 lines=22&title ARP_bind Tools
setlocal enabledelayedexpansion


rem  Admin identity esxit 
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"

if '%errorlevel%' NEQ '0' (

    echo Must administrator privilege...
    pause >nul
    exit
)



rem ARP_bind esxit
arp -a |findstr /i "static"|findstr /i "0.1" >nul 2>&1  # 这里的0.1 是你网关ip地址的最后2位(例如:192.168.0.1,这里就是0.1)

if '%errorlevel%' NEQ '0' (

    netsh -c i i add neighbors "xxx" "x.x.x.x" "xx-xx-xx-xx-xx-xx"  # 这里的xxx: 网卡名,  x.x.x.x:ip地址   xx-xx-xx-xx-xx-xx:Mac地址
    echo arp bind success
    pause >nul
    exit
)


echo already bind...
arp -a |findstr /i "static"|findstr /i "0.1"
pause >nul

 

Tips: 这里顺便普及下netsh这个工具的一些常用命令

netsh -c i i  下面可以通过show进行查询,add进行添加,delete进行删除

 

# 成功绑定后你将看到你的mac地址表里面有static字样(中文版系统提示的是 “静态”)

arp -a

 

posted @ 2018-09-03 14:30  Cong0ks  阅读(1383)  评论(0编辑  收藏  举报