LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   DHCP server config issues (https://www.linuxquestions.org/questions/linux-server-73/dhcp-server-config-issues-573797/)

mahengunawardena 07-31-2007 07:04 PM

DHCP server config issues
 
Can some tell me why I get this error message?

/etc/dhcpd.conf line 0: expecting a parameter or declaration

dhcpd.conf file is (example copied off the web)


# Sample /etc/dhcpd.conf
# (add your comments here)
default-lease-time 600;
max-lease-time 7200;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.1.255;
option routers 192.168.1.254;
option domain-name-servers 192.168.1.1, 192.168.1.2;
option domain-name "mydomain.org";

subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.10 192.168.1.100;
range 192.168.1.150 192.168.1.200;
}

appreciate your assistance.

Mahen

risu 08-01-2007 02:04 AM

It is something invisible. Could it be that the lines end with CR-LF, as in DOS, and dhcpd expects only LF, as in unix?

Try 'hexdump -c /etc/dhcpd.conf'. CR is \r and LF is \n.

gani 08-01-2007 04:56 AM

I used your configuration in my Slackware and it worked. The daemon only prompted me of adding a ddns-update-style in the global section. Here is my complete test dhcpd.conf which was originally derived from you.

Code:

# dhcpd.conf
#
# Configuration file for ISC dhcpd (see 'man dhcpd.conf')
#
ddns-update-style interim;
default-lease-time 600;
max-lease-time 7200;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.1.255;
option routers 192.168.1.1;
option domain-name-servers 58.69.254.46, 192.168.1.2;
option domain-name "mydomain.com";

subnet 192.168.1.0 netmask 255.255.255.0 {
        range 192.168.1.10 192.168.1.100;
        range 192.168.1.150 192.168.1.200;
        }

Below is what it shows when dhcpd is started.

Code:

Internet Systems Consortium DHCP Server V3.0.3
Copyright 2004-2005 Internet Systems Consortium.
All rights reserved.
For info, please visit http://www.isc.org/sw/dhcp/
Wrote 1 leases to leases file.
Listening on Socket/eth0/192.168.1/24
Sending on  Socket/eth0/192.168.1/24

And below is my transaction log report. I was able to obtain a lease and connect a windows client.

Code:

# tail -f /var/log/messages

Aug  1 17:31:56 webmaster dhcpd: DHCPREQUEST for 192.168.1.55 (192.168.1.100) from 00:04:76:72:2f:a2 (openbsd) via eth0
Aug  1 17:31:56 webmaster dhcpd: DHCPACK on 192.168.1.55 to 00:04:76:72:2f:a2 (openbsd) via eth0
Aug  1 17:32:19 webmaster dhcpd: DHCPRELEASE of 192.168.1.55 from 00:04:76:72:2f:a2 (openbsd) via eth0 (found)
Aug  1 17:32:27 webmaster dhcpd: DHCPDISCOVER from 00:04:76:72:2f:a2 via eth0
Aug  1 17:32:27 webmaster dhcpd: DHCPOFFER on 192.168.1.55 to 00:04:76:72:2f:a2 (openbsd) via eth0
Aug  1 17:32:28 webmaster dhcpd: DHCPREQUEST for 192.168.1.55 (192.168.1.100) from 00:04:76:72:2f:a2 (openbsd) via eth0
Aug  1 17:32:28 webmaster dhcpd: DHCPACK on 192.168.1.55 to 00:04:76:72:2f:a2 (openbsd) via eth0

---------

sussane 08-01-2007 05:47 AM

I hope you have these two lines on your dhcpd.conf file on top
ddns-update-style interim;
ignore client-updates;


All times are GMT -5. The time now is 04:26 PM.