Change Hostname in Linux?

CrazyHelloDeli

Platinum Member
Jun 24, 2001
2,854
0
0
I know it sounds like a dumb question, but I cant figure it out. I can change the host and domain name, but as soon as I reboot it changes back to localhost.localdomain. Ive used redhat netconfig, linuxconf, hostname command, and editing the /etc/hosts files and no matter what they are set at, bash shows root@localhost root] and hostname gives output of localhost.localdomain. ARRRRGGGG!!!! RH 7.2 btw...
 

CrazyHelloDeli

Platinum Member
Jun 24, 2001
2,854
0
0
But im telling you, it doesnt stick. As soon as I reboot, its back to localhost.localdomain, yet the entry in /etc/hosts will stay the way I set it. *tares hair out* :angry:

Could I have a service running thats forcing it back to the default? Any way I could find out?
 

CrazyHelloDeli

Platinum Member
Jun 24, 2001
2,854
0
0
There is no /etc/hostname just /etc/hosts. Bubba, thx man it worked....

Except, now my NIC doesnt work. I had a full install of RH 7.2, with anything and everything installed, but as soon as I changed the hostname, NFS, Samba, Apache, NIS, you name it, they all fail on reboot which makes sense to me. I figured WTH, ill just change it back so I can do somthing else, but nope. I cant ping localhost and cant ping my ip at all, and ifconfig returns nothing.

So I went back and set my ip, netmask etc again with ifconfig, but even then it wont let me ping localhost or ip. LOL Wtf does changing the hostname screw up the. Ive gone through and re-done everything I did when I first installed and got the NIC running, but now I cant. Any idea whats up?
 

smp

Diamond Member
Dec 6, 2000
5,215
0
76
Your hostname (old) might be referenced all over the place in conf files maybe? I don't know redhat though so.....
 

n0cmonkey

Elite Member
Jun 10, 2001
42,936
1
0
Make sure you still have:

127.0.0.0.1 localhost.domain localhost

In your /etc/hosts file.
 

wuboy

Member
Feb 28, 2002
59
0
0


<< So I went back and set my ip, netmask etc again with ifconfig, but even then it wont let me ping localhost or ip. LOL Wtf does changing the hostname screw up the. Ive gone through and re-done everything I did when I first installed and got the NIC running, but now I cant. Any idea whats up? >>



you'll have to change /etc/sysconfig/network as bubba said.
then go to /etc/sysconfig/network-scripts/ and look at ifcfg-eth0 to make sure the parameters are consistent with that network file... namely the gateway must be correct.
additionally, the /etc/hosts file also contains your hostname, and you'll want to change that as well. make sure the loopback IP address is there (127.0.0.1).
finally, if these dont work, you'll have to take a look at your /etc/resolv.conf file to check that your DNS servers are configured correctly.

ive had similar problems before, but hope you can work through it and try your best :)