find_ip_via_arp() does not ensure that ARP cache is primed
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
MAAS |
Won't Fix
|
High
|
Unassigned |
Bug Description
find_ip_via_arp() is the way we find BMCs on a network without having to
track IP addresses. It reads the kernel's ARP cache (via `arp -n`).
However, the kernel's ARP cache gets populated as needed; if the kernel
has not needed to recently look-up a hardware address from the same IP
address then it's possible that the ARP cache will not contain a
matching record.
If a match is not found, we can prime the cache with a broadcast ping:
ping -nbc 3 $broadcast_address
e.g.
ping -nbc 3 192.168.1.255
This would send 3 broadcast pings 1 second apart. Fwiw, I chose 3 out of
the air; 1 ping might be enough, or perhaps we should do 10; we can
experiment.
This appears to help populate the cache so that we can then try
looking-up an IP address again.
Additionally, we should probably use `ip neigh show` as a more modern
replacement for `arp -n`, but maybe it doesn't matter. The output seems
more machine-readable at least.
There is also a user-space ARP daemon that might be worth investigating,
and there may be other options.
Related branches
- MAAS Maintainers: Pending requested
-
Diff: 368 lines (+190/-38)6 files modifiedsrc/provisioningserver/dhcp/leases.py (+32/-3)
src/provisioningserver/dhcp/leases_parser.py (+14/-2)
src/provisioningserver/dhcp/tests/test_leases.py (+61/-1)
src/provisioningserver/dhcp/tests/test_leases_parser.py (+1/-1)
src/provisioningserver/tasks.py (+32/-14)
src/provisioningserver/tests/test_tasks.py (+50/-17)
Changed in maas: | |
importance: | High → Critical |
Changed in maas: | |
importance: | Critical → High |
Changed in maas: | |
status: | Triaged → Won't Fix |
On Wednesday 12 Feb 2014 18:23:23 you wrote:
> ping -nbc 3 192.168.1.255
This doesn't work on my network:
$ ping -nbc 3 192.168.1.255
WARNING: pinging broadcast address
PING 192.168.1.255 (192.168.1.255) 56(84) bytes of data.
--- 192.168.1.255 ping statistics ---
3 packets transmitted, 0 received, 100% packet loss, time 2000ms
I'm not sure if you can rely on all devices responding to broadcast pings.
(Also I'm not sure if it populates the arp cache behind the scenes.)
What we might want to do instead is use a bastardisation of my BMC detection
script which will poke around the network a bit looking for BMCs on the IPMI
port. It uses nmap, but we could emulate its behaviour with a blind scan of
an IP range.