LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 04-22-2016, 03:12 AM   #1
king1806
LQ Newbie
 
Registered: Mar 2016
Posts: 13

Rep: Reputation: Disabled
Hostname problem centos 7


hello guys,

When I first installed my CentOS 7 server everything is fine. I can access my shared files on CentOS using windows client via IP Address and HOSTNAME. But I needed to change my CentOS hostname. I did successfully change it, but the problem is: I cannot access my CentOS server via HOSTNAME but it is working via IP Address.

I really need to access my CentOS server via HOSTNAME.

I already did:

/etc/hosts
/etc/sysconfig/network
/etc/nsswitch.conf (files,wins,dns)

What do you think is the problem?

Thank you!
 
Old 04-22-2016, 03:20 AM   #2
tshikose
Member
 
Registered: Apr 2010
Location: Kinshasa, Democratic Republic of Congo
Distribution: RHEL, Fedora, CentOS
Posts: 525

Rep: Reputation: 95
Hi,

From where do you want to access your CentOS machine.
It is from that origin that you need to ensure the IP can be resolved from the hostname.
The problem should not be in the CentOS machine.
 
Old 04-22-2016, 03:31 AM   #3
king1806
LQ Newbie
 
Registered: Mar 2016
Posts: 13

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by tshikose View Post
Hi,

From where do you want to access your CentOS machine.
It is from that origin that you need to ensure the IP can be resolved from the hostname.
The problem should not be in the CentOS machine.
Thank you for your reply tshimanga..

hmm I want to access it in my windows client.
what do you mean "to ensure my IP can be resolved from the hostname?"
 
Old 04-22-2016, 04:24 AM   #4
tshikose
Member
 
Registered: Apr 2010
Location: Kinshasa, Democratic Republic of Congo
Distribution: RHEL, Fedora, CentOS
Posts: 525

Rep: Reputation: 95
Hi,

Name resolution maps fully qualified names (or just hostnames) to IP addresses, and reversely.
It is known as DNS for Domain Name System.

How is set up your network?
 
Old 04-22-2016, 08:30 AM   #5
dt64
Member
 
Registered: Sep 2012
Distribution: RHEL5/6, CentOS5/6
Posts: 218

Rep: Reputation: 38
how did you change your hostname? are you aware about the different hostnames in CentOS7?
have a read: https://access.redhat.com/documentat...stnamectl.html
 
Old 04-22-2016, 08:55 AM   #6
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
Open C:\Windows\System32\drivers\etc and edit with notepad.
and put the new hostname in there.
Same format as a Linux /etc/hosts file.
Code:
127.0.0.1       localhost
IP <space> newhostname_of_centos_server
Done.

FYI: these edits were unnecessary.
/etc/hosts
/etc/sysconfig/network
/etc/nsswitch.conf (files,wins,dns)

Last edited by Habitual; 04-22-2016 at 08:56 AM.
 
Old 04-22-2016, 08:45 PM   #7
king1806
LQ Newbie
 
Registered: Mar 2016
Posts: 13

Original Poster
Rep: Reputation: Disabled
[QUOTE=Habitual;5535009]Open C:\Windows\System32\drivers\etc and edit with notepad.
and put the new hostname in there.
Same format as a Linux /etc/hosts file.
Code:
127.0.0.1       localhost
IP <space> newhostname_of_centos_server
Hello Habitual,

It is working, I can access my CentOS server via HOSTNAME using your idea/code. But the problem is I cannot open the shared folder, it prompt PARAMETER INVALID whenever I'm trying to open the shared file. But when I'm accessing it via IP Address I can perfectly Write/Read the shared file.

And another concern. I have atleast 30 client computers do I need to manually edit the hosts file one by one?

Thank you very much!
 
Old 04-22-2016, 08:50 PM   #8
king1806
LQ Newbie
 
Registered: Mar 2016
Posts: 13

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by dt64 View Post
how did you change your hostname? are you aware about the different hostnames in CentOS7?
have a read: https://access.redhat.com/documentat...stnamectl.html
hello dt64,

I already did this:
/etc/hosts
/etc/sysconfig/network
/etc/nsswitch.conf
nmcli general hostname
thing.

But the problem still exist. Any Idea?

Thank you for your reply!
 
Old 04-22-2016, 09:02 PM   #9
king1806
LQ Newbie
 
Registered: Mar 2016
Posts: 13

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by tshikose View Post
Hi,

Name resolution maps fully qualified names (or just hostnames) to IP addresses, and reversely.
It is known as DNS for Domain Name System.

How is set up your network?
Hello tshikose!

I configured Samba as my Domain Controller (but I'm not yet implemeting it).

My CentOS server is currently a file server. I installed MySql.
Our company is accessing this file via SQL application. And every image that they access has a default file location which is the default location is starting in the server's HOSTNAME thats why I need the server's HOSTNAME working, else I will change the starting default file location into IP Address and that means I will edit thousands of images

Thank you very much!
 
Old 04-22-2016, 09:18 PM   #10
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
Quote:
Originally Posted by king1806 View Post
It is working, I can access my CentOS server via HOSTNAME using your idea/code.
Glad it worked out.

Last edited by Habitual; 04-23-2016 at 06:17 AM.
 
Old 04-25-2016, 03:24 AM   #11
JJJCR
Senior Member
 
Registered: Apr 2010
Posts: 2,149

Rep: Reputation: 449Reputation: 449Reputation: 449Reputation: 449Reputation: 449
Cool

Quote:
Originally Posted by king1806 View Post
Thank you for your reply tshimanga..

hmm I want to access it in my windows client.
what do you mean "to ensure my IP can be resolved from the hostname?"
Do you have a local DNS server?
If you have create "A" host record then type the IP Address of the machine and the server name.

If you don't have a local DNS server, then you need to configure the hosts file on your windows client one by one.

If you have "Active Directory", then I suppose you have a local DNS server. Then just configure an "A" record on "DNS Manager".
 
Old 06-15-2016, 02:13 PM   #12
tshikose
Member
 
Registered: Apr 2010
Location: Kinshasa, Democratic Republic of Congo
Distribution: RHEL, Fedora, CentOS
Posts: 525

Rep: Reputation: 95
Quote:
Originally Posted by king1806 View Post
Hello tshikose!

I configured Samba as my Domain Controller (but I'm not yet implemeting it).

My CentOS server is currently a file server. I installed MySql.
Our company is accessing this file via SQL application. And every image that they access has a default file location which is the default location is starting in the server's HOSTNAME thats why I need the server's HOSTNAME working, else I will change the starting default file location into IP Address and that means I will edit thousands of images

Thank you very much!
Hi king1806,

I kind of lost this thread and the question you asked to me.

If you are really planning to use your CentOS server as you Domain Controller, I am strongly advising you to also use it central for services such as DNS, DHCP and NTP.
Configured to work together bind and dhcpd can make your resolution problem totally disappear (even for dynamic hosts).
Finally, if possible use CentOS 7, it has better support integration with Microsoft AD.
 
  


Reply



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
Change hostname Centos blackRonin Linux - Networking 25 06-22-2014 10:14 AM
getting errors related to hostname -- security problem? ok to change hostname? sneakyimp Linux - Server 2 11-18-2012 05:25 PM
Centos 6 - machine does not know it's own hostname yanom Red Hat 1 07-18-2012 12:21 AM
hostname resolving problem in centos dinakumar12 Linux - Server 2 01-01-2012 12:26 AM
CentOS 4.4 Changing hostname Problem Rush_898 Linux - Software 7 04-14-2008 03:58 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 10:40 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
Open Source Consulting | Domain Registration