Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I have tried changing my hostname which currently is "localhost" to "myBOX" without success; I have tried editing some of the files advised on this site and others without success, any help will be appreciated.
The changes I made so far were
vi /etc/sysconfig/network
#I added the line HOSTNAME = myBox
Rebooted the machine, no change, i did the same thing as advised on another site with the files
/etc/sysconfig/network-scripts/ifcfg-eth0
and
/etc/sysconfig/network-scripts/ifcfg-wlan0
still no change after rebooting, I still have "[myname@localhost]$ " on my command prompt
Thanks, I followed the direction in the guide, but I am still a bit confused; I rebooted the machine and it still shows my hostname as "localhost" on the terminal, and when I type "$hostane" or "$uname -n" on the terminal I get printed "localhost", however I get the desired result with "$hostname -f" and "$hostname -s".
Any idea on why this is happening???
I tried the above, with no succses; this is what /etc/hosts looks like:
# generated by drakhosts
#127.0.0.1 drivaBOX.YANHOME localhost.localdomain localhost
192.168.1.8 YANHOME drivaBOX
ps: I also tried with the 2nd line uncommented, same result.
and this is a copy of /etc/sysconfig/network
NETWORKING=yes
HOSTNAME = "drivaBOX.YANHOME"
DHCP_HOSTNAME = "drivaBOX.YANHOME"
I also would like to add that here the hostname is drivaBOX and the localdomain is YANHOME.
Last edited by ServalSoft; 03-02-2009 at 10:58 AM.
If you did all 6 steps in that document I posted I would be really surprised if it did not work.
Are you sure you didn't skip any steps at all ?
Following that entire guide, you would not need to reboot for the new hostname to be active.
the /proc/sys/kernel/hostname step will make the final change on the fly.
As far as I can see I did not miss a single step, below is a copy of the edited files you mention in the tutorial, I hope you can make sense of it. There is something however I am not to sure about is what you mean by receiving the IP from a DHCP server, on my wlan comfiguration it is mean to be getting the ip automatically. it is not a manual configuration.
If you did all 6 steps in that document I posted I would be really surprised if it did not work....
Hey, it seems that you were right, I tried to steps again, and this time it worked, I am right in the middle of something so I can't restart the pc now to check if my settings survived a reboot. "I hope they did". in any case, thanks you very much for your help.
Unfortunately, the settings do not survive a reboot, the only way I get it to work, is by following the steps, then after I have to log out and log back in to get the desired result. What I realise was after a reboot, i have to go into the terminal and issue the command
Code:
#hostname drivaBOX.YANHOME
, then log out and back in. When I reboot, everything is gone. Just another area where I think it might be the problem, when you say if the IP is auto assigned by DHCP you mean an auto configuration right? because when I connect to my WLAN, I let the system assigned the IP address. this is a copy of some of my set files:
The first fragment is where I am a lil bit confused as to what to enter. I am connected to the internet through a wireless router, and every computers in the house have their IP automatically assigned.
When you say everything is gone do you mean all the files you changed reverted back to their previous settings ? That certainly shouldn't happen, unless dhcp is overwriting the changes..
Assuming that the interface to your LAN and/or broadband modem and/or router is eth0, next edit the /etc/sysconfig/network-scripts/ifcfg-eth0 file, editing/adding this line:
Code:
NEEDHOSTNAME=no
If you are experiencing issues with retaining your hostname and you utilize DHCP add the following line to /etc/sysconfig/network-scripts/ifcfg-eth0
No I dont meant the files are being reverted to the original, I mean the hostname gets changed back to localhost. And I can only set it to drivaBOX by issuing the command "$hostname drivaBOX.YANHOME", then logging out and logging back in again. But if I restart the laptop, I am back to "localhost" at the prompt. I am connection to my router using wifi, I therefore edited the
/etc/sysconfig/network-scripts/ifcfg-wlan0 as follow:
Either that or assign your box a static IP address..
I'm rather stumped, it appears you have applied all the workarounds recommended, and those from the Mandriva docs, yet it's not sticking..
Does your router have the ability to hand out hostnames as part of the DHCP offer ? if so you could make a reservation for your NIC, so you would always get the same IP and hostmname via dhcp..
If you mean can I assign static IP to machines on my network, yes I can, I tried it before with my windows machine, and it works fine, I just choose to leave them to automatic because it is less settings for me to configure... Every time I used this machine to connect at home I get the assigned ip 192.168.1.8
I tried a debian and slack install once, and they both allowed me to choose the hostname during set up, maybe Mdriva should do the same...
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.