看看于震的
http://www.hatoyu.com/wordpress/2007/06/08/796.html
再贴个批处理
@echo off
:::::::::::::清除所有的ARP缓存
arp -d
:::::::::::::读取本地连接配置
ipconfig /all>ipconfig.txt
:::::::::::::读取内网网关的IP
for /f "tokens=13" %%I in ('find "Default Gateway" ipconfig.txt') do set GatewayIP=%%I
:::::::::::::PING三次内网网关
ping %GatewayIP% -n 3
:::::::::::::读取与网关arp缓存
arp -a|find "%GatewayIP%">arp.txt
:::::::::::::读取网关MAC并绑定
for /f "tokens=1,2" %%I in ('find "%GatewayIP%" arp.txt') do if %%I==%GatewayIP% arp -s %%I %%J
:::::::::::::读取本机的 IP+MAC
for /f "tokens=15" %%i in ('find "IP Address" ipconfig.txt') do set ip=%%i
for /f "tokens=12" %%i in ('find "Physical Address" ipconfig.txt') do set mac=%%i
:::::::::::::绑定本机的 IP+MAC
arp -s %ip% %mac%
:::::::::::::删除所有的临时文件
del ipconfig.txt
del arp.txt
exit