LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices



Reply
 
Search this Thread
Old 06-08-2014, 12:54 PM   #1
blackRonin
Member
 
Registered: Jun 2014
Distribution: CentOS 6.5
Posts: 55

Rep: Reputation: Disabled
Change hostname Centos


Hello

I'm using centos on lenovo x220.
During installation i set up "centosx220" hostname

But after installation complete i see different hostname (220-THINK).
I added attachment

I also see "localhost" on top of the prompt window.

Help me please.
Attached Images
File Type: png screen.png (250.3 KB, 16 views)

Last edited by blackRonin; 06-08-2014 at 12:55 PM.
 
Old 06-08-2014, 06:39 PM   #2
lleb
Senior Member
 
Registered: Dec 2005
Location: Florida
Distribution: CentOS/Fedora
Posts: 2,582

Rep: Reputation: 480Reputation: 480Reputation: 480Reputation: 480Reputation: 480
the localhost at the top of the terminal is 100% correct. you opened a GUI konsole and you are local are you not? then yes that is correct.

to see your host name of the system, in konsole type
Code:
$ hostname
it will report the systems hostname. it will look something like this:
Code:
[user@server ~]$ hostname
server.somename
That is direct from my CentOS box.
 
1 members found this post helpful.
Old 06-09-2014, 03:56 AM   #3
blackRonin
Member
 
Registered: Jun 2014
Distribution: CentOS 6.5
Posts: 55

Original Poster
Rep: Reputation: Disabled
Quote:
piotr@X220-THINK:~$ hostname
X220-THINK
piotr@X220-THINK:~$ su -
Hasło:
root@X220-THINK:~# hostname
X220-THINK
root@X220-THINK:~#
I don't understand why i have X220-THINK, when i didn't type that anywhare.
 
Old 06-09-2014, 04:00 AM   #4
evo2
Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and Scientific Linux
Posts: 5,590

Rep: Reputation: 1227Reputation: 1227Reputation: 1227Reputation: 1227Reputation: 1227Reputation: 1227Reputation: 1227Reputation: 1227Reputation: 1227
Hi,

the hostname can be set by the dhcp server. What is your network setup?

Evo2.
 
1 members found this post helpful.
Old 06-09-2014, 05:59 AM   #5
blackRonin
Member
 
Registered: Jun 2014
Distribution: CentOS 6.5
Posts: 55

Original Poster
Rep: Reputation: Disabled
I have soho router DRG A226G, which is also dhcp server

I looked into router settings, but i couldn't find any options to change hostname or dhcp server settings.

I also tried search into router user manual, but i can't find any dhcp settings there too.
http://beghiero.myftp.org/mendocino8...r%20Manual.pdf
 
Old 06-09-2014, 06:35 AM   #6
ndc85430
Member
 
Registered: Apr 2014
Distribution: Slackware
Posts: 72

Rep: Reputation: Disabled
You can also set the hostname in /etc/sysconfig/network. Add or edit the line beginning "HOSTNAME=". See, e.g. this.
 
1 members found this post helpful.
Old 06-09-2014, 05:07 PM   #7
blackRonin
Member
 
Registered: Jun 2014
Distribution: CentOS 6.5
Posts: 55

Original Poster
Rep: Reputation: Disabled
There is no other way ?
Whey is stored hostname typed during install proces ?
 
Old 06-09-2014, 06:41 PM   #8
jamison20000e
Senior Member
 
Registered: Nov 2005
Location: infinity; (randomly born:) Milwaukee, WI, US, Earth
Distribution: any UNIXish that works well on my cheapest with mostly KDE, Xfce, JWM or CLI but open ;-)
Posts: 1,450
Blog Entries: 2

Rep: Reputation: 381Reputation: 381Reputation: 381Reputation: 381
I've used: http://www.cyberciti.biz/faq/linux-change-hostname/
some distros have set it on me too kinda like way, way back when I used winblow$
 
Old 06-09-2014, 10:13 PM   #9
lleb
Senior Member
 
Registered: Dec 2005
Location: Florida
Distribution: CentOS/Fedora
Posts: 2,582

Rep: Reputation: 480Reputation: 480Reputation: 480Reputation: 480Reputation: 480
yeah, should like something like this:
Code:
[user@server ~]$ cat /etc/sysconfig/network

NETWORKING=yes
HOSTNAME=server.mylan
GATEWAY=192.168.xxx.xxx
fill in your details.
 
Old 06-09-2014, 10:25 PM   #10
GaWdLy
Member
 
Registered: Feb 2013
Location: San Jose, CA
Distribution: RHEL/CentOS/Fedora
Posts: 354

Rep: Reputation: Disabled
BlackRonin: In RH variants like CentOS, hostname is set by DHCP, or in /etc/sysconfig/network. Setting it on the fly ie- '# hostname [somename]' is not permanent and won't persist across reboots.

If you are using the GUI, and NetworkManager, be sure to have the correct hostname set there, too.
 
Old 06-10-2014, 04:31 PM   #11
blackRonin
Member
 
Registered: Jun 2014
Distribution: CentOS 6.5
Posts: 55

Original Poster
Rep: Reputation: Disabled
GaWdLy, i remember when i changed hostname by editting /et/sysconfig/network
Name was changed in console, but other clients in network saw old hostname, and router too.
I couldn't see and ping by new hostname.

So, how i can change it in DHCP ?
 
Old 06-10-2014, 05:17 PM   #12
GaWdLy
Member
 
Registered: Feb 2013
Location: San Jose, CA
Distribution: RHEL/CentOS/Fedora
Posts: 354

Rep: Reputation: Disabled
Quote:
Originally Posted by blackRonin View Post
GaWdLy, i remember when i changed hostname by editting /et/sysconfig/network
Name was changed in console, but other clients in network saw old hostname, and router too.
I couldn't see and ping by new hostname.
After a full service stop/start, or a reboot?

Quote:
So, how i can change it in DHCP ?
I think it's set by the DHCP server...
 
Old 06-10-2014, 07:38 PM   #13
blackRonin
Member
 
Registered: Jun 2014
Distribution: CentOS 6.5
Posts: 55

Original Poster
Rep: Reputation: Disabled
GaWdLy, yes after reboot still the same in router settings:

Quote:
[root@linux1 ~]# cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=linux1
NOZEROCONF=yes
GATEWAYDEV=eth0
IPV6INIT=yes
IPV6_DEFAULTDEV=eth0
NETWORKING_IPV6=yes
etc/hosts
Quote:
127.0.0.1 localhost.localdomain localhost.localdomain localhost4 localhost4.localdomain4 localhost linux1
::1 localhost.localdomain localhost.localdomain localhost6 localhost6.localdomain6 localhost linux1
And in router is see:
"new-host 192.168.1.228"

In router i have see no option to change that.
 
Old 06-10-2014, 09:58 PM   #14
michaelk
Moderator
 
Registered: Aug 2002
Posts: 12,152

Rep: Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783
The DHCP client sends the hostname to the server.

Try adding the directive DHCP_HOSTNAME=hostname to your /etc/sysconfig/network-scripts/ifcfg-eth0
 
Old 06-11-2014, 09:43 PM   #15
lleb
Senior Member
 
Registered: Dec 2005
Location: Florida
Distribution: CentOS/Fedora
Posts: 2,582

Rep: Reputation: 480Reputation: 480Reputation: 480Reputation: 480Reputation: 480
https://access.redhat.com/site/docum...ng-client.html

most DHCP servers set the name, but if the DHCP server requires the name from the client, then you would use the DHCP_HOSTNAME= from michaelk's post.

Quote:
DHCP_HOSTNAME — Only use this option if the DHCP server requires the client to specify a hostname before receiving an IP address.
 
  


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
'hostname some_name' does not change the hostname. stf92 Slackware 11 02-21-2013 08:09 PM
getting errors related to hostname -- security problem? ok to change hostname? sneakyimp Linux - Server 2 11-18-2012 06:25 PM
Centos 6 - machine does not know it's own hostname yanom Red Hat 1 07-18-2012 01:21 AM
change hostname of LINUX CentOS 5 while running informix server ytd Linux - General 5 08-11-2009 02:04 AM
after hostname change, syslogd still output previous hostname to messages file tiger2000 Linux - General 3 07-22-2009 10:36 PM


All times are GMT -5. The time now is 07:25 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration