LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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


Reply
  Search this Thread
Old 03-02-2009, 08:47 AM   #1
ServalSoft
Member
 
Registered: Nov 2003
Distribution: mandriva pwp 2010
Posts: 74

Rep: Reputation: 15
Changing HOSTNAME in mandriva 2009


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
 
Old 03-02-2009, 09:11 AM   #2
farslayer
LQ Guru
 
Registered: Oct 2005
Location: Northeast Ohio
Distribution: linuxdebian
Posts: 7,241
Blog Entries: 5

Rep: Reputation: 190Reputation: 190
Try following this guide..

http://linux-journal.blogspot.com/20...host-name.html

Should get you sorted just fine,.
 
Old 03-02-2009, 09:58 AM   #3
ServalSoft
Member
 
Registered: Nov 2003
Distribution: mandriva pwp 2010
Posts: 74

Original Poster
Rep: Reputation: 15
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???
 
Old 03-02-2009, 11:16 AM   #4
jkzfixme
Member
 
Registered: Sep 2006
Location: Orange County, NY
Distribution: Ubuntu, Solaris, Android
Posts: 329
Blog Entries: 21

Rep: Reputation: 52
enter this as root

Quote:
vi /etc/hosts
Quote:
127.0.0.1 localhost.localdomain localhost
192.168.0.100 mybox.com mybox
wheras 192.168.0.100 is your ip

now you check it

Quote:
hostname
hostname -f
If that didn't work you can do this

Quote:
echo mybox.com > /etc/hostname
/bin/hostname -F /etc/hostname
Regards,
JKZfixme
 
Old 03-02-2009, 11:55 AM   #5
ServalSoft
Member
 
Registered: Nov 2003
Distribution: mandriva pwp 2010
Posts: 74

Original Poster
Rep: Reputation: 15
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 11:58 AM.
 
Old 03-02-2009, 04:02 PM   #6
farslayer
LQ Guru
 
Registered: Oct 2005
Location: Northeast Ohio
Distribution: linuxdebian
Posts: 7,241
Blog Entries: 5

Rep: Reputation: 190Reputation: 190
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.

Last edited by farslayer; 03-02-2009 at 04:04 PM.
 
Old 03-02-2009, 05:35 PM   #7
ServalSoft
Member
 
Registered: Nov 2003
Distribution: mandriva pwp 2010
Posts: 74

Original Poster
Rep: Reputation: 15
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.

Code:
[root@localhost yanick]# uname -n
localhost
[root@localhost yanick]# hostname -a
localhost.localdomain localhost
[root@localhost yanick]# hostname -d
YANHOME
[root@localhost yanick]# hostname -f
drivaBOX.YANHOME
[root@localhost yanick]# hostname
localhost
[root@localhost yanick]# 

/etc/hosts
127.0.0.1 drivaBOX.YANHOME  localhost.localdomain localhost
192.168.1.8 YANHOME drivaBOX

/etc/sysconfig/network
NETWORKING=yes
HOSTNAME = "drivaBOX.YANHOME"
DHCP_HOSTNAME = "drivaBOX.YANHOME"
I didnt think it would be so much headache just to change the box name from one to the other.
 
Old 03-02-2009, 07:32 PM   #8
ServalSoft
Member
 
Registered: Nov 2003
Distribution: mandriva pwp 2010
Posts: 74

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by farslayer View Post
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.
 
Old 03-02-2009, 09:40 PM   #9
farslayer
LQ Guru
 
Registered: Oct 2005
Location: Northeast Ohio
Distribution: linuxdebian
Posts: 7,241
Blog Entries: 5

Rep: Reputation: 190Reputation: 190
It should survive a reboot without any trouble.

Glad you got it all sorted out.
 
Old 03-03-2009, 09:50 PM   #10
ServalSoft
Member
 
Registered: Nov 2003
Distribution: mandriva pwp 2010
Posts: 74

Original Poster
Rep: Reputation: 15
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.
Code:
 /etc/hosts
$ cat /etc/hosts
# generated by drakhosts
127.0.0.1 drivaBOX.YANHOME  localhost.localdomain localhost drivaBOX
192.168.1.8 YANHOME drivaBOX
and

Code:
 
$ cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME = "drivaBOX.YANHOME"
DHCP_HOSTNAME = "drivaBOX.YANHOME"
Thanks for your time
 
Old 03-04-2009, 12:10 AM   #11
farslayer
LQ Guru
 
Registered: Oct 2005
Location: Northeast Ohio
Distribution: linuxdebian
Posts: 7,241
Blog Entries: 5

Rep: Reputation: 190Reputation: 190
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..

Mandriva Docs..
http://wiki.mandriva.com/en/Docs/Sys...m.27s_Hostname
Quote:
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
Code:
DHCP_HOSTNAME=yourhostname.localdomain
 
Old 03-04-2009, 04:21 AM   #12
ServalSoft
Member
 
Registered: Nov 2003
Distribution: mandriva pwp 2010
Posts: 74

Original Poster
Rep: Reputation: 15
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:
Code:
 
DEVICE=wlan0
BOOTPROTO=dhcp
ONBOOT=yes
METRIC=35
MII_NOT_SUPPORTED=no
USERCTL=yes
RESOLV_MODS=no
WIRELESS_MODE=Managed
WIRELESS_ESSID=YanWLan
WIRELESS_ENC_KEY=a1b2c3d4e5
WIRELESS_ENC_MODE=open
WIRELESS_WPA_DRIVER=wext
WIRELESS_WPA_REASSOCIATE=no
IPV6INIT=yes
IPV6TO4INIT=yes
DHCP_CLIENT=dhclient
NEEDHOSTNAME=no
PEERDNS=yes
PEERYP=yes
PEERNTPD=no
DHCP_HOSTNAME = drivaBOX.YANHOME
Note I added the last line. I also did the same for my ethernet card just in case.
/etc/sysconfig/newtwork-scripts/ifcfg-eth0
Code:
DEVICE=eth0
BOOTPROTO=dhcp
NETMASK=255.255.255.0
ONBOOT=yes
METRIC=10
DHCP_HOSTNAME=drivaBOX.YANHOME
I rebooted, and still the changes were not perpanent. any ideas?? or do I just need to resolve myself to using the default "localhost" as hostname?
 
Old 03-04-2009, 09:35 AM   #13
farslayer
LQ Guru
 
Registered: Oct 2005
Location: Northeast Ohio
Distribution: linuxdebian
Posts: 7,241
Blog Entries: 5

Rep: Reputation: 190Reputation: 190
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..
 
Old 03-04-2009, 10:19 AM   #14
ServalSoft
Member
 
Registered: Nov 2003
Distribution: mandriva pwp 2010
Posts: 74

Original Poster
Rep: Reputation: 15
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...
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Mandriva 2009 hangs Gins Mandriva 18 02-09-2009 11:18 PM
Trouble with Mandriva One 2009 shea1roh Mandriva 8 02-05-2009 07:08 AM
Mandriva 2009 for amd 64? Abraxis Mandriva 7 01-05-2009 10:32 AM
changing XFCE keyboard shortcuts in Mandriva 2009 adityavpratap Mandriva 0 12-23-2008 12:28 AM
digiKam in Mandriva 2009 jancyclops Linux - Software 0 12-13-2008 05:21 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:53 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration