问题是arp -a
运行非常缓慢。
vagrant@lucid32:~$ time arp -a
? (10.0.2.3) at 52:54:00:12:35:03 [ether] on eth0
? (10.0.2.2) at 52:54:00:12:35:02 [ether] on eth0
real 0m20.022s
user 0m0.004s
sys 0m0.000s
vagrant@lucid32:~$
我认为这是 virtualbox (4.1.12_77245)、仅主机网络、ubuntu 10.04 和 windows 7 主机操作系统的某种组合的问题。
作为一种解决方法,假设我可以在不知道我的 mac 地址的情况下了解 puppet 的一些知识,我将第 7 行替换/opt/ruby/lib/ruby/gems/1.8/gems/facter-1.6.0/lib/facter/arp.rb
为如下:
require 'facter/util/ip'
Facter.add(:arp) do
confine :kernel => :linux
setcode do
### output = Facter::Util::Resolution.exec('arp -a') # disable for slow arp
output = "" ### return a blank, rather than the real (but slow) arp
if not output.nil?
arp = ""
output.each_line do |s|
if s =~ /^\S+\s\S+\s\S+\s(\S+)\s\S+\s\S+\s\S+$/
arp = $1.downcase
break # stops on the first match
end
end
end
"fe:ff:ff:ff:ff:ff" == arp ? arp : nil
end
end
Facter::Util::IP.get_interfaces.each do |interface|
Facter.add("arp_" + Facter::Util::IP.alphafy(interface)) do
confine :kernel => :linux
setcode do
arp = Facter::Util::IP.get_arp_value(interface)
"fe:ff:ff:ff:ff:ff" == arp ? arp : nil
end
end
end