RHCE2B.COM

RHCE Information on DHCP from RHCE2B.COM

Where to find information on DHCP

DHCP Mini-howto

DHCP Defined

DHCP is the Dynamic Host Configuration Protocol. It is used to dynamically assign hosts an ip address on the network. There are really two things you could do with DHCP under Linux. You could configure your Linux machine to be a DHCP client. Or you could configure your Linux machine to be a DHCP server. The DHCP server is called dhcpd. The DHCP client is called "dhcpcd ".

How To Install DHCP

How to install a DHCP Server

% mount /dev/cdrom

% cd /mnt/cdrom/RedHat/RPMS

% rpm -ivh dhcp*.rpm

How to install a DHCP Client

% mount /dev/cdrom

% cd /mnt/cdrom/RedHat/RPMS

% rpm -ivh pump*.rpm

How To Configure DHCP

How to configure a DHCP server

If you are going to support Microsoft Windows clients, then you must do a:

% route add -host 255.255.255.255 dev eth0

Configure your /etc/dhcpd.conf file

Here is an example configuration. Theis configuration will give out IP addessesfrom 10.0.0.10-10.0.0.100 or 10.0.0.150-10.0.0.200. If the client doesn't ask for a specific time frame, it will lease the ip address for 600 seconds. If the client asks for a time frame, the maximum it will allow is 7200 seconds. It also sets up the default gateway of 10.0.0.1, the subnet mask of 255.255.255.0, the broadcast address of 10.0.0.255, and 10.0.0.2, and 10.0.0.3 as DNS servers.

# 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 10.0.0.255;
option routers 10.0.0.1;
option domain-name-servers 10.0.0.2, 10.0.0.3;
option domain-name "mydomain.org";
subnet 10.0.0.0 netmask 255.255.255.0 {
range 10.0.0.10 10.0.0.100;
range 10.0.0.150 10.0.0.200;
}

Make sure there is a dhcpd.leases file:

% touch /var/state/dhcpd/dhcpd.leases

Run dhcpd in debugging mode to ensure it is working properly:

% /usr/sbin/dhcpd -d -f

How To Configure a DHCP client

Run the netcfg command

% netcfg Under Interfaces, edit the appropriate entry for your ethernet card choosing dhcp as the protocol. Also make sure you enable the "Activate interface at boot time option". Then click "Save" and the "Done". This should immeadiately activate your changes. However, if it does not, then you can force the changes to take affect by doing:

% /sbin/ifup eth0

Note: You can manually run /sbin/dhcpcd in order to get an ip address via dhcp for a particular interface. For example, (from Steve's RHCE Study Guide)

/sbin/dhcpcd -n -H eth0

    -H = Force dhcpcd to set the hostname of the host to the hostname option
         supplied by the DHCP server.
    -n = If dhcpcd is already running send it an ALRM signal to cause it to
         attempt to renew it's lease.
  eth0 = Interface to configure
Debugging Exam Note: If you are not running X-Windows, you can use the "netconf" command instead of the "netcfg" command!

Take a quiz on DHCP


Linux Waves Banner Exchange

Search Amazon.com:
In Association with Amazon.com


www.NoMonthlyFees.com
RHCE2B.COM Home Page
RHCE2B.COM Practice Test for the RHCE exam
This site is not authorized or reviewed by Red Hat, Inc.
Legal stuff

Books : Linux

In association with Amazon.com
 
 

1. Books : The Official Ubuntu Book The Official Ubuntu Book
by: Benjamin Mako Hill, Jono Bacon, Corey Burger, Jonathan Jesse, Ivan Krstic
11 August, 2006
List Price: $34.99
Amazon.com's Price: price not available
Amazon.com prices subject to change.

2. Books : A Practical Guide to Linux(R) Commands, Editors, and Shell Programming A Practical Guide to Linux(R) Commands, Editors, and Shell Programming
by: Mark G. Sobell
01 July, 2005
List Price: $39.99
Amazon.com's Price: price not available
Amazon.com prices subject to change.

3. Books : Learning Python, Second Edition Learning Python, Second Edition
by: Mark Lutz, David Ascher
December, 2003
List Price: $39.99
Amazon.com's Price: price not available
Amazon.com prices subject to change.

4. Books : Understanding the Linux Kernel Understanding the Linux Kernel
by: Daniel Plerre Bovet, Marco Cesati
01 November, 2005
List Price: $49.95
Amazon.com's Price: price not available
Amazon.com prices subject to change.

5. Books : Classic Shell Scripting Classic Shell Scripting
by: Arnold Robbins, Nelson H.F. Beebe
01 February, 2005
List Price: $34.95
Amazon.com's Price: price not available
Amazon.com prices subject to change.

6. Books : Ubuntu Hacks: Tips & Tools for Exploring, Using, and Tuning Linux (Hacks) Ubuntu Hacks: Tips & Tools for Exploring, Using, and Tuning Linux (Hacks)
by: Jonathan Oxer, Kyle Rankin, Bill Childers
14 June, 2006
List Price: $29.99
Amazon.com's Price: price not available
Amazon.com prices subject to change.

7. Books : C++ GUI Programming with Qt 4 C++ GUI Programming with Qt 4
by: Jasmin Blanchette, Mark Summerfield
26 June, 2006
List Price: $59.99
Amazon.com's Price: price not available
Amazon.com prices subject to change.

8. Books : Asterisk: The Future of Telephony Asterisk: The Future of Telephony
by: Jim Van Meggelen, Jared Smith, Leif Madsen
01 September, 2005
List Price: $39.95
Amazon.com's Price: price not available
Amazon.com prices subject to change.

9. Books : Linux Pocket Guide Linux Pocket Guide
by: Daniel J. Barrett
01 March, 2004
List Price: $9.95
Amazon.com's Price: price not available
Amazon.com prices subject to change.

10. Books : Linux Device Drivers, 3rd Edition Linux Device Drivers, 3rd Edition
by: Jonathan Corbet, Alessandro Rubini, Greg Kroah-Hartman
08 February, 2005
List Price: $39.95
Amazon.com's Price: price not available
Amazon.com prices subject to change.

page 1 of  299
 1  2  3  4  5  6  7  8  9  10  11 

 
script by MrRat