Skip to main content

How to configure DHCP server in Virtualbox CentOS7 VM for Cobbler PXE boot? [Resolved]

I am very new to Virtual Box and try to emulate cobber PXE boot network installation in virtual box

Trying to configure VM1 as PXE/DHCP server and make VM2 as client to get the IP from VM1 DHCP server on network boot for network installation.

But keep on getting IP from host machine where virtual box installed. because of that VM2 could not find the pxeboot files that is present in the VM1.

VM1 dhcp status snippet:

Listening on LPF/enp0s3/08:00:27:86:b1:c6/
Aug 09 19:03:23 localhost.localdomain dhcpd[3305]: Sending on   LPF/enp0s3/08:00:27:86:b1:c6/
Aug 09 19:03:23 localhost.localdomain dhcpd[3305]: Sending on   Socket/fallback/fallback-net
Aug 09 19:03:23 localhost.localdomain systemd[1]: Started DHCPv4 Server Daemon.

VM1 dhcp conf file

ddns-update-style interim;

allow booting;
allow bootp;

ignore client-updates;
set vendorclass = option vendor-class-identifier;

option pxe-system-type code 93 = unsigned integer 16;

subnet netmask {
     option routers   ;
     option domain-name-servers;
     option subnet-mask;
     range dynamic-bootp;
     default-lease-time         21600;
     max-lease-time             43200;
     next-server      ;
     class "pxeclients" {
          match if substring (option vendor-class-identifier, 0, 9) = "PXEClient";
          if option pxe-system-type = 00:02 {
                  filename "ia64/elilo.efi";
          } else if option pxe-system-type = 00:06 {
                  filename "grub/grub-x86.efi";
          } else if option pxe-system-type = 00:07 {
                  filename "grub/grub-x86_64.efi";
          } else if option pxe-system-type = 00:09 {
                  filename "grub/grub-x86_64.efi";
          } else {
                  filename "pxelinux.0";


# group for Cobbler DHCP tag: default

group {
    host {
        hardware ethernet 08:00:27:7f:aa:f1;
        option host-name "";
        option subnet-mask;
        option routers;
        filename "/pxelinux.0";

VM1 adapter setting - server

enter image description here

VM2 Adapter setting - client enter image description here

Upon network boot of VM2, it gets IP instead of as provided in the vm1 dhcp conf file

enter image description here

How to fix this issue?

Question Credit: Mohan
Question Reference
Asked September 19, 2019
Posted Under: Unix Linux
1 Answers

I would recommend setting up a network other than "bridged". DHCP works via broadcast, so any DHCP server on the subnet can respond. To prevent that, you seen your own subnet.

In File > Host Network Manager, you will see the default 'VirtualBox Host-Only Ethernet Adapter'. You can uncheck the "DHCP Server" box to turn of the built in DHCP server. Then, attach your DHCP server VM and your machine you are PXE booting to the Host-Only adapter instead of the bridged one.

credit: Mike Breed
Answered September 19, 2019
Your Answer