DHCP Server Linux

From Free Knowledge Base- The DUCK Project: information for everyone
Jump to: navigation, search
REDHAT _ _ _ _ _ _ _ _ _ _ _
 _     ___ _   _ _   ___  __
| |   |_ _| \ | | | | \ \/ /
| |    | ||  \| | | | |\  / 
| |___ | || |\  | |_| |/  \ 
|_____|___|_| \_|\___//_/\_\

DHCP Server

1.) Install the DHCP server daemon. As of this writing the latest version is dhcp 3.0pl1 - 23.

  • The RPM is dhcp-3.0pl1-23.src.rpm

Download the RPM if you do not have it already.

 type: rpm -ih dhcp-3.0pl1-23.src.rpm

2.) Create a dhcpd.conf file in /etc

 type: touch /etc/dhcpd.conf
       vi /etc/dhcpd.conf

sample /etc/dhcpd.conf file:

ddns-update-style interim;
ignore client-updates;
 
subnet 10.10.0.0 netmask 255.255.0.0 {

# --- default gateway
        option routers                  10.10.254.254;
        option subnet-mask              255.255.0.0;

        option nis-domain               "ispname.com";
        option domain-name              "ispname.com";
        option domain-name-servers      X.X.X.X;

#       option time-offset              -18000; # Eastern Standard Time
#       option ntp-servers              192.168.1.1;
#       option netbios-name-servers     192.168.1.1;

        range dynamic-bootp 10.10.0.1 10.10.2.254;
        default-lease-time 21600;
        max-lease-time 43200;

}

3.) Set the DHCP daemon to start up on system boot.

type: mv /etc/rc.d/rc3.d/K35dhcpd /etc/rc.d/rc3.d/S35dhcpd

4.) Start the DHCP server.

type: service dhcpd start

~~~~~ additional information ~~~~~

All leases are recorded in plain text in /var/lib/dhcp/dhcpd.leases so if you want to see what IP address was assigned to a computer and when, simply

 type: cat /var/lib/dhcp/dhcpd.leases

For a recent list only:

 tail /var/lib/dhcp/dhcpd.leases

Here is an example where two subnets are served on two interfaces:

ddns-update-style interim;
ignore client-updates;

subnet 192.168.3.0 netmask 255.255.255.0 {
# --- default gateway
        option routers                  192.168.3.1;
        option subnet-mask              255.255.255.0;

        option nis-domain               "ispname.com";
        option domain-name              "ispname.com";
        option domain-name-servers      64.21.192.6;

        range dynamic-bootp 192.168.3.100 192.168.3.150;
        default-lease-time 21600;
        max-lease-time 43200;
}


subnet 192.168.4.0 netmask 255.255.255.0 {

# --- default gateway
        option routers                  192.168.4.1;
        option subnet-mask              255.255.255.0;

        option nis-domain               "ispname.com";
        option domain-name              "ispname.com";
        option domain-name-servers      64.21.192.6;

        range dynamic-bootp 192.168.4.100 192.168.4.150;
        default-lease-time 21600;
        max-lease-time 43200;
}



  • Wed Oct 22 14:36:17 CDT 2003
  • Wed Aug 18 22:25:28 CDT 2004
  • Sat Jan 13 14:43:49 CST 2007