0

I am trying to setup a PXE server on my laptop on CentOS 7 to connect to a physical test client, following the tutorial on: https://www.linuxtechi.com/configure-pxe-installation-server-centos-7/#comment-35567

All of the configuration files and setup procedures are from this website. On “Step: 6 Start and enable xinetd, dhcp, and vsftpd service.”, The commands: “systemctl start xinetd” and “systemctl enable xinetd” work, but when I run the command: “systemctl start dhcpd.service”, I receive the following error message:

Job for dhcpd.service failed because the control process exited with error code. See “systemctl status dhcpd.service” and “journalctl -xe” for details.

When I run “systemctl status -l dhcpd.service”, I receive the following error message:

systemctl status -l dhcpd.service
 dhcpd.service - DHCPv4 Server Daemon
   Loaded: loaded (/usr/lib/systemd/system/dhcpd.service; disabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Tue 2022-07-05 11:18:07 EDT; 1min 12s ago
     Docs: man:dhcpd(8)
           man:dhcpd.conf(5)
  Process: 11655 ExecStart=/usr/sbin/dhcpd -f -cf /etc/dhcp/dhcpd.conf -user dhcpd -group dhcpd --no-pid (code=exited, status=1/FAILURE)
 Main PID: 11655 (code=exited, status=1/FAILURE)

Jul 05 11:18:07 localhost.localdomain dhcpd[11655]:    to which interface virbr0 is attached. **
Jul 05 11:18:07 localhost.localdomain dhcpd[11655]: 
Jul 05 11:18:07 localhost.localdomain dhcpd[11655]: 
Jul 05 11:18:07 localhost.localdomain dhcpd[11655]: No subnet declaration for enp0s20f0u13 (10.249.6.154).
Jul 05 11:18:07 localhost.localdomain dhcpd[11655]: ** Ignoring requests on enp0s20f0u13.  If this is not what
Jul 05 11:18:07 localhost.localdomain dhcpd[11655]:    you want, please write a subnet declaration
Jul 05 11:18:07 localhost.localdomain systemd[1]: dhcpd.service: main process exited, code=exited, status=1/FAILURE
Jul 05 11:18:07 localhost.localdomain systemd[1]: Failed to start DHCPv4 Server Daemon.
Jul 05 11:18:07 localhost.localdomain systemd[1]: Unit dhcpd.service entered failed state.
Jul 05 11:18:07 localhost.localdomain systemd[1]: dhcpd.service failed.

Also here is the Dhcpd.conf file:

#
# DHCP Server Configuration file.
#   see /usr/share/doc/dhcp*/dhcpd.conf.example
#   see dhcpd.conf(5) man page
#
# DHCP Server Configuration file.
ddns-update-style interim;

ignore client-updates;

authoritative;

allow booting;

allow bootp;

allow unknown-clients;

# internal subnet for my DHCP Server

subnet 172.168.1.0 netmask 255.255.255.0 {

range 172.168.1.21 172.168.1.151;

option domain-name-servers 172.168.1.11;

option domain-name "pxe.example.com";

option routers 172.168.1.11;

option broadcast-address 172.168.1.255;

default-lease-time 600;

max-lease-time 7200;

# IP of PXE Server

next-server 172.168.1.11;

filename "pxelinux.0";

}

What do I need to change in my dhcpd.conf file to make the command “systemctl start dhcpd.service” work so I can finish going through the PXE server tutorial?

2 Answers 2

0

dhcpd is not detecting any network interface that would be already configured with an IP address in the 172.168.1.0 subnet, and so it cannot figure out which network interface it should use to provide its services.

And no, you cannot use the DHCP server you're starting to assign an IP address to the system that is actually running the DHCP server.

Apparently your system has a physical network interface enp0s20f0u13 with IP address 10.249.6.154. That address is part of the "RFC 1918" private IP address ranges, which can be used by anyone.

On the other hand, the addresses used in the tutorial you're following are actually in use by Microsoft so you should not copy the configuration from the tutorial as-is, but instead use one of the private address ranges, or a subsection of it.

The other two private IP address ranges are 172.16.0.0 ... 172.31.255.255 and 192.168.0.0 ... 192.168.255.255, so maybe the writer of the tutorial was thinking of using either of these, and managed to mix it up? There is actually another set of smaller IP address ranges assigned specifically to be used in written documentation, to minimize the chances of anyone copying a configuration directly from a tutorial accidentally usurping an IP address that is actually in use.

If you are planning to use your PXE server with virtual machines in your laptop, you should begin by configuring the virbr0 virtual bridge interface with an IP address. You might assign something like 192.168.1.1/24 for it (note: the /24 at the end is a shorter way of saying "netmask 255.255.255.0"). Since that interface is going to be the default gateway IP address for your VMs, you should not configure a default gateway address for the virbr0 interface: your laptop probably already has a default gateway for its external interface, and one default gateway on a system is enough for most usual cases.

Once you have virbr0 configured, you can configure your DHCP server like this:

[...]
# internal subnet for my DHCP Server
subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.21 192.168.1.151;
option domain-name-servers 192.168.1.1;
option domain-name "pxe.domain.example";

# this should match the IP address of the virbr0 interface
option routers 192.168.1.1;

option broadcast-address 192.168.1.255;
default-lease-time 600;
max-lease-time 7200;

# IP of PXE Server; this should also match the IP address of the virbr0 interface
next-server 192.168.1.1;

filename "pxelinux.0";
}

Now, the DHCP server should detect that the subnet 192.168.1.0 netmask 255.255.255.0 declaration matches the IP address and netmask configured for interface virbr0 and automatically start serving on that interface.

This should allow you to complete the tutorial, and then you would be ready to start setting up virtual machines on your laptop, booting the installer by PXE.

If you want to PXE boot physical machines, you should do it in a network segment that has no other DHCP servers. If two DHCP servers have not been specifically configured to cooperate with each other, they will compete for clients instead, which could cause your PXE boot attempts to frustratingly work only some of the time.

(It is technically possible to set up a second DHCP server for PXE booting without touching the configuration of the first one, but I count that as "dirty tricks you should avoid, unless you know what you are doing and have absolutely no way to do it correctly in the first place.")

2
  • I do need the PXE server on the laptop to connect to a physical test machine. I apologize, I edited the original post to now say that. Your explanation allowed me to finish the tutorial, but I actually need to PXE boot into a separate physical test machine. How do I do that in network segments with no other DHCP servers?
    – akayoshi1
    Jul 7, 2022 at 15:14
  • Better idea, I renamed this post as the PXE server for virtual. I will give you the checkmark to finalize this post, because your answer helped me finish the walkthrough. I will post another question specifically for a PXE server to network boot a separate physical client machine with no virtualization.
    – akayoshi1
    Jul 8, 2022 at 14:17
0

I agree, that you need to configure your network coherently. Also it should be useful for helpers, if you describe your goal a bit. It looks you are using a Centos Linux, hence one can assume that you may be an experienced linux user. So you can read some other sources of system information e.g. /var/log/systemlog or /var/log/messages.

The main reason the DHCP server did not start is that you have configured your NIC (interface named enp0s20f0u13) to IP:10.249.6.154. But you kept the given example configuration without respect to your real existing configuration.

To configure the BootP server for PXE boot, you need to tune up together some important component: DHCP server, TFTP server, Syslinux (pxelinux), and probably also domain name server (bind?). Good new for you is, that the package dnsmasq does all these functions except Syslinux. So it can make your configuration more simple. It should be noted that TFTP server (ThinyFTP) is not able to serve files greater than 500MB, hence if your ISO image is greater, you need to use lpxelinux and some mini http server (I use lighttpd). I you write here more information about your project, and if you are interested in dnsmasq solution, wait to next day, because I am out of my office where I can copy the important rows of my dnsmask.conf and give some other hints.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.