Web Hosting Talk







View Full Version : How is "hostname" set?


pmak0
06-26-2001, 08:22 AM
When a machine boots up, how does it determine what its "hostname" is?

I'm trying to determine the "correct" way of changing a machine's hostname.

XTStrike
06-26-2001, 10:54 AM
OS?

pmak0
06-26-2001, 10:55 AM
Originally posted by xtstrike
OS?

$ uname -a
Linux sg3.aaanime.net 2.2.16-3 #1 Mon Jun 19 18:10:14 EDT 2000 i686 unknown

Planet Z
06-26-2001, 11:50 AM
Usually it's based off the hostname of the server in the network settings. If you're using RedHat you should be able to set it in linuxconf

pmak0
06-26-2001, 12:02 PM
Originally posted by Planet Z
Usually it's based off the hostname of the server in the network settings. If you're using RedHat you should be able to set it in linuxconf

Forgive my ignorance, but what is linuxconf? I can't find it on my system.

[root@sg1 root]# linuxconf
bash: linuxconf: command not found
[root@sg1 root]# locate linuxconf
/usr/doc/rhl-gsg-6.1en/figs/basics/linuxconfuser.gif
[root@sg1 root]#

Planet Z
06-26-2001, 12:39 PM
It's a config program for RH. I thought it came installed by default. Guess not. You should be able to install it from an RPM if you want.

There's probably another way to set it, but I don't know. I'm not really a RedHat guru. Anyone else?

Chas
06-26-2001, 01:02 PM
Can't you edit /etc/rc.conf and change the hostname= ? Or is that a FreeBSD thing? I will look at my redhat box when I get home and see if I can find it.

Regards,
Chas

Planet Z
06-26-2001, 01:58 PM
Chas: I checked one of our RH boxes and it didn't have an /etc/rc.conf

I know that's how you'd do it on BSD, but it seems the RH architecture is a little different.

JTY
06-26-2001, 05:54 PM
I'm thinking /etc/sysconfig/network

Mike the newbie
06-26-2001, 06:30 PM
Try man hostname

On my Linux box (RH 7.0), to set the hostname to newname the command is

hostname newname


YMMV

Mike the newbie
06-26-2001, 09:17 PM
OK, I played some more on my test linux box (RH 7.0), and discovered the following:

The hostnames command may not be what you're looking for, the result of that is not persistent.

Take a look and see if you have the file /etc/sysconfig/network. If you do, look at its contents and see if the hostname is in it. That's where the hostname is set on my box.

I changed the hostname in that file and rebooted the box, and it came up with the new hostname. I tried just restarting the network service script (/etc/init.d/network) but that didn't work (it may have required me to reconfigure my DHCP which I didn't want to do for this test).

In any case, take a peek at the /etc/sysconfig/network file and see if that helps you.

pmak0
06-26-2001, 09:31 PM
Cool, I have an /etc/sysconfig/network file. Thanks!