# Setting up DCHP Server..Resolved

## Davela

I follwed these instructions I found on a thread and everything seemed to be going good until the end. I did the following:

su -

yum install dhcp <ran successfully>

vi /etc/dhcpd.conf

ddns-update-style none;

authoritative;

subnet 192.168.1.0 netmask 255.255.255.0 {

# default gateway

# option routers 192.168.1.1;

option subnet-mask 255.255.255.0;

# option domain-name-servers 192.168.1.1;

range dynamic-bootp 192.168.1.2 192.168.1.99;

default-lease-time 10800;

max-lease-time 21600;

}

From the command prompt executed the following:

chmod 644 /etc/dhcpd.conf

And finally I typed -

service dhcpd start

Then I get the message: 

starting dhcpd:                       [Failed]

Why would it fail?   :Crying or Very sad: 

Please help I am on the verge of finishing this.Last edited by Davela on Thu Feb 16, 2006 11:05 pm; edited 1 time in total

----------

## cyrillic

Hmmm, it looks like you don't have Gentoo installed yet.   :Wink: 

----------

## daeghrefn

yeah, besides this being a Gentoo forum, and not using Gentoo...

Problems with your config are that you don't have any default gateway defined (commented out) and no name servers defined (commented out).  That probably wouldn't keep dhcp from starting, but then again it could.

Oh, and check your logs, it should kick out why it failed to start.  (error in dhcpd.conf perhaps?)

----------

## Davela

I thought it's pretty much all the same....

Linux is linux...right?

----------

## 1clue

Linux is linux:  yes and no.  We'll let you figure that part out for yourself.  Ford, Chevy, Yugo and BMW are all cars, right?  Pretty much interchangeable?  It's all in the implementation.

Technically, this forum is here to help those who are using Gentoo.  However, since I've only installed one time on a box I'm not using for anything, and since I'm answering some non-Gentoo questions, I suppose we can let it slide.

I don't think the default gateway clause is necessary, but I think the routers one is.  Your subnet mask clause is redundant, get it out of there.  Move your lease times down to 1 or 2 minutes for testing, it makes testing a whole lot easier.

Keep a terminal open with 

```
tail -f /var/log/messages
```

 while you do this stuff.  It will tell you what's wrong in there.

----------

## Davela

First off I apologize.. for the mistake. And I'd still appreciate any aasistance.

my /etc/dhcpd.conf has been changed to the following

ddns-update-style none;

authoritative;

subnet 192.168.1.0 netmask 255.255.255.0 { 

option subnet-mask 255.255.255.0;

 option domain-name-servers 192.168.1.1;

range dynamic-bootp 192.168.1.2 192.168.1.99;

default-lease-time 60;

max-lease-time 60;

} 

I ran the command :

tail -f /var/log/messages

I get this long message:

Internet Systems Consortium DHCP Server V3.0.3-RedHat

Copyright 2004-2005 Internet Systems Consortium.

All rights reserved.

For info, please visit http://www.isc.org/sw/dhcp/

/etc/dhcpd.conf line 4: no option named gateway

   default gateway

           ^

Configuration file errors encountered -- exiting

If you did not get this software from ftp.isc.org, please

get the latest from ftp.isc.org and install that before

requesting help.

If you did get this software from ftp.isc.org and have not

yet read the README, please read it before requesting help.

If you intend to request help from the dhcp-server@isc.org

mailing list, please read the section on the README about

submitting bug reports and requests for help.

Please do not under any circumstances send requests for

help directly to the authors of this software - please

send them to the appropriate mailing list as described in

the README file.

exiting.

Thnx again & Sorry again.

----------

## 1clue

For the record, that disclaimer prints every time dhcpd pukes.

Add, inside your subnet, this clause:

```
option routers 192.168.1.1;
```

or whatever your router is supposed to be.

----------

## Davela

Thnx ..

I added that entry and I still get the same thing.

ddns-update-style none;

authoritative;

subnet 192.168.1.0 netmask 255.255.255.0 {

   option routers 192.168.1.1;

  option subnet-mask 255.255.255.0;

   option domain-name-servers 192.168.1.1;

  range dynamic-bootp 192.168.1.2 192.168.1.99;

  default-lease-time 60;

  max-lease-time 60;

}

----------

## 1clue

Same exact error?  The pertinent section is here:

```

/etc/dhcpd.conf line 4: no option named gateway

default gateway

^ 

```

This seems to indicate that on line four you have a section that says" default gateway" which is not a valid DHCP option.  If you haven't sent the entire configuration lately, then this might be your issue.  The routers clause is what defines the gateway for the subnet.

----------

## Davela

I'm sorry it looked the same to me.

Here it is:

Feb 15 16:44:21 localhost dhcpd: Internet Systems Consortium DHCP Server V3.0.3-RedHat

Feb 15 16:44:21 localhost dhcpd: Copyright 2004-2005 Internet Systems Consortium.

Feb 15 16:44:21 localhost dhcpd: All rights reserved.

Feb 15 16:44:21 localhost dhcpd: For info, please visit http://www.isc.org/sw/dhcp/

Feb 15 16:44:21 localhost dhcpd: Can't open lease database /var/lib/dhcpd/dhcpd.leases: Permission denied --

Feb 15 16:44:21 localhost dhcpd:   check for failed database rewrite attempt!

Feb 15 16:44:21 localhost dhcpd: Please read the dhcpd.leases manual page if you

Feb 15 16:44:21 localhost dhcpd: don't know what to do about this.

Feb 15 16:44:21 localhost dhcpd:

Feb 15 16:44:21 localhost dhcpd: If you did not get this software from ftp.isc.org, please

Feb 15 16:44:21 localhost dhcpd: get the latest from ftp.isc.org and install that before

Feb 15 16:44:21 localhost dhcpd: requesting help.

Feb 15 16:44:21 localhost dhcpd:

Feb 15 16:44:21 localhost dhcpd: If you did get this software from ftp.isc.org and have not

Feb 15 16:44:21 localhost dhcpd: yet read the README, please read it before requesting help.

Feb 15 16:44:21 localhost dhcpd: If you intend to request help from the dhcp-server@isc.org

Feb 15 16:44:21 localhost dhcpd: mailing list, please read the section on the README about

Feb 15 16:44:21 localhost dhcpd: submitting bug reports and requests for help.

Feb 15 16:44:21 localhost dhcpd:

Feb 15 16:44:21 localhost dhcpd: Please do not under any circumstances send requests for

Feb 15 16:44:21 localhost dhcpd: help directly to the authors of this software - please

Feb 15 16:44:21 localhost dhcpd: send them to the appropriate mailing list as described in

Feb 15 16:44:21 localhost dhcpd: the README file.

Feb 15 16:44:21 localhost dhcpd:

Feb 15 16:44:21 localhost dhcpd: exiting.

Feb 15 16:44:21 localhost dhcpd: dhcpd startup failed

Feb 15 16:44:21 localhost dhcpd: Internet Systems Consortium DHCP Server V3.0.3-RedHat

Also this is my ifconfig -a 

eth0      Link encap:Ethernet  HWaddr 00:04:5A:5E:EA:2B

          inet6 addr: fe80::204:5aff:fe5e:ea2b/64 Scope:Link

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:7087 errors:0 dropped:0 overruns:0 frame:0

          TX packets:0 errors:5532 dropped:0 overruns:0 carrier:11064

          collisions:0 txqueuelen:1000

          RX bytes:766823 (748.8 KiB)  TX bytes:0 (0.0 b)

          Interrupt:9 Base address:0x4800

eth1      Link encap:Ethernet  HWaddr 00:05:5D:46:C8:16

          inet6 addr: fe80::205:5dff:fe46:c816/64 Scope:Link

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:3460 errors:0 dropped:0 overruns:0 frame:0

          TX packets:12 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000

          RX bytes:235368 (229.8 KiB)  TX bytes:2520 (2.4 KiB)

          Interrupt:10 Base address:0x1000

eth2      Link encap:Ethernet  HWaddr 00:A0:24:F3:5B:40

          BROADCAST MULTICAST  MTU:1500  Metric:1

          RX packets:0 errors:0 dropped:0 overruns:0 frame:0

          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000

          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

          Interrupt:10 Base address:0x300

gre0      Link encap:UNSPEC  HWaddr 00-00-00-00-6C-49-F4-CF-00-00-00-00-00-00-00-00

          NOARP  MTU:1476  Metric:1

          RX packets:0 errors:0 dropped:0 overruns:0 frame:0

          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0

          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

lo        Link encap:Local Loopback

          inet addr:127.0.0.1  Mask:255.0.0.0

          inet6 addr: ::1/128 Scope:Host

          UP LOOPBACK RUNNING  MTU:16436  Metric:1

          RX packets:8888 errors:0 dropped:0 overruns:0 frame:0

          TX packets:8888 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0

          RX bytes:11783390 (11.2 MiB)  TX bytes:11783390 (11.2 MiB)

ppp0      Link encap:Point-to-Point Protocol

          inet addr:66.x.x.45  P-t-P:151.164.184.67  Mask:255.255.255.255

          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1492  Metric:1

          RX packets:5736 errors:0 dropped:0 overruns:0 frame:0

          TX packets:4161 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:3

          RX bytes:559468 (546.3 KiB)  TX bytes:634556 (619.6 KiB)

shaper0   Link encap:Ethernet  HWaddr 00:00:00:00:00:00

          [NO FLAGS]  MTU:1500  Metric:1

          RX packets:0 errors:0 dropped:0 overruns:0 frame:0

          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:10

          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

sit0      Link encap:IPv6-in-IPv4

          NOARP  MTU:1480  Metric:1

          RX packets:0 errors:0 dropped:0 overruns:0 frame:0

          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0

          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

tunl0     Link encap:IPIP Tunnel  HWaddr

          NOARP  MTU:1480  Metric:1

          RX packets:0 errors:0 dropped:0 overruns:0 frame:0

          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0

          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

[root@localhost ~]#

requesting help.

If you did get this software from ftp.isc.org and have not

yet read the README, please read it before requesting help.

If you intend to request help from the dhcp-server@isc.org

mailing list, please read the section on the README about

submitting bug reports and requests for help.

Please do not under any circumstances send requests for

help directly to the authors of this software - please

send them to the appropriate mailing list as described in

the README file.

exiting.

[root@localhost ~]# vi /etc/dhcpd.conf

[root@localhost ~]# ifconfig -a

eth0      Link encap:Ethernet  HWaddr 00:04:5A:5E:EA:2B

          inet6 addr: fe80::204:5aff:fe5e:ea2b/64 Scope:Link

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:7087 errors:0 dropped:0 overruns:0 frame:0

          TX packets:0 errors:5532 dropped:0 overruns:0 carrier:11064

          collisions:0 txqueuelen:1000

          RX bytes:766823 (748.8 KiB)  TX bytes:0 (0.0 b)

          Interrupt:9 Base address:0x4800

eth1      Link encap:Ethernet  HWaddr 00:05:5D:46:C8:16

          inet6 addr: fe80::205:5dff:fe46:c816/64 Scope:Link

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:3460 errors:0 dropped:0 overruns:0 frame:0

          TX packets:12 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000

          RX bytes:235368 (229.8 KiB)  TX bytes:2520 (2.4 KiB)

          Interrupt:10 Base address:0x1000

eth2      Link encap:Ethernet  HWaddr 00:A0:24:F3:5B:40

          BROADCAST MULTICAST  MTU:1500  Metric:1

          RX packets:0 errors:0 dropped:0 overruns:0 frame:0

          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000

          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

          Interrupt:10 Base address:0x300

gre0      Link encap:UNSPEC  HWaddr 00-00-00-00-6C-49-F4-CF-00-00-00-00-00-00-00-00

          NOARP  MTU:1476  Metric:1

          RX packets:0 errors:0 dropped:0 overruns:0 frame:0

          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0

          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

lo        Link encap:Local Loopback

          inet addr:127.0.0.1  Mask:255.0.0.0

          inet6 addr: ::1/128 Scope:Host

          UP LOOPBACK RUNNING  MTU:16436  Metric:1

          RX packets:8888 errors:0 dropped:0 overruns:0 frame:0

          TX packets:8888 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0

          RX bytes:11783390 (11.2 MiB)  TX bytes:11783390 (11.2 MiB)

ppp0      Link encap:Point-to-Point Protocol

          inet addr:66.x.x.45  P-t-P:151.164.184.67  Mask:255.255.255.255

          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1492  Metric:1

          RX packets:5736 errors:0 dropped:0 overruns:0 frame:0

          TX packets:4161 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:3

          RX bytes:559468 (546.3 KiB)  TX bytes:634556 (619.6 KiB)

shaper0   Link encap:Ethernet  HWaddr 00:00:00:00:00:00

          [NO FLAGS]  MTU:1500  Metric:1

          RX packets:0 errors:0 dropped:0 overruns:0 frame:0

          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:10

          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

sit0      Link encap:IPv6-in-IPv4

          NOARP  MTU:1480  Metric:1

          RX packets:0 errors:0 dropped:0 overruns:0 frame:0

          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0

          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

tunl0     Link encap:IPIP Tunnel  HWaddr

          NOARP  MTU:1480  Metric:1

          RX packets:0 errors:0 dropped:0 overruns:0 frame:0

          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0

          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

[root@localhost ~]# ps ax |grep dhcpd

 4644 pts/3    S+     0:00 grep dhcpd

[root@localhost ~]# dhcpd -f

Internet Systems Consortium DHCP Server V3.0.3-RedHat

Copyright 2004-2005 Internet Systems Consortium.

All rights reserved.

For info, please visit http://www.isc.org/sw/dhcp/

Wrote 0 leases to leases file.

Not configured to listen on any interfaces!

If you did not get this software from ftp.isc.org, please

get the latest from ftp.isc.org and install that before

requesting help.

If you did get this software from ftp.isc.org and have not

yet read the README, please read it before requesting help.

If you intend to request help from the dhcp-server@isc.org

mailing list, please read the section on the README about

submitting bug reports and requests for help.

Please do not under any circumstances send requests for

help directly to the authors of this software - please

send them to the appropriate mailing list as described in

the README file.

exiting.Last edited by Davela on Fri Feb 17, 2006 6:49 pm; edited 1 time in total

----------

## pteppic

Try adding 

```
allow unknown-clients;

option broadcast-address 192.168.1.255;
```

----------

## Davela

I made the suggested change my /etc/dhcpd.conf

ddns-update-style none;

authoritative;

ddns-update-style none;

authoritative;

subnet 192.168.1.0 netmask 255.255.255.0 {

allow unknown-clients;

option subnet-mask 255.255.255.0;

option broadcast-address 192.168.1.255;

option domain-name-servers 192.168.1.1;

range dynamic-bootp 192.168.1.2 192.168.1.99;

default-lease-time 60;

max-lease-time 60;

}

[root@localhost ~]# tail -f /var/log/messages

Feb 15 17:43:00 localhost dhcpd: Internet Systems Consortium DHCP Server V3.0.3-RedHat

Feb 15 17:43:00 localhost dhcpd: Copyright 2004-2005 Internet Systems Consortium.

Feb 15 17:43:00 localhost dhcpd: All rights reserved.

Feb 15 17:43:00 localhost dhcpd: For info, please visit http://www.isc.org/sw/dhcp/

Feb 15 17:43:00 localhost dhcpd: Can't open lease database /var/lib/dhcpd/dhcpd.leases: Permission denied --

Feb 15 17:43:00 localhost dhcpd:   check for failed database rewrite attempt!

Feb 15 17:43:00 localhost dhcpd: Please read the dhcpd.leases manual page if you

Feb 15 17:43:00 localhost dhcpd: don't know what to do about this.

Feb 15 17:43:00 localhost dhcpd:

Feb 15 17:43:00 localhost dhcpd: If you did not get this software from ftp.isc.org, please

Feb 15 17:43:00 localhost dhcpd: get the latest from ftp.isc.org and install that before

Feb 15 17:43:00 localhost dhcpd: requesting help.

Feb 15 17:43:00 localhost dhcpd:

Feb 15 17:43:00 localhost dhcpd: If you did get this software from ftp.isc.org and have not

Feb 15 17:43:00 localhost dhcpd: yet read the README, please read it before requesting help.

Feb 15 17:43:00 localhost dhcpd: If you intend to request help from the dhcp-server@isc.org

Feb 15 17:43:00 localhost dhcpd: mailing list, please read the section on the README about

Feb 15 17:43:00 localhost dhcpd: submitting bug reports and requests for help.

Feb 15 17:43:01 localhost dhcpd:

Feb 15 17:43:01 localhost dhcpd: Please do not under any circumstances send requests for

Feb 15 17:43:01 localhost dhcpd: help directly to the authors of this software - please

Feb 15 17:43:01 localhost dhcpd: send them to the appropriate mailing list as described in

Feb 15 17:43:01 localhost dhcpd: the README file.

Feb 15 17:43:01 localhost dhcpd:

Feb 15 17:43:01 localhost dhcpd: exiting.

Feb 15 17:43:01 localhost dhcpd: dhcpd startup failed

----------

## Davela

I am STUPID....

I guess it would hlep if I statically assigned an IP to my nic <eth1=192.168.1.1>. Nic attached to  the outside<eth0=dhcp> is setup for dhcp.

So I ran the command :

- ifconfig eth1 inet up 192.168.1.1

followed by

- service dhcpd start

And TADaw !!!

Starting dhcpd:

[root@localhost ~]#

So what's next ?

----------

## pteppic

Add some static hosts to the config, or install webmin and use the nice easy gui.

Example static host:

```
host laptop {

        ddns-updates on;

        hardware ethernet 00:0d:61:7a:27:7b;

        fixed-address 192.168.1.2;

        }

```

----------

## 1clue

I guess not having the interface configured for IPV4 is going to put a dent in a DHCP configuration that only deals in IPV4.

I hate the gui configuration.  It breaks down after a while somehow.  Uninstall that turkey and use vim to configure everything.

----------

## Davela

I realized that I didn't statically assign the IP to the nic on the LAN. So anyway you have to NIC's in your PC, right. 1) eth0 - DSL/Cable modem<this takes you to Internet> then you have the second. 2) eth1 - hub/switch < connects to the internal network via a hub> Well the nic connecting to the hub on the internal network had to have a static IP assigned to it. Even though you're running DHCP server on this PC, that particular card has to be statically assigned. All the other devices on your network will be automatically assigned. <ie..your 2nd or 3rd PC's...printer..etc.>

So after I statically assigned the IP I then ran the following commands:

- /usr/sbin/dhcpd < When you run this it will say it's listening to the device>

- service dhcpd start <IF the above is successfull this won't read as FAILED>

ANyway this worked in my case.

----------

## Davela

Resolved ...At least this piece.

----------

