iVentoy and Third-part DHCP Server

  • 1. Background

The first step of PXE progress is that the client will send DHCP request for IP address. So there must be a DHCP server in the network.
iVentoy contains an internal DHCP Server and you can use it in most simple usage scenarios.
iVentoy can also work together with external DHCP Server.

Attention: the external DHCP server must support configuration for next-server and bootfile options.

  • 2. Bootfile

When iVentoy works together with the third-party DHCP Server, it no longer provides the function of DHCP Server itself, but only serves as a file server to provide file download services.
When the client start PXE booting, it will firstly send DHCP request packet to the DHCP server to get IP address and next-server and bootfile option.
Then the client will download the bootfile from next-server (iVentoy) with TFTP. After that the bootfile will boot and show the boot menu.

One difficult thing to deal with here is that the client may be in Legacy BIOS mode or UEFI mode, and the bootfiles are different for Legacy BIOS mode and UEFI mode.
If the client is UEFI mode and iVentoy send it the Legacy BIOS mode bootfile, then the client will hang.

Well, is there a way to determine whether the client is in Legacy BIOS mode or UEFI mode (and IA32 UEFI mode and ARM64 UEFI mode)?
Yes!
When the client start PXE booting, it will firstly send DHCP request packet to the DHCP server to get IP address. There is information in the request packet to identify the client's BIOS mode. However, the information only exist in the DHCP request packet, when the client get the IP address and download bootfile from iVentoy, iVentoy still cannot know the client's BIOS mode.

So here iVentoy provides two different methods to solve this problem for different scenarios corresponding to two different DHCP Server modes.
That is External mode and ExternalNet mode.

  • 2.1 External Mode

The usage scenario of External mode is that iVentoy and the third-party DHCP Server are located in the same LAN/VLAN.
In this mode, iVentoy will still start its internal DHCP server, but the internal DHCP server will only snoop the DHCP packet and will not send any response. So it will not interfere with the work of the external DHCP Server.
By snooping the DHCP packet, iVentoy will record the client's BIOS mode, when the client request bootfile through TFTP, iVentoy will send it the right bootfile.
So in this mode, the DHCP server does not need to care about the client's BIOS mode. It only provides a common bootfile name (for example iventoy_loader_16000)
The bootfile name is actually a virtual file name. iVentoy will provide the real bootfile to the client according to its BIOS mode.

  • 2.2 ExternalNet Mode

The usage scenario of ExternalNet mode is that iVentoy and the third-party DHCP Server are located in different LANs/VLANs.
In this mode, iVentoy can not snoop the DHCP packet, because the DHCP packet is isolated in the LAN/VLAN where the client is located, it cannot reach iVentoy.
So iVentoy will not start its internal DHCP server at all. So how to distinguish the bootfile in this mode? It's done by the third-part DHCP server.
That is to say, in this mode, the third-part DHCP server must dynamically provides different bootfile options according to the information in the client's DHCP request packet.
For example, if the client is Legacy BIOS mode, then the bootfile option value should be iventoy_loader_16000_bios, if the client is UEFI mode, then the bootfile option value should be iventoy_loader_16000_uefi
Therefore, this mode has high requirements for the third-party DHCP server, which must be able to dynamically set the bootfile option according to the information in the DHCP request packet.
Most DHCP Servers do not support this advanced feature (even some DHCP Servers do not even support the configuration of next-server and bootfile options).
The linux DHCP server supports this feature. For example you can config /etc/dhcp/dhcpd.conf as follows:

subnet 10.0.0.0 netmask 255.255.255.0 {
    option routers 10.0.0.254;
    range 10.0.0.2 10.0.0.253;

    class "pxeclients" {
        match if substring (option vendor-class-identifier, 0, 9) = "PXEClient";
        next-server 10.0.0.1;

        if option architecture-type = 00:07 {
            filename "iventoy_loader_16000_uefi";
        } else {
            filename "iventoy_loader_16000_bios";
        }
    }
}

Of course, if all your computers are in UEFI mode, then you can use ExternalNet mode even if the third-party DHCP Server does not support this advanced feature.
You can just configure the bootfile value directly according to UEFI mode.

  • 3. How to use

1. Choose DHCP Server Mode with Extenal or ExtenalNet in Configuration page as follows.


2. Set next-server option value to the iVentoy IP address in the third-part DHCP server.

3. For External mode, set bootfile option value to iventoy_loader_16000
    Note that the suffix 16000 is the iVentoy http server port, if you change it on the page then the bootfile should match it. (For example: iventoy_loader_17000).

4. For ExternalNet mode, the bootfile option value should be set according to the client's BIOS mode.
    iventoy_loader_16000_bios or iventoy_loader_16000_uefi or iventoy_loader_16000_ia32 or iventoy_loader_16000_aa64