2004-05-21, 03:59 PM
first things first, make sure you have your dhcp software installed
to check it quickly do this
Code:
rpm -qa dhcp*
dhcp-devel-3.0.1rc12-4
dhcp-3.0.1rc12-4
If it doesnt display anything you can download the RPMs and install them manually, or click on the redhat/system settings/add remove applications/Servers/Network Servers and put a check mark beside DHCP server.
ok once it is installed now you have to configure it, this is done by manually editing a file called /etc/dhcpd.conf
if the file does not yet exist don't worry, there is a sample stored on your distro,
to find it do this
Code:
updatedb && locate dhcpd.conf
it will probably be somewhere like this
/usr/share/doc/dhcp-3.0.1rc12/dhcpd.conf.sample
Copy this file to /etc as follows
Code:
cp /usr/share/doc/dhcp-3.0.1rc12/dhcpd.conf.sample
/etc/dhcpd.conf
Now edit the file and change the ip subnet/netmask settings to your liking and save the file.
To start the dhcp server you'll need a leases file created otherwise it will fail to start (first time start). Do as follows to create the file
Code:
touch /var/lib/dhcp/dhcpd.leases
Now we want it to start at boottime, so lets tell chkconfig to start it at boot by doing
Code:
chkconfig --level 35 dhcpd on
That's it, now we want to start the server, to do so try this
Code:
/etc/init.d/dhcpd start
ok, connect a client to the server with dhcp enabled and see do they get an ip !
If you want to share the internet via this DHCP server then try the following
Code:
iptables -t nat -F POSTROUTING
iptables -t nat -A POSTROUTING -s 10.0.0.0/24 -j MASQUERADE
The first line CLEARS your current IPTABLEs rules so don't do it unless you really intend to do it. The second line shares out 10.0.0.1-10.0.0.255 as long as the client points their gateway to 10.0.0.1.
here is a sample dhcpd.conf file
Code:
ddns-update-style interim;
ignore client-updates;
filename "pxelinux.0";
subnet 10.0.0.0 netmask 255.255.255.0
{
# --- default gateway
option routers 10.0.0.1;
option subnet-mask 255.255.255.0;
option nis-domain "domain.org";
option domain-name "domain.org";
option domain-name-servers 10.0.0.1;
option time-offset -18000; # Eastern Standard Time
# option ntp-servers 10.0.1.1;
# option netbios-name-servers 10.0.1.1;
# --- Selects point-to-point node (default is hybrid). Don't change this unless
# -- you understand Netbios very well
# option netbios-node-type 2;
range dynamic-bootp 10.0.0.128 10.0.0.254;
default-lease-time 21600;
max-lease-time 43200;
# we want the nameserver to appear at a fixed address
host ns
{
next-server marvin.redhat.com;
hardware ethernet 12:34:56:78:AB:CD;
fixed-address 207.175.42.254;
}
}
cheers
anyweb