ubuntu 防止ARP攻击

现在用ubuntu上网经常掉线,但是Windows好像没什么大问题,就在服务器上装了个代理(CCProxy),很好用。

最后发现可能是局域网内有ARP攻击。在网上找了一些方案,发现还是很管用。记录如下:

一、手工绑定arp

1、先使用arp和 arp -a查看一下当前ARP缓存列表

[root@ftpsvr ~]# arp
Address                  HWtype  HWaddress           Flags Mask            Iface
192.168.1.234            ether   00:04:61:AE:11:2B   C                     eth0
192.168.1.145            ether   00:13:20:E9:11:04   C                     eth0
192.168.1.1              ether   00:02:B3:38:08:62   C                     eth0
说明:
Address:主机的IP地址
Hwtype:主机的硬件类型
Hwaddress:主机的硬件地址
Flags Mask:记录标志,”C”表示arp高速缓存中的条目,”M”表示静态的arp条目。

[root@ftpsvr ~]# arp -a
? (192.168.1.234) at 00:04:61:AE:11:2B [ether] on eth0
? (192.168.1.1) at 00:16:76:22:23:86 [ether] on eth0
2、新建一个静态的mac–>ip对应表文件:ip-mac,将要绑定的IP和MAC 地下写入此文件,格式为 ip mac。

[root@ftpsvr ~]# echo ‘192.168.1.1 00:02:B3:38:08:62 ‘ > /etc/ip-mac
[root@ftpsvr ~]# more /etc/ip-mac
192.168.1.1 00:02:B3:38:08:62
3、设置开机自动绑定

[root@ftpsvr ~]# echo ‘arp -f /etc/ip-mac ‘ >> /etc/rc.local

如果开机不能正常绑定的话,应该是dash搞的鬼。办法如下:

#!/bin/sh -e 更改为 #!/bin/sh         (-e表示有命令出错,脚本就会退出运行)

如果还是不行,就在命令前一行加入(sleep 10)。

4、手动执行一下绑定

[root@ftpsvr ~]# arp -f /etc/ip-mac

5、确认绑定是否成功

[root@ftpsvr ~]# arp
Address                  HWtype  HWaddress           Flags Mask            Iface
192.168.0.205            ether   00:02:B3:A7:85:48   C                     eth0
192.168.1.234            ether   00:04:61:AE:11:2B   C                     eth0
192.168.1.1              ether   00:02:B3:38:08:62   CM                    eth0

[root@ftpsvr ~]# arp -a
? (192.168.0.205) at 00:02:B3:A7:85:48 [ether] on eth0
? (192.168.1.234) at 00:04:61:AE:11:2B [ether] on eth0
? (192.168.1.1) at 00:02:B3:38:08:62 [ether] PERM on eth0
从绑定前后的ARP缓存列表中,可以看到网关(192.168.1.1)的记录标志已经改变,说明绑定成功。 

参考:

http://hi.baidu.com/sunxden/blog/item/34fea6d00c5f34df572c84fb.html

http://ubuntuforums.org/showthread.php?t=889846

http://hi.baidu.com/software_one/blog/item/7f85710ba75774ba2eddd480.html

http://ubuntuforums.org/showthread.php?t=1526786

Ubuntu添加开机自动启动程序的方法


  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值