DNS and DHCP server on Leopard

Discussion in 'macOS' started by Deej, Sep 13, 2008.

  1. Deej macrumors regular

    Joined:
    Apr 25, 2005
    Location:
    UK
    #1
    Hey guys,

    Would dearly love to do this in OS X Server but I don't have the money for a license, so does anybody know if it's possible to get a DNS server and a DHCP server for 'normal' Leopard so I can serve DHCP and DNS on my local network from it?

    I currently have a Windows Server 2003 machine running AD and Windows File Sharing, and a Fedora Linux machine providing DHCP but I'd like to consolidate all the services to my Mac Mini running Leopard.

    Thanks...
     
  2. Deej thread starter macrumors regular

    Joined:
    Apr 25, 2005
    Location:
    UK
    #2
    UPDATE: OK I didn't realise that OS X has bind already installed, so after a bit of a config and a play (after Googling), I now have a working DNS server on my Mac Mini - hurrah!

    However, I'm still working on the DHCP server. Currently downloading the Developer Tools so I can download and compile the latest version of dhcpd from isc.org - that is unless someone can point me in a better direction :D
     
  3. Deej thread starter macrumors regular

    Joined:
    Apr 25, 2005
    Location:
    UK
    #3
    ANOTHER UPDATE: OK having got BIND running nicely, I downloaded a copy of Xcode, and then dhcpd from www.isc.org and compiled it.

    After fiddling a bit to get it running, my Mac Mini is now serving DHCP as well as DNS for my local network :)

    I'm posting this here so others may find the information in the future - I'm sure I'm not the only one who would want to do this :)
     
  4. bankshot macrumors 65816

    bankshot

    Joined:
    Jan 23, 2003
    Location:
    Southern California
    #4
    Good stuff. I'm actually looking at ordering a Mac mini shortly to do a very similar thing - consolidate services of two aging machines (Power Mac G4 and FreeBSD PC). I was just looking into moving the FreeBSD machine's dhcp and dns services to a Mac. Currently testing on the G4.

    For dns, I edited /etc/named.conf to look similar to what I have on FreeBSD, then added my local zone files from the FreeBSD machine to /var/named on the Mac. Finally, it was enabled using
    Code:
    sudo launchctl load -w /System/Library/LaunchDaemons/org.isc.named.plist
    Not too hard.

    For dhcp, I thought about installing the ISC dhcpd, as that's what's running on my FreeBSD server. However, OS X comes with bootpd out of the box which also serves up dhcp leases. There's no config file for bootpd on Leopard client by default, so you can make it create one by temporarily turning on Internet Sharing. Then copy /etc/bootpd.plist out of the way and turn off Internet Sharing. Edit the file you copied and put it back as /etc/bootpd.plist. Finally, if desired, create a file called /etc/bootptab with a list of static IP addresses if you're serving any (do a 'man bootptab' for info).

    Enabling bootpd was similar to named:
    Code:
    sudo launchctl load -w /System/Library/LaunchDaemons/bootps.plist
    After fixing a couple of config file problems, it seems to work! ;)

    I can go into more detail if desired.
     
  5. raoulw macrumors newbie

    Joined:
    Dec 25, 2008
    #5
    Some more details on your config file problems would be excellent.

    I've just ordered a mini to also replace two aging boxes - one linux samba/bind/dhcp/apache server, and a centos trixbox pbx server which I've already cloned & configured on my macbook to run under parallels on the mini.

    Any tips to save downtime (& my behind ;-) would be greatly appreciated.
     
  6. Remilio macrumors newbie

    Joined:
    May 2, 2008
    #6
    Hi bankshot

    I have been able to use some of your instructions to get the DHCP server figured out but still seem to have some issues left.

    first I had some difficulty editing /etc/bootpd.plist

    even after changing the file to read/write for all I was unable to edit it.
    Finally I decided to do it the rough way by using:

    sudo /Developer/Applications/Utilities/Property\ List\ Editor.app/Contents/MacOS/Property\ List\ Editor /etc/bootpd.plist

    which worked (see file below)

    As you can see below I am trying to manage 2 interfaces

    en1 = airport
    en2 = USB ethernet interface

    Somehow I still don't seem to have a awfull amount of luck.

    1)
    since internet connection sharing is now disabled the airport has stopped behaving as a base station.
    Any ideas to enable it without stating internet connection sharing (which I assume won't work as this messes up the bootpd.plist file)

    2)
    Receiving a DHCP response over en2 also doesn seem to work.
    In the console I see:

    Jul 26 12:03:24 Gandalf bootpd[66]: DHCP DISCOVER [en2]: 1,0:23:32:c6:4d:ce <Eowyn>

    which suggest my server is seeing my laptop, somehow however I don't get a new IP adress making my laptop divert to the 169.254.x.x range

    any ideas, something I missed?

    Regards
    Remi


    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
    <key>Subnets</key>
    <array>
    <dict>
    <key>_creator</key>
    <string>com.apple.nat</string>
    <key>allocate</key>
    <true/>
    <key>dhcp_domain_name_server</key>
    <string>192.168.0.1</string>
    <key>dhcp_router</key>
    <string>192.168.2.2</string>
    <key>lease_max</key>
    <integer>3600</integer>
    <key>lease_min</key>
    <integer>3600</integer>
    <key>name</key>
    <string>192.168.2.2</string>
    <key>net_address</key>
    <string>192.168.2.2</string>
    <key>net_mask</key>
    <string>255.255.0.0</string>
    <key>net_range</key>
    <array>
    <string>192.168.2.100</string>
    <string>192.168.2.254</string>
    </array>
    </dict>
    <dict>
    <key>_creator</key>
    <string>com.apple.nat</string>
    <key>allocate</key>
    <true/>
    <key>dhcp_domain_name_server</key>
    <string>192.168.0.1</string>
    <key>dhcp_router</key>
    <string>192.168.2.1</string>
    <key>lease_max</key>
    <integer>3600</integer>
    <key>lease_min</key>
    <integer>3600</integer>
    <key>name</key>
    <string>192.168.2.1</string>
    <key>net_address</key>
    <string>192.168.2.1</string>
    <key>net_mask</key>
    <string>255.255.0.0</string>
    <key>net_range</key>
    <array>
    <string>192.168.2.10</string>
    <string>192.168.2.99</string>
    </array>
    </dict>
    </array>
    <key>bootp_enabled</key>
    <true/>
    <key>detect_other_dhcp_server</key>
    <integer>1</integer>
    <key>dhcp_enabled</key>
    <array>
    <string>en2</string>
    <string>en1</string>
    </array>
    <key>reply_threshold_seconds</key>
    <integer>0</integer>
    </dict>
    </plist>
     

Share This Page