Feature request: a way to handle USB Ethernet adapters shared between many hosts
-
@lperoma 1.6.0 can already identify a host by its firmware instead of its MAC. That is the case a shared USB adapter breaks.
At boot, iPXE sends the SMBIOS UUID, the system serial, the board serial and the asset tag. The server matches them against the inventory of every host. The setting FOG Configuration > FOG Settings > FOG_HOST_IDENTIFY_SMBIOS controls what happens with the result:
- off: the MAC decides, as before.
- log (the default): the MAC still decides. Each disagreement goes to the web server error log as a
FOG host identityline. - enforce: when the firmware points at exactly one host, that host wins over the MAC.
Set it to enforce. Then a laptop that FOG already knows by its firmware boots as itself, even with the adapter’s MAC. No MAC moves by hand, and the adapter MAC on another host no longer matters for that boot. A tie (for example two VMs with one UUID) is never trusted. FOG falls back to the MAC in that case.
The precondition: each laptop needs its firmware identity in its host’s inventory. A full FOS inventory or a full registration stores it.
One gap we know about: registering a brand-new laptop through an adapter whose MAC is already on another host. The MAC finds the other host first, so registration says “already registered”. We are looking at that case now. If you can test enforce on a few laptops that are already registered, the
FOG host identitylines in the Apache/PHP error log show what FOG decided for each boot. -
@lperoma A follow-up. While I checked this case, I found a bug that affects shared adapters. It is now fixed.
The bug: at each boot, FOG records the firmware identity onto the host it resolved. With a shared adapter, the MAC resolves to the host the adapter is registered on. So the laptop that booted wrote its UUID onto that other host. In the default
logmode this happened on every boot through the adapter. Over time, it corrupts the identity data thatenforcemode matches on.The fix: FOG now compares the serial numbers first. When the stored system serial and the reported one differ, it is a different machine. FOG writes nothing to that host and logs one
FOG host identityline that says “another machine, nothing recorded”. A motherboard swap that keeps the service tag still updates the UUID as before.To get it: the fix is on the patches channel (dev-branch, PR #2100). Run the updater on that channel, or wait for the next release.
After you update: run a full inventory on any host that a shared adapter booted as. That puts its own serials and UUID back. Then
enforcematches each laptop reliably. -
@Tom-Elliott Thanks so much!
-
@Tom-Elliott Thanks a lot, Tom. I tested it today on 1.6.0.14, with the two files from PR #2100 applied by hand (
SmbiosIdentity.phpandIpxeBootMenu.php) andFOG_HOST_IDENTIFY_SMBIOSset toenforce.I used two Proxmox VMs, both already registered, each with its own UUID. I gave one of them the MAC of the other and booted it by PXE. The menu said
Host is registered as bios-test!, which is the right one, and the log shows what happened:FOG host identity (enforce): MAC resolved "uefi-test" (id 658); SMBIOS resolved "bios-test" (id 659) on sysuuid=795efc04-...; SMBIOS winsBoth inventories were left alone and the MAC stayed on the first host. Without the patch the same thing overwrote the UUID of the host that owned the MAC, as you described.
I also hit the gap you mentioned, with a machine FOG did not know yet. Before registering the second VM I gave it the MAC of the first, and FOG took it for the first host. The agent did the same: the enrollment request of the second VM got attached to the first host (reason
known-host-no-agent). I don’t know if that last part is worth a look on your side.I have only tested VMs so far. The real case is a few laptops that share one USB adapter,
-
@lperoma Thank you for testing this so thoroughly. The
SMBIOS winsline and the untouched inventories are exactly the expected result.The agent part is worth a look, yes. Agent enrollment falls back to the MAC when the firmware matches no host. So an unregistered machine with a known MAC lands on that MAC’s host. Within the deploy window after an image (
FOG_AGENT_ENROLL_DEPLOY_WINDOW, 24 hours by default), that request can be approved without an admin click. I am fixing that so a machine whose serial contradicts the host is never bound to it by MAC.Until the fix is out, set
FOG_AGENT_ENROLL_DEPLOY_WINDOWto 0 if you image through shared adapters. Every enrollment then waits for an approval or a token.Your last post looks cut off after “a few laptops that share one USB adapter,”. Did you mean to add more?
-
@lperoma The agent fix is done (PR #2104).
What changes: suppose the firmware of an enrolling machine matches no host, and only its MAC finds one. If the machine’s serial contradicts the serial stored for that host, FOG no longer binds it as that host’s first agent. The request is recorded as an identity conflict. The deploy window never approves a conflict, so it waits for an admin. An admin can still approve it on purpose, for example after a real motherboard swap. The directory identity check treats the same case as a conflict too.
What does not change:
- An enroll token still approves the request. A token is an admin’s explicit vouch.
- A host with no inventory row has no stored serial to compare, so its MAC still binds as before. Run a full inventory on hosts that share an adapter.
- A request that was already pending before you update keeps its old reason. Deny any such request that you do not recognize.
To get it: it reaches the patches channel when the PR merges. After you update, you can set
FOG_AGENT_ENROLL_DEPLOY_WINDOWback to its default (24) if you set it to 0. -
@Tom-Elliott Thanks a lot Tom, that was fast.
I’m still on 1.6.0.14, and I couldn’t apply #2104 by hand like I did with #2100: it patches
MachineIdentity.php, which doesn’t exist in my version, and the change inEnrollment.phpcalls it. So I’ll wait for the update instead. Do you know which stable release is expected to include it?I’ll also run a full inventory on the hosts that share an adapter, as you suggest, so they have a serial stored. And I’ll report back once I’ve tried it with real laptops.
-
@lperoma The next stable will be auto promoted from dev-branch -> stable on December 11th at some point in the day.
11th of every month is when dev-branch fixes get pulled into stable.
As to the “Version” it will be, it’s however many commits since.
Right now .14 means there were 14 commits after master containing 1.6.0, 158 is the current stable branch meaning 158 total commits since it’s original release.
Some months will be less, some will be much more.
If you wanted you can install dev-branch but I understand the feeling of “well it’s not stable”.
-
Thanks for #2104. The case that is still open for us is PXE registration and the PXE menu.
A new laptop (not in FOG) boots through the shared USB adapter whose MAC is still on another host Y. Its firmware matches no host, so FOG falls back to the MAC and answers “This machine already registered as Y”.
Could the identification order be simply this? Always check UUID and serial first. Use the MAC only when the machine reports no usable firmware data (empty or placeholder values). If it does report firmware data and it matches no host, it is a new machine: offer registration, without moving any MAC and without giving the new host the adapter’s MAC.
It could be a new value of
FOG_HOST_IDENTIFY_SMBIOSsoenforcestays as it is.We understand that iPXE already sends the UUID and serial numbers with every PXE request (
sysuuid,sysserial,mbserial), also when booting through a USB adapter, since the firmware is read from the laptop and not from the NIC. Please correct us if that is wrong for registration.In our case the laptops that boot only through a USB adapter are recent and always report UUID and serial.
Happy to test a patch.
-
@lperoma 1.6.0.14 is an early 1.6.0 build. The current stable release is 1.6.0.158 (November 11), and it has
MachineIdentity.php. #2100 and #2104 are on the patches channel now. They reach stable with the next monthly release on the 11th.On the registration question: yes, iPXE sends
sysuuid,sysserialandmbserialwith every boot, through any NIC. They come from the laptop’s firmware, not from the adapter.PR #2111 adds what you asked for, as a new value for
FOG_HOST_IDENTIFY_SMBIOS:register. It works likeenforce, plus one rule. Suppose a laptop boots on an adapter whose MAC belongs to host Y, and the laptop’s serial is different from Y’s stored serial. Then:- The boot shows the “not registered” menu, so the laptop never runs Y’s task.
- Registration creates a new host for the laptop. Y keeps its MAC.
- The new host gets a generated MAC that starts with
02:. During a task, FOS identifies itself to the server by the host’s MAC, so every host needs one of its own. The network never sees the generated MAC. - After that, the laptop is found by its firmware through any adapter.
Two things to know:
- Y needs a stored serial, so run a full inventory on hosts that share an adapter. With no stored serial, the MAC still decides.
- In
registermode, a motherboard swap that changes the system serial looks like a new machine.
It is on the patches channel now. It reaches stable with the next monthly release on December 11.