4

I want to set up the isc-dhcp-server, but the dhcp.conf file generates an error while testing with dhcpd -t:

...
/etc/dhcp/dhcpd.conf line 6: expecting a parameter or declaration
authoritative;
              ^
Configuration file errors encountered -- exiting
...

cat /etc/dhcp/dhcpd.conf:

# Configuration file for the ISC-DHCP Server 4.3.3
# Default sample file at /etc/dhcp/dhcpd.sample.conf


# global statements:
authoritative;
interface enp30s0;
option routers 192.168.100.1;
option domain-name-servers 192.168.178.1, 192.168.100.1;

subnet 192.168.100.0 netmask 255.255.255.0{
    range 192.168.100.10 192.168.100.110;
    default-lease-time 600;
    max-lease-time 7200;
}

# host declaration
host server {
    hardware ethernet 1c:c1:de:80:76:e8;
    fixed-address 192.168.100.10;
    option host-name "server";
}

host pc {
    hardware ethernet 1C:1B:0D:10:44:71;
    fixed-address 192.168.100.11;
    option host-name "PC";
}

Most of the file is copy & paste from the docs, so I have no idea where the issue can be...

Darth-RPi
  • 43
  • 1
  • 1
  • 5

1 Answers1

1

Your issue seems to lie with the interface enp30s0; line. Since you refer to the options numerically, I don't think you need to specify the interface.

From the dhcpd.conf man page:

option routers 204.254.239.1;

Note that the address here is specified numerically. This is not required - if you have a different domain name for each interface on your router, it's perfectly legitimate to use the domain name for that interface instead of the numeric address. However, in many cases there may be only one domain name for all of a router's IP addresses, and it would not be appropriate to use that name here.

I went line by line recreating your dhcpd.conf with the example file and that is what broke it.

Here is my working version:

# cat /usr/share/doc/dhcp*/dhcpd.conf.sample
# dhcpd.conf
#
# Sample configuration file for ISC dhcpd
#

# option definitions common to all supported networks...
option routers 192.168.100.1;
option domain-name-servers 192.168.178.1, 192.168.100.1;

# If this DHCP server is the official DHCP server for the local
# network, the authoritative directive should be uncommented.
authoritative;

# This is a very basic subnet declaration.
subnet 192.168.100.0 netmask 255.255.255.0 {
  range 192.168.100.10 192.168.100.110;
  default-lease-time 600;
  max-lease-time 7200;
}

# Hosts which require special configuration options can be listed in
# host statements.   If no address is specified, the address will be
# allocated dynamically (if possible), but the host-specific information
# will still come from the host declaration.
host server {
  hardware ethernet 1c:c1:de:80:76:e8;
  fixed-address 192.168.100.10;
  option host-name "server";
}

host pc {
    hardware ethernet 1C:1B:0D:10:44:71;
    fixed-address 192.168.100.11;
    option host-name "PC";
}

Good luck!

Grayson Kent
  • 126
  • 3