您的位置:首页技术文章
文章详情页

freebsd 服务器 ARP绑定脚本

【字号: 日期:2022-06-03 14:19:07浏览:26作者:猪猪
导读:#!/bin/sh _PATH="/home/shwb" if [ -s $_PATH/md5 ] && [ -s $_PATH/arp.txt ] ; then new=`md5 $_PATH/arp.txt | cut -d -f 4` old=`cat $_PATH/md5` if [ "$new" != "$ol
#!/bin/sh
_PATH="/home/shwb"
if [ -s $_PATH/md5 ] && [ -s $_PATH/arp.txt ] ; then
new=`md5 $_PATH/arp.txt | cut -d " " -f 4`
old=`cat $_PATH/md5`
if [ "$new" != "$old" ] ; then
arp -a -d
arp -f $_PATH/arp.txt
date "+DATE: %Y-%m-%d-%H:%M:%S" >>/var/log/arp.log
md5 $_PATH/arp.txt | cut -d " " -f 4 >$_PATH/md5
fi
elif [ -s $_PATH/arp.txt ] ; then
arp -a -d
arp -f $_PATH/arp.txt
date "+DATE: %Y-%m-%d-%H:%M:%S" >>/var/log/arp.log
md5 $_PATH/arp.txt | cut -d " " -f 4 >$_PATH/md5
fi
注arp.txt文件格式为ip mac,如:
192.168.1.1 00:00:00:00:00:00
配合ftp就可以实现远程动态修改服务器的静态MAC表了
相关文章: