近来局域网 arp 病毒颇为猖狂,每次设置静态 arp,苦不堪言。
#arp -d 192.168.0.1
#ping 192.168.0.1
#ip neigh list //找出网关 arp
# arp -s 192.168.0.1 GATEWAY_ARP_ADDR
索性写了个 shell 教本,方便每次设置:
#! /bin/sh
# arp util script
E_OPTERR=65
GW_ADDR=192.168.0.1
GW_HW_ADDR=00:e0:fc:xx:xx:xx
if [ "$#" -eq 0 ]
then
echo "Usage $0 -[options d,s,b,t]"
exit $E_OPTERR
fi
set -- `getopt "dsbt :" "$@"`
while [ ! -z "$1" ]
do
case "$1" in
-d) arp -d $GW_ADDR;;
-s) ip neigh list;;
-b) arp -s $GW_ADDR $GW_HW_ADDR;;
-t) ping $GW_ADDR;;
*) break;;
esac
shift
done
exit 0
使用起来 #arputil -dbt 方便不少;
No comments:
Post a Comment