Copy Code code as follows:
@echo off
::::::::::::::::::::::::::::::::::::::::::::::::::::
: Native and gateway IP and MAC address binding batch program::
::::::::::::::::::::::::::::::::::::::::::::::::::::
Arp-d
:::::::: Read the local MAC address
If exist Ipconfig.txt del Ipconfig.txt
Ipconfig/all >ipconfig.txt
If exist Phyaddr.txt del Phyaddr.txt
Find "Physical Address" ipconfig.txt >phyaddr.txt
for/f "skip=2 tokens=12"%%m in (phyaddr.txt) do set mac=%%m
:::::::: Read native IP address
If exist IPAddr.txt del IPaddr.txt
Find "IP address" ipconfig.txt >ipaddr.txt
for/f "skip=2 tokens=15"%%i in (IPAddr.txt) do set ip=%%i
:::::::: Binding Machine IP address and MAC address
Arp-s%ip%%mac%
:::::::: Read gateway Address
If exist GateIP.txt del GateIP.txt
Find "Default Gateway" Ipconfig.txt >gateip.txt
for/f "skip=2 tokens=13"%%g in (GateIP.txt) do set gateip=%%g
:::::::: Get the Gateway MAC address
Ping 192.168.0.1-n 1
:::::::: Read Gateway MAC address
If exist GateMac.txt del GateMac.txt
Arp-a%gateip% >gatemac.txt
for/f "Skip=3 tokens=2"%%h in (GateMac.txt) do set gatemac=%%h
::::::::: Binding Gateway Mac and IP
Arp-s%gateip%%gatemac%
Del GateIP.txt
Del GateMac.txt
Del IPAddr.txt
Del Ipconfig.txt
Del Phyaddr.txt
Exit
Copy the above code to save as a bat file. Load to startup item, this should be able to protect!