Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game. |
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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
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.
|
|
|
06-08-2014, 11:54 AM
|
#1
|
Member
Registered: Jun 2014
Distribution: Debian 9.6
Posts: 68
Rep:
|
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.
Last edited by blackRonin; 06-08-2014 at 11:55 AM.
|
|
|
06-08-2014, 05:39 PM
|
#2
|
Senior Member
Registered: Dec 2005
Location: Florida
Distribution: CentOS/Fedora/Pop!_OS
Posts: 2,983
|
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
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.
|
06-09-2014, 02:56 AM
|
#3
|
Member
Registered: Jun 2014
Distribution: Debian 9.6
Posts: 68
Original Poster
Rep:
|
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.
|
|
|
06-09-2014, 03:00 AM
|
#4
|
LQ Guru
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,726
|
Hi,
the hostname can be set by the dhcp server. What is your network setup?
Evo2.
|
|
1 members found this post helpful.
|
06-09-2014, 04:59 AM
|
#5
|
Member
Registered: Jun 2014
Distribution: Debian 9.6
Posts: 68
Original Poster
Rep:
|
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
|
|
|
06-09-2014, 05:35 AM
|
#6
|
Member
Registered: Apr 2014
Distribution: Slackware
Posts: 92
Rep:
|
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.
|
06-09-2014, 04:07 PM
|
#7
|
Member
Registered: Jun 2014
Distribution: Debian 9.6
Posts: 68
Original Poster
Rep:
|
There is no other way ?
Whey is stored hostname typed during install proces ?
|
|
|
06-09-2014, 05:41 PM
|
#8
|
Senior Member
Registered: Nov 2005
Location: ...uncanny valley... infinity\1975; (randomly born:) Milwaukee, WI, US( + travel,) Earth&Mars (I wish,) END BORDER$!◣◢┌∩┐ Fe26-E,e...
Distribution: any GPL that work on freest-HW; has been KDE, CLI, Novena-SBC but open.. http://goo.gl/NqgqJx &c ;-)
Posts: 4,888
|
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$
|
|
|
06-09-2014, 09:13 PM
|
#9
|
Senior Member
Registered: Dec 2005
Location: Florida
Distribution: CentOS/Fedora/Pop!_OS
Posts: 2,983
|
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.
|
|
|
06-09-2014, 09:25 PM
|
#10
|
Member
Registered: Feb 2013
Location: San Jose, CA
Distribution: RHEL/CentOS/Fedora
Posts: 457
Rep:
|
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.
|
|
|
06-10-2014, 03:31 PM
|
#11
|
Member
Registered: Jun 2014
Distribution: Debian 9.6
Posts: 68
Original Poster
Rep:
|
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 ?
|
|
|
06-10-2014, 04:17 PM
|
#12
|
Member
Registered: Feb 2013
Location: San Jose, CA
Distribution: RHEL/CentOS/Fedora
Posts: 457
Rep:
|
Quote:
Originally Posted by blackRonin
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...
|
|
|
06-10-2014, 06:38 PM
|
#13
|
Member
Registered: Jun 2014
Distribution: Debian 9.6
Posts: 68
Original Poster
Rep:
|
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.
|
|
|
06-10-2014, 08:58 PM
|
#14
|
Moderator
Registered: Aug 2002
Posts: 26,127
|
The DHCP client sends the hostname to the server.
Try adding the directive DHCP_HOSTNAME=hostname to your /etc/sysconfig/network-scripts/ifcfg-eth0
|
|
|
06-11-2014, 08:43 PM
|
#15
|
Senior Member
Registered: Dec 2005
Location: Florida
Distribution: CentOS/Fedora/Pop!_OS
Posts: 2,983
|
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.
|
|
|
|
All times are GMT -5. The time now is 03:42 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|