Incorrect hostname in OS X?

enter image description here

I'm not sure why the hostname is now jessica-s-phone. I am on a public wifi, and some googling revealed that the hostname is set by a DNS, so is it possible my iTerm chose someones phone as the host?


Hosts can receive their hostname via DHCP, but it's not terribly common. It's far more common that they get their IPv4 address via DHCP, and then do a reverse-DNS lookup to determine the hostname for that IP address.

To see if you happened to get your hostname via DHCP, run ipconfig getpacket en1 (Replace en1 with the correct BSD-level interface identifier for the Wi-Fi interface in question. Yes, OS X has an ipconfig, and no, it's not anything like Windows' ipconfig). At the bottom of the output will be a list of DHCP message options and their values. If you see "hostname" or "client fqdn", then sure enough, your DHCP server gave you your hostname. If you don't see either, then you probably got it from DNS. In that case, look at what DNS server it pointed you at. It probably pointed you at a DNS server on the local network, perhaps built into the router itself.

Use ifconfig en1 (again, replace en1 if necessary) to see what IPv4 address you have on that interface. Use host $IPADDR (replace $IPADDR with your IPv4 address) to see what your current view of the DNS system thinks your hostname is.