Re: gethostname returns loginname on "Pather Server" version
Re: gethostname returns loginname on "Pather Server" version
- Subject: Re: gethostname returns loginname on "Pather Server" version
- From: Allan Nathanson <email@hidden>
- Date: Sat, 7 Feb 2004 12:30:52 -0500
On Feb 7, 2004, at 9:23 AM, Robert MacGregor wrote:
Allan,
This is very useful information. I've noticed if I use 'Turn AirPort
Off' my machine will set it's hostname to it's Rendezvous name.
Does the BSD hostname algorithm run every time the network location is
set?
Yes, the BSD hostname algorithm is run whenever the "primary" IP
address changes, whenever the DNS configuration changes, and whenever
the rendezvous name changes.
- Allan
On Feb 6, 2004, at 9:11 PM, Allan Nathanson wrote:
Why can't I name my computer "admin"? Should all currently defined
login names be excluded as possible host names?
And as to any conventions used for setting the BSD hostname
(gethostname(3), sethostname(3))... You are correct that the
standards are ambiguous. Suggesting that the name have some
relevance to a hosts DNS name, while a nice idea, makes a number of
assumptions including:
- the system is actually connected to a network
- the system has only one network interface
- the system has only one IP address
- only one name is associated with the one IP address
Unfortunately, you can't make any of these assumptions. The world of
computers is no longer as simple as the days when all computers were
large, bolted to the floor, and non-functional unless the network was
accessible.
What are we (Apple) doing? Here's the algorithm that we use to set
the BSD hostname:
1. if available, use the name specified in the /etc/hostconfig
file (HOSTNAME=my-host-name)
... and this name need not have any association with a DNS name
2. if available, use the name provided by the DHCP/BOOTP server
for the "primary" IP address
... and this name need not have any association with a DNS name
3. if available, use the [first] name returned by a reverse DNS
(address-->name) query for the "primary" IP address
4. if available, use the rendezvous hostname
5. use "localhost"
In short, we "try" to set the BSD hostname to something reasonable
but there are no guarantees.
- Allan
p.s. I believe that Mac OS X Server systems tend to set a fixed name
in the /etc/hostconfig file.
_______________________________________________
macnetworkprog mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/macnetworkprog
Do not post admin requests to the list. They will be ignored.