Setting a DHCP server

Swobodin's picture
Submitted by Swobodin on Tue, 2006-05-09 12:18. ::
DHCP stands for Dynamic Host Configuration Protocol.
DHCP allows hosts on a TCP/IP network to request and be assigned IP addresses, and also to discover  information  about  the network to which they are attached.  BOOTP provides similar functionality, with certain restrictions.
To run a DHCP server, you only need to edit /etc/dhcpd.conf
Here's a sample that you may find at /usr/share/doc/dhcp-version/dhcpd.conf.sample
ddns-update-style interim; # Possible values are ad-hoc, interim or none: Whether DNS should be updated
ignore client-updates; # By default, client-updates is allowed
option domain-name "myserver.com"; # domain name given to client
option domain-name-servers 192.168.0.254
default-lease-time 21600 # number of seconds till the expiration
max-lease-time 43200 # maximum length in seconds that will be assigned to a lease.

subnet 192.168.0.0 netmask 255.255.255.0 {
# These instruction are only applied for a given subnet
option routers 192.168.0.1; # Local gateway
option subnet-mask 255.255.255.0; # local mask

range 192.168.0.128 192.168.0.254; # DHCP range

#Static configuration for each DHCP hose
host mymachine {
hardware ethernet 12:34:56:78:AB:CD; # Your MAC address which can be obtained typing
# ifconfig ethX| head -1 | awk '{print $5}'
# Where ethX is your ethernet device
fixed-address 192.168.0.2; # Static IP
}
}
Activate the DHCP daemon
/etc/rc.d/init.d/dhcpd start
With client, it's too much simpler (guess so):
su -c dhcleint
I prefer to use pump, No official site for this application as far as I know, that's why I downloaded the source from Debian repository.
pump -i eth0
Please keep on mind that DHCP is not suitable for moitoring machines and security, neither for local servers.