14Jun/110
How to configure DHCP for IPv4 on FreeBSD
First install the required ports from the ports directory
cd /usr/ports/net/isc-dhcp41-server make install clean
Then lets start configuring
Copy the sample config to its location or directly create a new file named dhcpd.conf.
cd /usr/local/etc/ cp dhcpd.conf.sample dhcpd.conf
Edit the config to your needs or use my example below
# dhcpd.conf
# option definitions common to all supported networks...
option domain-name-servers 192.168.1.1;
default-lease-time 600;
max-lease-time 7200;
# Use this to enble / disable dynamic dns updates globally.
ddns-update-style none;
# If this DHCP server is the official DHCP server for the local
# network, the authoritative directive should be uncommented.
authoritative;
# Use this to send dhcp log messages to a different log file (you also
# have to hack syslog.conf to complete the redirection).
log-facility local7;
# Prevent duplicates!
deny duplicates;
subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.40 192.168.1.49;
option routers 192.168.1.254;
#option domain-name-servers 192.168.1.2;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.1.255;
option nntp-server 192.168.1.64;
}Now add the right boot values to /etc/rc.conf.
# DHCPD dhcpd_enable="YES" # dhcpd enabled? dhcpd_flags="-q" # command option(s) dhcpd_ifaces="em0" # ethernet interface(s) # If compiled with paranoia support (the default), the following lines are also supported: dhcpd_chuser_enable="YES" # runs w/o privileges? #dhcpd_chroot_enable="YES" # runs chrooted?
This should do the trick, now lets fire up!
/usr/local/etc/rc.d/isc-dhcpd start
If everything went fine you should be able to use your DHCP service now




