How can I specify which NICs to PXE boot?

This is for discussing general topics about how to use VirtualBox.
Post Reply
danielp
Posts: 3
Joined: 30. May 2017, 20:49

How can I specify which NICs to PXE boot?

Post by danielp »

Hi,
I have setup a Host-only network with my own DHCP/TFTP server; I then have a VM with two NICs, the first on NAT for Internet access, the second on the host-only network I've setup so it boots off my DHCP/TFTP. I would like the VM to attempt a PXE boot only on the 2nd NIC. I've enabled 'network' boot under Settings > System > Motherboard > boot order and observed it attempts a PXE boot on NIC 1 and seems to pick up the VB DHCP PXE booting but then quits as expected since I haven't setup the <host>.pxe file. I would like to disable PXE for NIC1 and enable for NIC2; is this possible?
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: How can I specify which NICs to PXE boot?

Post by socratis »

Possibly... Change NIC1 to be the HostOnly one, and NIC2 to be the NAT one.
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
danielp
Posts: 3
Joined: 30. May 2017, 20:49

Re: How can I specify which NICs to PXE boot?

Post by danielp »

That's a simple workaround; should have thought of it, thanks. Based on your response, do I assume correctly that VB only attempts PXE on NIC1, and there's no way to change/specify alternate behavior?
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: How can I specify which NICs to PXE boot?

Post by socratis »

I've never done PXE booting, so don't go "based on my response". I came up with this "based on your experience" :D

I don't know if it's going to work or not. But, if I take a step back, on my other system, a Win PC with two NICs, I don't recall being able to specify which NIC it should try booting from. I vaguely remember being just NIC-1, but I don't have a PXE server at home as well...
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
Martin
Volunteer
Posts: 2562
Joined: 30. May 2007, 18:05
Primary OS: Fedora other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: XP, Win7, Win10, Linux, OS/2

Re: How can I specify which NICs to PXE boot?

Post by Martin »

A search through the manual found chapter 8.8.2 , the network settings parameters of VBoxManage.
Have a look at "--nicbootprio<1-N>" ;)
danielp
Posts: 3
Joined: 30. May 2017, 20:49

Re: How can I specify which NICs to PXE boot?

Post by danielp »

@socratis - Your suggestion does work: VB seems to attempt PXE on only NIC1, so switching them around works for me.
@Martin - looks like that's it, sweet!
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: How can I specify which NICs to PXE boot?

Post by socratis »

@danielp: Sweet!
(I haven't heard that "Sweet!" in more than 10 years, you woke up memories ;) )

@Martin: Excellent call! I didn't even know that was there. I went in the source code (my latest hobby) and I found this comment that explains the priorities:
src/VBox/Frontends/VBoxManage/VBoxManageModifyVM.cpp wrote:

Code: Select all

/* Somewhat arbitrary limitation - we can pass a list of up to 4 PCI devices
 * to the PXE ROM, hence only boot priorities 1-4 are allowed (in addition to
 * 0 for the default lowest priority).
 */
So, it seems that in a sense the 'nicbootprio' tricks the PXE ROM by "reshuffling" the PCI order of the NIC cards as they're presented to the boot ROM.
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
Post Reply