DHCP server setup on FreeBSD


U want to create DHCP server on FreeBSD ( NetBSD etc )?

simple just install the DHCP server pkg 1st, either thru ports or pkg_add..

 

 

 

trunasuci# pkg_info | grep dhcp

isc-dhcp30-server-3.0.7_3 The ISC Dynamic Host Configuration Protocol server

 

 

 

after install, edit /etc/rc.conf and add:

 

dhcpd_enable="YES"                         

dhcpd_flags="-q"                           

dhcpd_conf="/usr/local/etc/dhcpd.conf"     

dhcpd_ifaces="xl1"                            

dhcpd_withumask="022"                      

 

 

dhcpd_ifaces is your network card facing the network.. 

 

later edit dhcpd.conf and put something like this:

 

allow unknown-clients;

ddns-update-style ad-hoc;

subnet 10.0.0.0 netmask 255.255.255.0 {

range 10.0.0.100 10.0.0.150 ;

default-lease-time 86400 ;

max-lease-time 86400 ;

option subnet-mask 255.255.255.0 ;

option domain-name-servers 61.6.32.162, 192.228.128.15, 208.67.222.222, 208.67.220.220,

161.142.201.17, 202.188.1.23  ;

option routers 10.0.0.200;

}

 

 

 

 

subnet is your network subnet

 

default-lease-time and max-lease-time is your dhcp server ip leased given to client, in seconds, before it refresh/expired and ask for new ip..

 

option domain-name-servers is DNS servers of your ISP, and any other DNS servers such as OpenDNS etc..

 

option routers is default gateway for your client setting, in this case it's your network card facing the network ( anyway it can configured to other ip/gateway in the network, no problem )

 

 

SAVE!!!

 

 

 

time to start and check the dhcpd daemon...

 

trunasuci# dhcpd xl1

Internet Systems Consortium DHCP Server V3.0.7

Copyright 2004-2008 Internet Systems Consortium.

All rights reserved.

For info, please visit http://www.isc.org/sw/dhcp/

Wrote 1 leases to leases file.

Listening on BPF/xl1/00:01:02:7c:bb:f9/10.0.0/24

Sending on   BPF/xl1/00:01:02:7c:bb:f9/10.0.0/24

Sending on   Socket/fallback/fallback-net

 

 

that's it!.. and check on your client side...

 

 

it works!!!!

 

 

 

created on 20/3/2009 7:54am