View Single Post
  #1  
Old March 1st, 2002, 02:07 PM
kilowatt's Avatar
kilowatt kilowatt is offline
mach-o mach-o man
 
Join Date: Mar 2001
Location: irc.lfnet.net #kilonet
Posts: 984
Thanks: 0
Thanked 0 Times in 0 Posts
kilowatt is on a distinguished road
HOW TO: Setup DHCPD (Server) on Mac OS X (Workstation)

Ok, this is for those of you who want to set up a DHCP server to allow other computers to grab ip and dns information off of your computer. This is especially useful if you have a small private network and wish to automate the addition of other computers.

For this howto, basic terminal skills and admin-level access are required. Its not hard, don't worry

BTW, if you allready have a dhcp server on the network, turn it off first

First, go to the official DHCP web page and have a look around:
http://isc.org/products/DHCP/
here's the source code - download it by control-clicking the link and selecting 'save as...'
ftp://ftp.isc.org/isc/dhcp/dhcp-latest.tar.gz
Now, logged in as an admin-level user, open the Terminal (located in /Applications/Utilities)
type the following commands:
Code:
cd /path/to/the/file/you/downloaded
tar -zxvf dhcp-latest.tar.gz
cd dhcp-3.0
./configure
make
get food or something - takes about 3 mins to compile - oh btw, when prompted for a password, enter your password
cd work.darwin
cd server
sudo make install
cd ../common
sudo make install
cd ../dhcpctl
sudo make install
cd ../opamip
sudo make install
thats it! now you have the binaries for the server, as well as some dhcp-tweaking utilities installed. If you're nuts, you can simply:
Code:
sudo make install
in the dhcp-3.0 directory - but be warned - you are replacing existing Mac OS X dhcp client files as well, and I don't recommend this. (If you do this, and it works though, please post, I'm sure many would like to update their dhcp clients too).

Now, we have to configure the server. Still to go is making it startup on startup

cd into /etc
cd /etc
ok, now type sudo pico dhcpd.conf
This is the dhcpd configuration file (duh).
Here is a URL I found extremely helpful at this point: http://www.linux-mag.com/2000-04/networknirvana_03.html
the next page in the url is also helpful.

For the impatient, here is a copy of my /etc/dhcpd.conf file - just paste it into pico.
Code:
## /etc/dhcpd.conf file
## compiled by the infamous super-hacker unix guru kilowatt from macosx.com (you need this in the file for things to work :p )
option domain-name-servers 192.168.1.140;
ddns-update-style ad-hoc;
subnet 192.168.1.0 netmask 255.255.255.0 {

range 192.168.1.150 192.168.1.200;
default-lease-time 300000;
max-lease-time 350000;
option routers 192.168.1.1;              
}
if you're in pico like me (vi sucks btw) press control-o, then hit return to save the file.

ok, now before we start the dhcpd, we need to touch up a fake database file so that dhcpd will think its been ran before. I think its rather stupid that we have to do this, and there's probably a way around it, but for now, whatever

Code:
sudo touch /var/db/dhcpd.leases
okey dokey, now we're set. Here's how you start the server:
sudo dhcpd &

more to follow on starting it automatically and netinfo integration.
__________________
irc.lfnet.net #kilonet -+=join in=+-
Quote:
...the belief that the rights of man come not from the generosity of the state but the hand of God...
PEBKAC - Problem Exists Between Keyboard And Chair. --who said it first?
Audio Engineer - ProTools and Logic Pro Certified.
FCC Licensed RF Technician

Last edited by kilowatt; March 1st, 2002 at 02:40 PM.
Reply With Quote