問題是arp -a
運行非常緩慢。
[email protected]:~$ 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
[email protected]:~$
我認爲這是在VirtualBox中的某種組合(4.1.12_77245),僅主機網絡的,Ubuntu 10.04和Windows 7主機操作系統的一個問題。
作爲一種變通方法,假設我可以學到一些關於傀儡沒有它知道我的MAC地址,我換過線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
看起來這是名稱查找可能需要很長時間。嘗試將命令更改爲「arp -an」?如果是這樣的話,理想情況下,您應該修復您的DNS解析器以進行反向查找,但也可能需要填寫一個Puppet bug以添加-n。 – 2012-05-14 22:28:35