当前位置: 首页 > 图文教程 > 操作系统 > Unix/Linux > freebsd 服务器 ARP绑定脚本

Unix/Linux
HP工程师经验分享(34)
HP工程师经验分享(33)
HP工程师经验分享(32)
HP工程师经验分享(31)
HP工程师经验分享(30)
HP工程师经验分享(29)
HP工程师经验分享(28)
HP工程师经验分享(27)
HP工程师经验分享(26)
HP工程师经验分享(25)
HP工程师经验分享(24)
HP工程师经验分享(2)
HP工程师经验分享(23)
HP工程师经验分享(22)
HP工程师经验分享(21)
HP工程师经验分享(20)
HP工程师经验分享(19)
HP工程师经验分享(18)
HP工程师经验分享(17)
HP工程师经验分享(16)

Unix/Linux 中的 freebsd 服务器 ARP绑定脚本


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2010-01-15   浏览: 181 ::
收藏到网摘: n/a

#!/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表了