Created
June 3, 2011 22:16
-
-
Save bithive/1007272 to your computer and use it in GitHub Desktop.
ARP for eth0:*
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# ARPs for all the IPs aliased to this machine. | |
data = %x[ifconfig -a].split /\n\n/ | |
data.each do |block| | |
d = /(eth\d:\d+)\s+/.match(block) | |
a = /inet addr:(\d+\.\d+\.\d+\.\d+)/.match(block) | |
next if d.nil? or a.nil? | |
device = d[1] | |
address = a[1] | |
%x[arping -c 3 -I #{device} #{address}] | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment