AIXIncorrectHostname

How to set the hostname if 'uname' does not work properly

Sometimes, on a machine that has several network cards, the uname -a does not return the proper hostname.

For instance:

andre@galactus$ uname -a
AIX surfer 3 5 000AE52CD600

What gives? Simply that the ODM has kept the hostname configured on one of the network interfaces as the current name of the machine.

Solving this requires a bit of mucking around:

Simply enter this as root:

# uname -S galactus
# uname -a
AIX galactus 3 5 000AE52CD600

This requires editing two lines in /etc/rc.net, that set the name of the machine based on the output of the hostname command.

Here are the lines to be modified in /etc/rc.net:

##################################################################
# Part III - Miscellaneous Commands.
##################################################################
# Set the hostid and uname to `hostname`, where hostname has been
# set via ODM in Part I, or directly in Part II.
# (Note it is not required that hostname, hostid and uname all be
# the same).
/usr/sbin/hostid `hostname`             >>$LOGFILE 2>&1
/bin/uname -S`hostname|sed 's/\..*$//'` >>$LOGFILE 2>&1

The second line, with the uname -S command, should be changed as follows:

/bin/uname -S desired_host_name >>$LOGFILE 2>&1

Of course, the desired_host_name part should be changed to the desired host name. Duh.

Hope this helps!