Is it possible to configure OS X  to use the domain-name supplied by DHCP option 15? I run a small home network, and have configured my DHCP server to provide a domain name with all responses. My MacBook Air (running 10.7.3) places the provided domain in the DNS search path, but does not set the local domain accordingly. Note, the actual domain name has been replaced with my.example.com in the output below, and IP/MAC addresses have been stripped. Diagnostic information below. I've poked around in System Preferences -&gt; Network -&gt; Wi Fi -&gt; Advanced with no luck, other than statically setting the hostname, which obviously doesn't work if I roam between networks. Does anyone else have any other suggestions?



The search domain is set correctly in /etc/resolv.conf:

% cat /etc/resolv.conf
#
# Mac OS X Notice
#
# This file is not used by the host name and address resolution
# or the DNS query routing mechanisms used by most processes on
# this Mac OS X system.#
# This file is automatically generated.
#
search my.example.com
nameserver &lt;DNS IP addr&gt;
nameserver &lt;DNS IPv6 addr&gt;
%


However, hostname -f doesn't reflect the domain in the FQDN:

% hostname -f
myhost.local
%


Running tcpdump and forcing a DHCP renewal confirms that option 15 is present in both the DHCP request and reply, but seemingly isn't being used by OS X other than to set the DNS search path.

% sudo tcpdump -n -ien0 -vvvvv udp port 67
tcpdump: listening on en0, link-type EN10MB (Ethernet), capture size 65535 bytes
01:13:25.061622 IP (tos 0x0, ttl 255, id 26061, offset 0, flags [none], proto UDP (17), length 328)
    0.0.0.0.68 &gt; 255.255.255.255.67: [udp sum ok] BOOTP/DHCP, Request from &lt;my MAC addr&gt;, length 300, xid 0x463f9f78, Flags [none] (0x0000)
          Client-Ethernet-Address &lt;my MAC addr&gt;
          Vendor-rfc1048 Extensions
            Magic Cookie 0x63825363
            DHCP-Message Option 53, length 1: Request
            Parameter-Request Option 55, length 9: 
              Subnet-Mask, Default-Gateway, Domain-Name-Server, Domain-Name
              Option 119, LDAP, Option 252, Netbios-Name-Server
              Netbios-Node
            MSZ Option 57, length 2: 1500
            Client-ID Option 61, length 9: "myhost"
            Requested-IP Option 50, length 4: &lt;my IP addr&gt;
            Lease-Time Option 51, length 4: 7776000
            Hostname Option 12, length 8: "myhost"
            END Option 255, length 0
            PAD Option 0, length 0, occurs 8
01:13:25.068967 IP (tos 0x10, ttl 128, id 0, offset 0, flags [none], proto UDP (17), length 328)
    &lt;srv IP addr&gt;.67 &gt; &lt;my IP addr&gt;.68: [udp sum ok] BOOTP/DHCP, Reply, length 300, xid 0x463f9f78, Flags [none] (0x0000)
          Your-IP &lt;my IP addr&gt;
          Client-Ethernet-Address &lt;my MAC addr&gt;
          Vendor-rfc1048 Extensions
            Magic Cookie 0x63825363
            DHCP-Message Option 53, length 1: ACK
            Server-ID Option 54, length 4: &lt;srv IP addr&gt;
            Lease-Time Option 51, length 4: 86400
            Subnet-Mask Option 1, length 4: &lt;subnet mask&gt;
            Default-Gateway Option 3, length 4: &lt;my IP addr&gt;
            Domain-Name-Server Option 6, length 4: &lt;DNS IP addr&gt;
            Domain-Name Option 15, length 13: "my.example.com"
            END Option 255, length 0
            PAD Option 0, length 0, occurs 11
^C
2 packets captured
1458 packets received by filter
0 packets dropped by kernel
Not understanding whats exactly your problem. Maybe this can help you. 

If you set the search option, in your own config (network->advanced->dns->search domains) or by your dhcp server. You basically eliminate the need to add this part to a fqdn.

Example:


  search: foo.com


then, 


  ping test


would try to resolve test.foo.com

So, in your case that would be test.my.example.com

Futhermore, setting your local name, you can change under:


  Sharing -> Edit...