Copy Code code as follows:
#!/bin/bash
Declare gw= ' Route-n | Grep-e ' ^0.0.0.0 '
Declare gwname= ' echo $GW | Grep-oe ' \w*$ '
Declare gwip= ' echo $GW | Grep-oe ' [0-9]\{2,3\}\. [0-9]\{1,3\}\. [0-9]\{1,3\}\. [0-9]\{1,3\} '
Declare gwmac= ' Arp-n | GREP-E $gwip | Grep-oe ' [0-9a-f]\{2\}:[0-9a-f]\{2\}:[0-9a-f]\{2\}:[0-9a-
F]\{2\}:[0-9a-f]\{2\}:[0-9a-f]\{2\} '
echo "Switch $gwname ARP: $GWIP-$gwmac to Static"
Arp-s $gwip $gwmac
echo "done, off ARP reuqest ..."
Ifconfig $gwname-arp
echo "All done."
How to solve the ARP attack under Linux
Windows users can use the Antiarp firewall, can basically solve the problem, but like Linux brothers and sisters How to do it, I met this trouble today.
I used the Fedora Core 6, I first put a few mirror files, with the keyword ARP a search, the search to Arptables, and Arpwatcher first is arpwatcher, it seems to only monitor the local Ip/arp address changes and so on, It does not seem to prevent ARP attacks. Another look arptables, immediately thought of iptables, loaded on a look, sure enough, the command line are identical. But the problem, keep the machine is not subject to ARP attack is very simple (with static ARP binding can be), but the others network Guan Ye or to be attacked, we are not network administrator, Gateway I can only "far view and can not be obscene play"!
Blocked, we diverted, arping this thing into my eyes, back to the shell, found has been installed pull:
"Arping-send ARP REQUEST to a neighbour host" arping [-ABDFHQUV] [-C Count] [-W deadline] [-s source]-I-Interface de Stination-u unsolicited ARP mode to update neighbours ' ARP caches. No replies are expected.
Key commands:
Arping-u-I packet Nic interface-s source IP Destination IP
Instance:
Assuming that your Eth0 interface corresponds to IP 192.168.1.1, the gateway is 192.168.1.255 you can use
Arping-u-I eth0-s 192.168.1.1 192.168.1.255