Dhcp Server For Macos

[Please note that the following is only known to apply to Mac OS X10.4 “Tiger”. I have not checked the below setup with anylater versions; confirmation is appreciated from any that have.—CDJ]

I used to have an original Mac mini as my primary desktopmachine, and I used several laptops (Apple and non-Apple) as well. Ileave laptop ethernet ports configured to use DHCP automatically, asthat's typically the easiest way to get them to work when connectedto airport, hotel, or other destinations' ethernet jacks; I decidedit would be nice to connect them directly to the mini when wanting totransfer huge amounts of data, and not have to worry about areconfiguration every time. Apple's newer machines don't requirea crossover cable or hub just to connect to another machine via ethernet,so I essentially just needed to run a DHCP server on the mini providingrouting and configuration information, and connect a cable from the mini tothe laptop-of-the-day, and have a full, fast connection which I can useto transfer files between the laptop and mini or browse the web.

Dhcp Server For Macos

DHCP stands for Dynamic Host Configuration Protocol, and is commonly used to configure network devices so they can communicate with one another. Typically you’ll have a DHCP server (like a wireless router), and client machines on the local network (like a Mac, iPhone, PC, etc) that pull a dynamically assigned local IP address from that server. Operating system requirement. In this overview of operating system support for the discussed DHCP server, the following terms indicate the level of support:. No indicates that it does not exist or was never released. How to Renew a DHCP Lease on a Mac. Dynamic Host Configuration Protocol (DHCP) is a special server configured to pass out IP information and other IP information to network clients. If a workstation has obtained IP configuration. Dhcpy6d is an open source server for DHCPv6, the DHCP protocol for IPv6. Source server for DHCPv6, the DHCP.

I have a decent amount of home-networking experience, and with the help ofsome of Apple Supportdocuments and Mac Help (specifically, an article entitled 'Connecting twocomputers using Ethernet'), it wasn't hard for me to determine thefollowing process—the results, however, were pleasantlysurprising. Not only could the two 'communicate', but this process infact establishes the mini as a DHCP server, and after the (quite simple)setup below, everything works adequately, if not ideally.


I'm listing problems with this procedure first for a couple of reasons.First, you should know what will and will not work well after following thisprocedure. Second, the problems provide the basis for some of the decisionsI make later.

Numbers don't work

Some Googling (and cursory testing) seems to suggest that, no matter what,Internet Sharing always uses “internal” numbers on the, a real no-no if there's already another subnet. There are some waysto work around that, but they're far from ideal—they essentiallyinvolve disabling the built-in Internet Sharing and setting up your ownversion. For me, it's fairly easy not to use for any other subnet, so I'm unlikely to pursue it further.

Names don't work

Sure, you can use the IPaddresses if you like (it's set above on the Mac, and doesn't change), but the possibility of not doing so is one of thereasons I wanted to do this in the first place. Instead, I'd like to usethe machine names: to connect to the Mac, just use thename listed in the Sharing pane (as in “natalie.local”below). To connect to your other computer, check that machine'sdocumentation for how to determine or set its name. This doesn't seemto work at the moment.

This can be partially worked around with either a Mac laptop or byinstalling Bonjour on aWindows laptop. However, there doesn't seem to be an idealOS-agnostic solution that doesn't require installing software on theclient, though the idea of simply installing software on the Mac seemsreasonable.


This can also be worked around in conjunction with the previous problemby running a self-configured nameserver on the Mac instead of the oneset up by Internet Sharing. Again, however, in conjunction with that problem,you always know the Mac will be at, so you may as well just use that number.

One more thing…

One other caveat seems to apply: this doesn't seem to work (completely) if you're not logged in on your Mac and you use WEP (or possibly WPA)encryption for your AirPort network. This is likely because the encryptionkey is stored in your “personal” keychain. There are almostcertainly ways around this, but I don't tend to have this problem (exceptin theory), so I'm not likely to pursue it further at the moment.

The Short Version

  1. Set up ethernet on the Mac
  2. Enable internet sharing on the Mac
  3. Enable personal web sharing & any other filesharingservices
  4. If the firewall is enabled, disable UDP blocking on the Mac
  5. Connect the ethernet port on the Mac to the ethernet port on anothercomputer, and (if necessary) tell the other computer to get its networksettings from DHCP

The Long Version

My Mac mini is connected via its built-in AirPort Extreme to my wireless gateway, so the ethernet port is free—I have no idea how well these instructions will work, if at all, if you're using your ethernet connection to connect to the Internet.

I'll assume here you're using the same setup I am—I won'tbe held responsible if you're not. I'll also assume that you'vealready got a working connection via your Mac's AirPort to the Internet.Configuring such a connection is beyond the scope of this document.

Dhcp Server For Macos High Sierra

Set up ethernet on the Mac

Dhcp Server For Macos Catalina

Ethernet must somehow be configured on the Mac. I believe the factoryconfiguration is to set it up for DHCP, and that's fine; when itdoesn't find a DHCP server, it will just default to a “private” address. If you want to check, open System Preferencesand click on the “Network” pane:

Click on the menu next to “Show”, and choose “Built-inEthernet”; set the “Configure IPv4” menu to “Using DHCP”:

“Apply Now”, and go on….

It's also possible (and some might say preferable) to simply set theethernet address to Since that's what is used for thesharing, why take up another address, even if it is private? The actualimplementation of this is left to the reader.

Enable internet sharing on the Mac

“Internet Sharing” allows your Mac to act as a gateway,assuming it's connected to the Internet. To enable internet sharing, open System Preferences and click on the “Sharing” icon:

Choose the “Internet Sharing” tab and select to share theAirPort connection to computers using the Ethernet connection. Click“Start”:

Enable Personal Web Sharing & Any Filesharing Services

Internet Sharing on the Mac is designed to do just that, not tosimply to share data between two computers. If your other computer isrunning a service to allow uploading and downloading files (Windows file sharing, for instance, or SFTP), this step may not be necessary.However, if you have the Mac OS X firewall running, you may want to“open it up” a bit more with this and the next step.

If you want to use the Mac as your gateway to the web (so that the other computer doesn't need to have its own connection to the Internet), this is also the time to set that up. Note that this also applies if you simply want to share data between the two computers using HTTP, the protocol that runs the web.

Click on the “Services” tab, and check “PersonalWeb Sharing” and any filesharing services you want to run on the Mac,like Windows Sharing or Personal File Sharing (AppleShare). (Note thatRemote Login also includes SFTP.)

Disable UDP Blocking

DHCP and DNS use UDP; if your Mac isn't responding to UDPrequests, DHCP won't work. Click on the “Firewall” tab:

If the firewall is running, click on the “Advanced”button, and make sure “Block UDP Traffic” is not checked:

Connect and Go!

That's it from the Mac side of things. Most computers areinitially set up to use DHCP on their ethernet ports—refer to yourmachine's documentation if you're unsure how to check or how toset that up. Connect an ethernet cable between the two machines, and start browsing.

Advanced Features

Despite this configuration being rather limited (see the above problems), there are at least one or two moreadvanced things that can be done quite easily. One of the most useful I've found is static IP assignments based on MAC address. For the specifics (which include adding a NetInfo entry), see the man page forbootpd in the terminal.

Dhcp server for mac os

All information on this website (http://www.aleph0.com/), unlessotherwise noted, is wholly the work of Christian Jones ([email protected]). All information, data, and formatting is hereby released into the publicdomain, with no rights reserved. For questions, concerns, or comments,please email the author.

The above screenshots are taken from Apple Computer's Mac OS X version 10.4“Tiger”. They are neither the property nor the creation ofChristian Jones, but are believed to be used here under Fair Use.Please avoid reusing them without appropriate legal consideration.

If you want to determine the IP address of the DHCP server from which a Mac OS X system received its IP address, subnet mask, etc., you can obtain that information from a command-line interface (CLI), i.e., a Terminal window by using the command ipconfig getpacketinterface where interface is the relevant networkinterface, which will usually be en0 or en1.You can issue the command ifconfig -a in a Terminalwindow to see the network interfaces on the system and which haveIP addresses assigned to them.

getpacket interface-name
Prints to standard output the DHCP/BOOTP packet that theclient accepted from the DHCP/BOOTP server. This command isuseful to check what the server provided, and whether thevalues are sensible. This command outputs nothing ifDHCP/BOOTP is not active on the interface, or the attempt toacquire an IP address was unsuccessful.

When you issue the command, you will see output similar to that shownbelow:

Some of the values displayed include the following:

yiaddr:The IP address assigned to the specified network interface on the systemfrom which the command was issued.
server_identifier (ip):The DHCP server's IP address.
chaddr:The Media Access Control (MAC) address associated with the specified network interface.
subnet_mask (ip):The subnet mask.
router (ip_mult):The router to which network packets destined for systems outside thesubnet should be sent, aka, the gateway address.
lease_time (uint32):The lease time in seconds as a hexadecimal value. You can convert the hexadecimal value to a decimal value using ahexadecimalto decimal converter. In the example above hex 15180 equals decimal 86400, which is 1 day, since there are 86,400 seconds in a day.

Dhcp Server For Macos Linux

You can also use the ipconfig's getoption parameter to getspecific values individually.

getoption interface-name (option-name option-code)
Prints the BOOTP/DHCP option with the given name or optioncode integer value. See bootpd(8) for option code names. Ifan option has multiple values e.g. domain_name_server, onlythe first value is printed.

Dhcp Server For Macos 10.13

E.g., the commands below get the DHCP serverIP address, the router's IP address, the subnet mask, and the domain nameserver's IP address. In this case the router is also functioning as the DHCP server and DNS server. You can also get the lease time in seconds and thedomain name, if one has been assigned, though in the example belownone has been assigned. The value below of 86,400 seconds for the lease timemeans the lease of the IP address is good for 1 day, since86400 / 24 / 60 / 60 = 1. When the lease time expires, a system has to querythe DHCP server again for an IP address and associated information. It mayget the same IP address again.