Shell code to prevent ARP attacks _linux shell

Source: Internet
Author: User
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
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.