“systemctl start dhcpd.service” command not working for PXE server setup

Issues related to configuring your network
Post Reply
akayoshi1
Posts: 11
Joined: 2022/06/23 19:24:48

“systemctl start dhcpd.service” command not working for PXE server setup

Post by akayoshi1 » 2022/07/05 18:39:19

I am trying to setup a PXE server on my laptop on CentOS 7, following the tutorial on:
https://www.linuxtechi.com/configure-px ... ment-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:
```bash
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:
```bash
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:
```bash
#
# 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?

User avatar
jlehtone
Posts: 4523
Joined: 2007/12/11 08:17:33
Location: Finland

Re: “systemctl start dhcpd.service” command not working for PXE server setup

Post by jlehtone » 2022/07/05 19:27:11

The bit of log that systemctl does show does reveal that your machine has at least interface
enp0s20f0u13 and that has address 10.249.6.154.

The dhcpd config configured subnet 172.168.1.0/24 and we know for certain that 10.249.6.154 is not in that subnet.
Does the machine have an address in the 172.168.1.0/24 subnet? It must have and the address cannot be 172.168.1.21--172.168.1.151.

There is also something about interface virbr0. Do you have virtual machines on this host too?


I can't comment details of dhcpd.conf, because I've used dnsmasq for several years. One process that acts as DHCP server, DNS server, and TFTP server -- perfect combo for PXE server.

akayoshi1
Posts: 11
Joined: 2022/06/23 19:24:48

Re: “systemctl start dhcpd.service” command not working for PXE server setup

Post by akayoshi1 » 2022/07/08 14:45:31

@jlehtone, thank you for responding to my post. I was able to get the walkthrough to work by this post on stack exchange: https://unix.stackexchange.com/question ... up-virtual

The only problem is that the solution I found is for virtual machines. I need it for physical machines. I will close this question and repost another question later.

User avatar
TrevorH
Site Admin
Posts: 33191
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: “systemctl start dhcpd.service” command not working for PXE server setup

Post by TrevorH » 2022/07/08 15:24:50

The only problem is that the solution I found is for virtual machines. I need it for physical machines. I will close this question and repost another question later.
There is no difference between a physical machine and a VM for this. You need a network adapter present that has an ip address on it that is in the same subnet that dhcpd will be serving.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

akayoshi1
Posts: 11
Joined: 2022/06/23 19:24:48

Re: “systemctl start dhcpd.service” command not working for PXE server setup

Post by akayoshi1 » 2022/07/19 15:50:25

@TrevorH Here is the new dhcpd.conf file I have made based on input from the user telcoM on the forum:
https://unix.stackexchange.com/question ... up-virtual

# 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";
}
With this new dhcpd.conf file, I am able to get the server and client to connect and recognize each other. However, I now receive a different error:
CLIENT MAC ADDR: 1001B 21 B7 23 B1
GUID: 534D4349 0002 B721 1B00 B7211B00B023
XE-E51 No DHCP or proxyDHCP offers were received
XE-M0F Exiting Intel boot agent.
What is the next thing I need to check?

User avatar
TrevorH
Site Admin
Posts: 33191
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: “systemctl start dhcpd.service” command not working for PXE server setup

Post by TrevorH » 2022/07/19 15:55:57

Firewall rules? Specifically you need to allow UDP ports 67:68inbound on your DHCP server.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

akayoshi1
Posts: 11
Joined: 2022/06/23 19:24:48

Re: “systemctl start dhcpd.service” command not working for PXE server setup

Post by akayoshi1 » 2022/07/19 17:22:43

TrevorH, I have enabled the ports 67 and 68 via firewall-cmd
firewall-cmd --add-port=67/tcp –permanent
firewall-cmd --add-port=67/udp –permanent
firewall-cmd --add-port=68/tcp –permanent
firewall-cmd --add-port=68/udp –permanent
and firewall-cmd --reload
But I still get the same error. I have checked dhcpd.conf, xintd, vsftpd, and via systemctl status and this is what I get:

[root@localhost admin]# systemctl status dhcpd.service -l
● dhcpd.service - DHCPv4 Server Daemon
Loaded: loaded (/usr/lib/systemd/system/dhcpd.service; enabled; vendor preset: disabled)
Active: active (running) since Tue 2022-07-19 09:28:50 EDT; 3min 9s ago
Docs: man:dhcpd(8)
man:dhcpd.conf(5)
Main PID: 6121 (dhcpd)
Status: "Dispatching packets..."
Tasks: 1
CGroup: /system.slice/dhcpd.service
└─6121 /usr/sbin/dhcpd -f -cf /etc/dhcp/dhcpd.conf -user dhcpd -group dhcpd --no-pid

Jul 19 09:28:50 localhost.localdomain dhcpd[6121]: Internet Systems Consortium DHCP Server 4.2.5
Jul 19 09:28:50 localhost.localdomain dhcpd[6121]: Copyright 2004-2013 Internet Systems Consortium.
Jul 19 09:28:50 localhost.localdomain dhcpd[6121]: All rights reserved.
Jul 19 09:28:50 localhost.localdomain dhcpd[6121]: For info, please visit https://www.isc.org/software/dhcp/
Jul 19 09:28:50 localhost.localdomain dhcpd[6121]: Not searching LDAP since ldap-server, ldap-port and ldap-base-dn were not specified in the config file
Jul 19 09:28:50 localhost.localdomain dhcpd[6121]: Wrote 0 leases to leases file.
Jul 19 09:28:50 localhost.localdomain dhcpd[6121]: Listening on LPF/virbr0/52:54:00:24:7e:22/192.168.1.0/24
Jul 19 09:28:50 localhost.localdomain dhcpd[6121]: Sending on LPF/virbr0/52:54:00:24:7e:22/192.168.1.0/24
Jul 19 09:28:50 localhost.localdomain dhcpd[6121]: Sending on Socket/fallback/fallback-net
Jul 19 09:28:50 localhost.localdomain systemd[1]: Started DHCPv4 Server Daemon.

[root@localhost admin]# systemctl status xinetd -l
● xinetd.service - Xinetd A Powerful Replacement For Inetd
Loaded: loaded (/usr/lib/systemd/system/xinetd.service; enabled; vendor preset: enabled)
Active: active (running) since Tue 2022-07-19 06:26:56 EDT; 3h 5min ago
Main PID: 1691 (xinetd)
Tasks: 1
CGroup: /system.slice/xinetd.service
└─1691 /usr/sbin/xinetd -stayalive -pidfile /var/run/xinetd.pid

Jul 19 06:26:56 localhost.localdomain xinetd[1691]: removing daytime
Jul 19 06:26:56 localhost.localdomain xinetd[1691]: removing discard
Jul 19 06:26:56 localhost.localdomain xinetd[1691]: removing discard
Jul 19 06:26:56 localhost.localdomain xinetd[1691]: removing echo
Jul 19 06:26:56 localhost.localdomain xinetd[1691]: removing echo
Jul 19 06:26:56 localhost.localdomain xinetd[1691]: removing tcpmux
Jul 19 06:26:56 localhost.localdomain xinetd[1691]: removing time
Jul 19 06:26:56 localhost.localdomain xinetd[1691]: removing time
Jul 19 06:26:56 localhost.localdomain xinetd[1691]: xinetd Version 2.3.15 started with libwrap loadavg labeled-networking options compiled in.
Jul 19 06:26:56 localhost.localdomain xinetd[1691]: Started working: 1 available service

[root@localhost admin]# systemctl status vsftpd -l
● vsftpd.service - Vsftpd ftp daemon
Loaded: loaded (/usr/lib/systemd/system/vsftpd.service; enabled; vendor preset: disabled)
Active: active (running) since Tue 2022-07-19 06:26:56 EDT; 3h 5min ago
Main PID: 1692 (vsftpd)
Tasks: 1
CGroup: /system.slice/vsftpd.service
└─1692 /usr/sbin/vsftpd /etc/vsftpd/vsftpd.conf

Jul 19 06:26:56 localhost.localdomain systemd[1]: Starting Vsftpd ftp daemon...
Jul 19 06:26:56 localhost.localdomain systemd[1]: Started Vsftpd ftp daemon.

akayoshi1
Posts: 11
Joined: 2022/06/23 19:24:48

Re: “systemctl start dhcpd.service” command not working for PXE server setup

Post by akayoshi1 » 2022/08/02 13:24:42

Okay, after a linux wizard at my work helped me out, my problem is solved for now. Thank you for everything.

Post Reply