防arp(转oneleaf 老大的)
引用:

1) 建立静态ARP表

touch /etc/static_arp_entry
chown root:root /etc/static_arp_entry
chmod 600 /etc/static_arp_entry

2) 编辑/etc/static_arp_entry文件,输入类似内容

192.168.8.90 00:00:00:11:11:11
192.168.8.1 00:00:00:22:22:22

3) arp -s -f /etc/static_arp_entry

我是直接加入两行命令到/etc/init.d/rc.local中
原理是每次系统启动时自动绑定网关IP和MAC
然后禁用ARP协议,这样就OK了!~!~
pjq@pjq-desktop:~$ cat /etc/init.d/rc.local
#! /bin/sh
mount –bind /media/sda5/software/ /var/ftp/winsoft/
mount –bind /media/sda6/music/ /var/ftp/music/
mount –bind /media/sda6/movies/ /var/ftp/movies/
mount –bind /media/sda7/linux/ /var/ftp/linux/
mount –bind /media/sda7/games/ /var/ftp/games/

arp -s 10.0.1.1 00:E0:FC:1C:A8:24
arp -s 10.0.1.112 00:E0:4D:1B:76:9C
ifconfig eth0 -arp

PATH=/sbin:/bin:/usr/sbin:/usr/bin
[ -f /etc/default/rcS ] && . /etc/default/rcS
. /lib/lsb/init-functions

do_start() {
if [ -x /etc/rc.local ]; then
log_begin_msg “Running local boot scripts (/etc/rc.local)”
/etc/rc.local
log_end_msg $?
fi
}

case “$1” in
start)
do_start
;;
restart|reload|force-reload)
echo “Error: argument ‘$1’ not supported” >&2
exit 3
;;
stop)
;;
*)
echo “Usage: $0 start|stop” >&2
exit 3
;;
esac

防arp

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.