2

I am from a Linux background with a fair amount of Windows knowledge too but I find myself in the curious position of having to look after someone's macbook air. I am totally new to OSX.

I would appreciate some guidance to help me understand how the computer's host and domain names are configured when a basic DHCP client networking is being used.

So far, I understand there are several names including a Computer Name and a host name. By default the computer name is a wordy description (like "Fred's MacBook Air") and I have found this prevents the correct host name being published by the DHCP/DNS server. I found changing the computer name to "myhost" fixed this.

I assume the FQDN is obtained from the DHCP server and this sets the search domains to "mydomain.com" - if not then I'd like to understand how is this set - because on the network settings DNS screen it is displayed but greyed out.

The "domainname" command in a terminal returns nothing. The file /etc/resolv.conf has a big banner saying it isn't used. Something is setting the machine's domain name and, here's the rub: it's inserting backslashes into it.

This can be seen on the sharing page for remote logins where it says To log in to this computer remotely, type "ssh myname@myhost.mydomain\.com". It can also be experienced via the mail app because this sends a bad HELO to the SMTP server when sending mail, causing the send to fail (trying to fix this is the original reason I set off down this path of enlightenment).

So, rambling on a bit, I guess my question distils down to

(a) an explanation of host/domain name/network configuration on OSX would be greatly appreciated, and (b) how to I set the domain name so that it does not have backslashes in it ?

starfry
  • 623

2 Answers2

1

I believe the command you want is scutil --set HostName name-of-host
I don't believe Mac OS X sets a standard FQDN hostname by default (just a .local (Bonjour) host name. You can get more detailed information from the man pages of scutil and hostname.
BTW, if you need to flush/reset the DNS cache, do this sudo killall -HUP mDNSResponder

race_carr
  • 201
1

there are three scutil --set commands you have to issue:

scutil --set HostName NameOfHost

scutil --set LocalHostName NameOfHost

scutil --set ComputerName NameOfHost