"How To" Guides for Mac OS X

You are currently using a web browser that does not support HTML 5. Please try the XHTML 1 or XHTML 1 Mobile version of this page instead.

How to set up DNS on your local network

This section describes how to set up DNS on your home network, or any local network. The steps are:

  1. Determine what names you will use on the network
  2. Set the Local Hostname of your system(s)
  3. Display the Local Domain for Web Sharing
  4. Set up your search domains

These steps are described in more detail in the following sections.

Naming the Network and the Nodes on the Network

Naming the Network

Ideally, you would like to have your own domain name for your network. You can get a domain name for under $10/year at domain name registration sites like A to Z Domains. If you own a domain name, you can create subdomains for your network(s) under it.

One option for naming your network(s) is to include the location as part of the name. For example, if you have registered the domain name ExampleOnly.com and live at "1337 Fleet Street", then your local network at home could be named FleetStreet.ExampleOnly.com. With this scheme, if you also connect to a local network someplace else, it could be named AnotherPlace.ExampleOnly.com

Naming the Node(s)

Choose a unique name for each node on the network. These names should be no more than 26 characters.

Set the Local Hostname of your system(s)

Start the System Preferences application by clicking on its icon in the dock, or, from the Terminal window, enter:

open -a System\ Preferences

and select Sharing then Edit... to navigate to the screen where the Local Host Name can be changed:

The local host name will end with .local. If it's not already set to the desired hostname, change it, and save the change. This will set the System:Network:HostNames:LocalHostName in /Library/Preferences/SystemConfiguration/preferences.plist.

Display the Local Domain for Web Sharing

Start the System Preferences application by clicking on its icon in the dock, or, from the Terminal window, enter:

open -a System\ Preferences

and navigate to the Sharing screen. If not already checked, select the check box next to Web Sharing. This will display a couple of lines that show URLs including the Local Domain name:

Your computer's website: http:hostname.local-domain/
Your personal website: http:hostname.local-domain/~username/

After you've seen the local domain name, you can deselect the check box to disable Web Sharing again.

If the local domain is not already set to the desired name, you will need to change the name of your local network. How you accomplish this depends on how you are connected to the Internet. You may need to change the DNS settings on your router.

Verify the configuration

On your computer, start the Terminal application and enter hostname. If both the computer's local name and the network's local domain are set up, then you should see a fully-qualified name, such as:

MyMac.FleetStreet.ExampleOnly.com/

Last updated Saturday June 13, 2009


Printer-friendly PDF* format:

How To Guides for Mac OS X

This Section

You are currently viewing this page in HTML 5 Style Sheet* format (* see Clicklets for more infomation). This document is also available in HTML 5 XML*HTML 5 non-XML*XHTML 1 Style Sheet*XHTML 1*XML* HTML 4* XHTML 2* XHTML Mobile* WML Mobile* and printer-friendly PDF* formats. This is accomplished with Single Source Publishing, a content management system that uses templates in XSLT style sheets provided by XML Styles .com to transform the source content for various content delivery channels. There is also RDF* metadata that describes the content of this document.