Linode Forum
https://forum.linode.com/

How to set the hostname? (CentOS/DHCP)
https://forum.linode.com/viewtopic.php?f=19&t=1632
Page 1 of 1

Author:  mpolhamus [ Fri Apr 22, 2005 4:07 pm ]
Post subject:  How to set the hostname? (CentOS/DHCP)

This must be a FAQ, but I couldn't find anything.

How do I set the hostname on my Linode? I'm using the default (DHCP) configuration on CentOS 3.1.

I can set the hostname using hostname command, but it does back to the original (liXX-XXX.members.linode.com) on reboot.

Where in the tangle of network scripts and config files is the *right* place to change the hostname for this configuration?

I have DNS and reverse DNS working.

Author:  caker [ Fri Apr 22, 2005 4:22 pm ]
Post subject: 

http://www.linode.com/forums/viewtopic.php?t=1027

-Chris

Author:  mpolhamus [ Fri Apr 22, 2005 4:32 pm ]
Post subject: 

Quote:
http://www.linode.com/forums/viewtopic.php?t=1027


That is a good description of how to set up Webmin on CentOS, and I suppose Webmin knows how to set the hostname, but I would rather not run Webmin.

In most problems like this you can grep for hints, but since the default hostname comes from the DHCP server that approach doesn't work in this case :(

Author:  NeonNero [ Fri Apr 22, 2005 6:35 pm ]
Post subject: 

I think caker is referring to step 5 in that tutorial.

Quote:
Step Five
Update your hostname

Code:
 echo yourdomainnamehere >/etc/hostname  

Code:
 /bin/hostname -F /etc/hostname 

Author:  mpolhamus [ Fri Apr 22, 2005 9:05 pm ]
Post subject: 

Quote:
Code:
echo yourdomainnamehere >/etc/hostname

Code:
/bin/hostname -F /etc/hostname


Ok, I see, Webmin not required I guess. I read too fast, please excuse me.

But this is what I already tried. The problem is on the next reboot I'm back to the original hostname assigned by Linode, I guess it is coming from the DHCP server. Should I invoke /bin/hostname in /etc/rc.local?

Doesn't seem right to set one hostname during startup and immediately switch every time.

I guess I could switch to a static IP configuration if I have to.

Author:  NeonNero [ Fri Apr 22, 2005 9:53 pm ]
Post subject: 

I'm using Gentoo myself, and it handles this without problems.

Just to double-check, what is the actual contents of your /etc/hostname file at the moment?

Author:  mpolhamus [ Fri Apr 22, 2005 10:42 pm ]
Post subject: 

Quote:
Just to double-check, what is the actual contents of your /etc/hostname file at the moment?


It contains the fully qualified domain name (ending in ".com"). It's three levels: <host>.<domain>.com. Resolves in DNS to the IP address of the Linode UML machine.

Author:  mpolhamus [ Sat Apr 23, 2005 9:47 am ]
Post subject: 

Just for the record: I fixed the "HOSTNAME=" line in /etc/sysconfig/network and it seems to be working for me now.

Finally found the right Google keywords and picked up on a discussion from 2003 at LinuxForums.org: http://www.linuxforums.org/forum/topic-350-0.html.

I still have /etc/hostname set but I'm not sure it is required for CentOS.

Page 1 of 1 All times are UTC-04:00
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/