LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 08-25-2008, 10:43 AM   #1
custangro
Senior Member
 
Registered: Nov 2006
Location: California
Distribution: Fedora , CentOS , RHEL
Posts: 1,978
Blog Entries: 1

Rep: Reputation: 209Reputation: 209Reputation: 209
Dhcpd.conf file - Best practices?


Hello,

I have a dhcpd.conf file that looks like this

Code:
authoritative;
ddns-update-style interim;
default-lease-time 28800;
max-lease-time 28800;

        option routers                  192.168.2.1;
        option broadcast-address        192.168.2.255;
        option subnet-mask              255.255.255.0;
        option domain-name-servers      192.168.2.225, 192.168.2.223;
        option domain-name              "mydomain.org";

        subnet 192.168.2.0 netmask 255.255.255.0 {
             pool {
                range 192.168.2.205 192.168.2.212;
                host it-laptop {
                hardware ethernet 00:16:cb:99:50:e0;
                }
                host hr-laptop {
                hardware ethernet 00:16:cb:a9:0b:fc;
                }
                deny unknown-clients;
             }
}
Which works...(kinda...it sometimes has touble giving up the lease...); but I've read articles/man pages that leads me to believe that the conf file should look like this...

Code:

        subnet 192.168.2.0 netmask 255.255.255.0 {
             pool {
               authoritative;
               ddns-update-style interim;
               default-lease-time 28800;
               max-lease-time 28800;
               option routers                  192.168.2.1;
               option broadcast-address        192.168.2.255;
               option subnet-mask              255.255.255.0;
               option domain-name-servers      192.168.2.225, 192.168.2.223;
               option domain-name              "mydomain.org";

                range 192.168.2.205 192.168.2.212;
                host it-laptop {
                hardware ethernet 00:16:cb:99:50:e0;
                }
                host hr-laptop {
                hardware ethernet 00:16:cb:a9:0b:fc;
                }
                deny unknown-clients;
             }
}
What is the "best practice" with dhcpd.conf file?

Thanks,

-C

** I'm running this on CentOS 5.2
 
Old 08-25-2008, 01:36 PM   #2
ajg
Member
 
Registered: Nov 2005
Location: The People's Republic of South Yorkshire
Distribution: FC3, CentOS4&5, Hardy Heron, Mythbuntu
Posts: 62

Rep: Reputation: 15
It all depends on what your're tring to achieve. TBQH I hate "best practice" stuff because it implies a prescriptive approach. Not everybody works the same way, so there are always exeptions.

The two examples you have a perfectly valid.

Your first example, the router, mask, lease time, etc. are global options and will be applied to any subnet listed. They work like a set of default settings so you don't have to worry about configuring them for each subnet requiring DHCP services. Some of these are fine to have as globals like the leas time and the ddns update style. The router and subnet mask could be a problem if you're DHCPing more than a single IP subnet however.

The second example has all the options attached to the DHCP pool, so there are no defaults and any additional subnets which need to be DHCPed all need to be configured independantly.

Reading between the lines a little, I suspect that you only have one subnet, so it doesn't really matter - either solution is good for your purposes.

If you were looking at expanding the network later, I would probably move the router, broadcast and mask into the pool, as these options are generally invalid for other pools.
 
Old 08-25-2008, 01:58 PM   #3
custangro
Senior Member
 
Registered: Nov 2006
Location: California
Distribution: Fedora , CentOS , RHEL
Posts: 1,978

Original Poster
Blog Entries: 1

Rep: Reputation: 209Reputation: 209Reputation: 209
Quote:
Originally Posted by ajg View Post
It all depends on what your're tring to achieve. TBQH I hate "best practice" stuff because it implies a prescriptive approach. Not everybody works the same way, so there are always exeptions.

The two examples you have a perfectly valid.

Your first example, the router, mask, lease time, etc. are global options and will be applied to any subnet listed. They work like a set of default settings so you don't have to worry about configuring them for each subnet requiring DHCP services. Some of these are fine to have as globals like the leas time and the ddns update style. The router and subnet mask could be a problem if you're DHCPing more than a single IP subnet however.

The second example has all the options attached to the DHCP pool, so there are no defaults and any additional subnets which need to be DHCPed all need to be configured independantly.

Reading between the lines a little, I suspect that you only have one subnet, so it doesn't really matter - either solution is good for your purposes.

If you were looking at expanding the network later, I would probably move the router, broadcast and mask into the pool, as these options are generally invalid for other pools.
Thanks for the insightful answer

And your guess is right; I am only worrying about this one subnet (we have multiple subnets; but we are only running dhcp on this one subnet). So I guess it _really_ doesn't matter since we aren't running anything fancy in terms of dhcp. Just only this small range.

Thanks again!

-C
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
creation of dhcpd.conf file gannurajput Linux - Networking 2 01-03-2008 02:45 PM
dhcpd subnet declaration problems in dhcpd.conf vcrispo Linux - Networking 6 07-15-2005 10:32 AM
can't file dhcpd.conf vito_huang Linux - Networking 6 01-28-2005 07:04 AM
need help with dhcpd.conf file running two nics hwb0014 Linux - Networking 4 08-28-2002 11:47 AM
Installed DHCP on RH7.2, no dhcpd.conf file??? AnthonyM Linux - Networking 8 07-30-2002 07:21 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 05:33 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration