image
image

Go Back   macosx.com > Mac Help Forums > HOWTO & FAQs

Reply
 
Thread Tools
  #1  
Old March 1st, 2002, 01:07 PM
kilowatt's Avatar
mach-o mach-o man
 
Join Date: Mar 2001
Location: irc.lfnet.net #kilonet
Posts: 980
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 01:40 PM.
Reply With Quote
  #2  
Old March 1st, 2002, 01:25 PM
kilowatt's Avatar
mach-o mach-o man
 
Join Date: Mar 2001
Location: irc.lfnet.net #kilonet
Posts: 980
Thanks: 0
Thanked 0 Times in 0 Posts
kilowatt is on a distinguished road
updates:

1) every /etc/dhcpd.conf file on the internet is wrong - type mine *exactly* as it appears caus dhcpd is very picky apparently. Especially important is the semi-colin

2) To start the dhcpd server on an interface other than your default gateway (which is highly desireable on dual-interface configurations used as an internet gateway), start dhcpd like this:
Code:
sudo dhcpd en1
see ifconfig -a for a list of interfaces.

3) the man page for dhcpd (man dhcpd) is wonderful. Stop by there before you search yahoo or google.

enjoy the dhcp server, please ask if you have any questions.

Oh, and btw, adjust the config file to your preferences - if you don't have a dns server at 192.168.1.140, for example, don't say you have one (but put your isp's dns server there).

Last edited by kilowatt; March 1st, 2002 at 02:27 PM.
Reply With Quote
  #3  
Old March 1st, 2002, 02:56 PM
kilowatt's Avatar
mach-o mach-o man
 
Join Date: Mar 2001
Location: irc.lfnet.net #kilonet
Posts: 980
Thanks: 0
Thanked 0 Times in 0 Posts
kilowatt is on a distinguished road
Startup Script

ok, ate some food, read some of 'An AIX Companion" (circa 1994 written by David L. Cohn), banged my head against the wall, read some more, and came up with a macintosh startup script. Pretty cool, huh?


ok, so here's what to do:
in the terminal as an admin-level user:
Code:
cd /Library
mkdir StartupItems
skip that step if its allready there - check by typing ls
sudo chown root:admin StartupItems
if you trust all your wheel (admin) users to be smart people, you can leave it owned to wheel (the default)
ok now download my file
and move it and unstuff:
Code:
sudo mv ~/Downloads/dhcpd-startup.zip .
sudo unzip dhcpd-startup.zip
sudo rm dhcpd-startup.zip
thats it!

it should create a directory called 'dhcpd'. Poke around in it to see how it works.

If you want, you can do this in /System/Library/StartupItems, but apple requests that you put it in /Library so that it isn't confused with apple's startup stuff.

Thanks to Yoshi, IckyShuff, twyg and Julian for putting up with me and supporting this in #macintosh - without them this would not be here.


btw, admin, can you allow us to post .tar.gz files? I had to learn how to use the 'zip' command (which was incredibly hard) and I had to figure out that zip -x doesn't unzip only unzip does
Attached Files
File Type: zip dhcpd-startup.zip (138 Bytes, 125 views)
Reply With Quote
  #4  
Old March 13th, 2002, 05:26 PM
Registered User
 
Join Date: Feb 2002
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
natethelen is on a distinguished road
Your ZIP file is empty

Your ZIP file is empty. Can you post another file that works (or maybe copy th source into the message)

Thanks,
Nate
Reply With Quote
  #5  
Old March 16th, 2002, 04:53 PM
kilowatt's Avatar
mach-o mach-o man
 
Join Date: Mar 2001
Location: irc.lfnet.net #kilonet
Posts: 980
Thanks: 0
Thanked 0 Times in 0 Posts
kilowatt is on a distinguished road
yeah, I'll post one later on tonight!

probably has to do with the thread being moved from UNIX discussion to the Archive.
Reply With Quote
  #6  
Old March 16th, 2002, 05:16 PM
kilowatt's Avatar
mach-o mach-o man
 
Join Date: Mar 2001
Location: irc.lfnet.net #kilonet
Posts: 980
Thanks: 0
Thanked 0 Times in 0 Posts
kilowatt is on a distinguished road
http://www.lfnet.net/~liggett/dhcpd-startup.tar.gz

download the file (use the 'save link as...' thing, don't just click it, we don't want Stuffit Expander doing anything).

now, in the terminal:
Code:
cd /Library/StartupItems
cp ~/Desktop/dhcpd-startup.tar.gz .
tar -xzvf dhcpd-startup.tar.gz
rm dhcpd-startup.tar.gz
thats it!

enjoy
Reply With Quote
  #7  
Old October 4th, 2002, 05:51 AM
doemel's Avatar
Mac addict since 1993
 
Join Date: Feb 2002
Location: Zurich, Switzerland
Posts: 202
Thanks: 0
Thanked 0 Times in 0 Posts
doemel is on a distinguished road
update please

I have tried to install the latest version (3.0p1) on the latest OS X release (10.2.1) and all I get is error messages. When I enter ./configure I get the following list of error messages:

Making links in common
ln: raw.c: No such file or directory
ln: parse.c: No such file or directory
ln: nit.c: No such file or directory
ln: icmp.c: No such file or directory
ln: dispatch.c: No such file or directory
ln: conflex.c: No such file or directory
ln: upf.c: No such file or directory
ln: bpf.c: No such file or directory
ln: socket.c: No such file or directory
ln: lpf.c: No such file or directory
[... I have cut some lines that are similar to these...]
ln: discover.c: No such file or directory
ln: comapi.c: No such file or directory
ln: dhcp-options.5: No such file or directory
ln: dhcp-eval.5: No such file or directory
make[2]: *** [links] Error 1
make[1]: *** [links] Error 1
make: *** [links] Error 2


Amd when, after that, I try to make I get the following:

Making all in common
make[2]: *** No rule to make target `raw.o', needed by `libdhcp.a'. Stop.
make[1]: *** [all] Error 1
make: *** [all] Error 2


Can anyone help me with this and/or update the instructions for 10.2.1 and the latest release of DHCP?

Dominik Schmid
__________________
My personal Apple history (italic = dead): * 1993: Centris 610, upg -> PM 6100/60, OC to 80MHz * 1998: iMac [233MHz, 384MB, 10GB] * 2000: PowerBook G3 [233MHz, 384MB, 20GB] * 2003: PowerBook G4 [15", 867MHz, 1GB, 100GB], 10GB 2G iPod * 2004: 20GB 3G iPod, Airport Express * 2006: MBP [15", 2GHz, 2GB, 160GB] * 2007 : MBP C2D [15", 2.33GHz, 3GB, 160GB] * Plus about 15 mostly 2nd hand Macs I bought for my friends and family. About the less Mac centric me.
Reply With Quote
  #8  
Old October 6th, 2002, 02:39 PM
kilowatt's Avatar
mach-o mach-o man
 
Join Date: Mar 2001
Location: irc.lfnet.net #kilonet
Posts: 980
Thanks: 0
Thanked 0 Times in 0 Posts
kilowatt is on a distinguished road
Do you have the developer tools installed (the latest ones?). You'll need those.
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
A bit of nostalgia: A Salute to Mac OS X simX Apple News, Rumors & Discussion 31 March 24th, 2005 06:45 AM
DNS server on Mac OS X workstation nwelke Networking & Compatibility 1 August 28th, 2003 11:11 PM
HP Photosmart 1315 and USB Print Sharing zwheeloc Mac Classic System & Software 12 February 6th, 2003 08:20 PM
apps list Mac Osxtopus Mac OS X System & Mac Software 7 May 29th, 2002 11:31 AM
Apple: Forget XP, try the Mac tagliatelle Bob's Place 1 November 25th, 2001 06:12 AM


All times are GMT -5. The time now is 04:38 PM.


Mac Support® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0
Copyright 2000-2008 DigitalCrowd, Inc.