[root@localhost ~]# cp /dev/null ether
在当前目录新建ether文件
[root@localhost ~]# mv ether /etc/
把ether文件移动到/etc/
[root@localhost ~]# vi /etc/ether
把要绑定的IP和MAC写进去
格式如下:
192.168.0.2 08:00:4E:B0:24:47
[root@localhost ~]# vi /etc/rc.d/rc.local
然后再/etc/rc.d/rc.local最后添加:
arp -f /etc/ether
[root@localhost ~]# arp -f /etc/ether
运行命令
[root@localhost ~]# arp -e
? (192.168.0.2) at 08:00:4E:B0:24:47 [ether] PERM on eth0
[root@localhost ~]# arp 192.168.0.2 Address HWtype HWaddress Flags Mask Iface
192.168.0.2 ether 08:00:4E:B0:24:47 CM eth0
其中带有“CM”标记的是我在/etc/ether文件中添加的,
而其它只带有“C”标记的是linux自动添加的临时项,
iptables的方法:
iptables -A FORWARD -s 10.10.0.2 -m mac --mac-source 00:10:4b:15:16:6c -j ACCEPT
就将 10.10.0.2 与其MAC地址绑定了。


wztatk777 于 2007-03-05 10:42:13发表:
:ha3nd 学习