[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Fedora hostname change not taking effect

Posted on 2009-04-20
22
Medium Priority
?
1,050 Views
Last Modified: 2013-12-15
Hello.

I have a small pc running fedora 9 and I'm having problems getting it to recognise a change in its hostname. It hosts a small website, just for use on the internal network, which I browse to using "http://webserver". To achieve this, I had changed the machines hostname to be "webserver" and setup a basic samba service. This was all working fine.

However, I needed to change the hostname of the computer (to "webserver1"), and I can't get it to work. When I query the hostname whilst logged onto the computer it returns "webserver1" as it should, but I can't ping this hostname from any other computer. Oddly, I can ping the old hostname fine, and even use it to browse to the website. I have made the changes in the following places:

/etc/hostname
/etc/sysconfig/network
/etc/sysconfig/network-scripts/ifcfg-eth2 <- this is the only NIC being used, it has a static IP
/proc/sys/kernel/hostname

Note I haven't added anything in /etc/hosts because these computers are not on a domain and so I can't get a FQDN.

At this point I thought it was just the dns server that needed flushing, but this didn't resolve the problem. I've even connected it to a network it has never seen before, but it is still only responding to the old hostname.

Is there anything else I need to change to get this hostname recognised?
0
Comment
Question by:aapjzz
  • 10
  • 7
  • 3
  • +1
22 Comments
 
LVL 29

Expert Comment

by:fosiul01
ID: 24185767
you need to add that host name in /etc/hosts file

webserver1   192.168.1.23  ( exmaple)

now have you chagne the zone record in your dns server from webserver to webserver1 ??
0
 
LVL 8

Expert Comment

by:brittonv
ID: 24185816
If you can't ping the hostname from 'other computers' you need to update the DNS servers that are referenced by the Machine you are pinging from.

If it is a windows machine from cmd run ipconfig /all and you will see the IP addresses of the DNS Servers, if it's linux run cat /etc/reslov.conf.

0
 

Author Comment

by:aapjzz
ID: 24186026
Thanks for your replies

fosiul01:
I've tried both those steps, unfortunately they didn't resolve the problem on either networks I have at my disposal.

brittonv:
I've looked in the resolv.conf, and it points at the right place. I've flushed that DNS server already, I can't seem to view what the current IP and hosts list is because the admin interface on the router is very limited.
Either way, I tried connecting the pc to a network that had never known the old hostname and it still only responds the "webserver". I don't want to rule anything out, but it seems to be something coming from the PC.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 29

Expert Comment

by:fosiul01
ID: 24186119
its seems like dns issue but you said you have flush everything ..

system-config-status

whats its saying in host name and aliases tab ??
0
 
LVL 29

Expert Comment

by:fosiul01
ID: 24186404
do u have bind name server? What ever pc name ,u can ping it by host name , have u deiend like this in zone file, webserver1 IN Ip of pc?
Have restart bind?
0
 
LVL 8

Expert Comment

by:brittonv
ID: 24186448
WHen you say you have flused 'that dns server' did you also manually create an entry for your new server, or are they being registered via dynamic dns?

0
 

Author Comment

by:aapjzz
ID: 24192920
fosiul01:
system-config-status is a GUI program as far as I'm aware - I probably should have said that I'm running it from command line, using the GUI isn't an option for various reasons unfortunately so I can't check the hostname and alias tab. But if I type "hostname" at the prompt, it echos back with the correct "webserver1" response.

I dont have the bind service running, I don't think its even installed and there are no config files for it anywhere I can find.

brittonv:
I'll explain, I have two networks where I am, each is connected to separate broadband lines and neither share any of the same hardware. The pc was connected to one network. I flushed the dns information on the dns server for that network. It doesn't have any rules explicitly setup, I believe it registers by dynamic dns.

I then connected it to the other network, which had never seen the pc before and has its own dns - which is the bit that is really confusing me. I haven't been able to log on to look at that dns because I don't have the admin rights - I'm waiting for a phone call from the guy who does.
0
 
LVL 29

Expert Comment

by:fosiul01
ID: 24192964
hi ya
You said, you can access http://webserver from any pc  right ??

thats mean , in zone file you have defined

webserver IN 192.168.1.2

thats why, if you type http://webserver , its takes you to that pc

now if you want to make it http://webserver1  to map to the same pc,
then you need the zone file ..

your comments : I can't ping this hostname from any other computer. Oddly, I can ping the old hostname fine, and even use it to browse to the website. I have made the changes in the following places:

you would be able to ping host name if you have zone file
or from Client pc if you insert by your hand the pc name
such  as in client pc
/etc/host file

192.168.1.2     webserver1

now if you ping from client pc , ping webserver1
it will ping 192.168.1.2

does it make sense ??
0
 

Author Comment

by:aapjzz
ID: 24193339
I see what you mean, but I should probably describe the rest of my computer network. My server is Fedora as I've said, but the rest of the computers I use are windows vista. From these I can ping "webserver" fine, but not the new "webserver1" host name.

I'd already checked the hosts file in C:\Windows\system32\driver\etc\host and got rid of any references to "webserver" and flushed the dns settings on each workstation.

The easy solution as you suggest is to just add my own entry for the IP address to match with "webserver1", but this fedora server is a template PC that is going to be copied for about 100 sites - so it is impractical to edit the hosts file on every workstation at each site.
0
 
LVL 29

Expert Comment

by:fosiul01
ID: 24193378
oK

when you do ipconfig /all in your vistab pc

1.do you have Dns server addres ???  yes or not


about your comments " The easy solution as you suggest is to just add my own entry for the IP address to match with "webserver1", but this fedora server is a template PC that is going to be copied for about 100 sites - so it is impractical to edit the hosts file on every workstation at each site."

only solution is to use Dns server .... [ i gues you have dns server and you dont have control over it thats the problem ]

let me know then answer of question1
0
 

Author Comment

by:aapjzz
ID: 24202425
I do have a dns server address, and I have control over that computer, but I've become convinced it is a problem originating from the fedora PC. I took it home last night and connected it to my router - a completely different environment it had never been anywhere near - and it still only responds to the old hostname. The fedora PC must be picking up the old hostname from some file or other, but I can't find where.
0
 
LVL 29

Expert Comment

by:fosiul01
ID: 24202627
hmm, problem ..

in the fedora server itself
if you try to ping

ping webserver1

does it ping ??
or does it say timeout ???
0
 
LVL 16

Expert Comment

by:ai_ja_nai
ID: 24202680
how about restarting the machine? So that the new name surely takes effect

BTW, what is the output of

sysctl kernel.hostname

?
0
 
LVL 29

Assisted Solution

by:fosiul01
fosiul01 earned 800 total points
ID: 24202699
@aj_ja_ni

good to see you!!!
he does restart so many time, he even took the pc at home..

as he said, there must be some file ....

like i saw  a question few month ago where the author was having probme of IP, he used to set static ip, but when he restart the server, the ip change bk to something else, so problme was one of the dhcp-bus  ( something like that) was the culprit..

i gues here, some t hing is running on the pc which reverting the hostname ....
0
 

Author Comment

by:aapjzz
ID: 24203040
"sysctl kernel.hostname" returns the correct "webserver1"
0
 
LVL 16

Accepted Solution

by:
ai_ja_nai earned 1200 total points
ID: 24203396
It must be something really silly, because apparently all the steps necessary have been taken. can you show us the output of

ls -l /var/www

grep webserver -r /etc/

Anyway, have you tried adding manually the right dns voice on the dns server?
0
 

Author Closing Comment

by:aapjzz
ID: 31572290
Thats fixed it!

Although ai_ja_nai gave me the command to see where the problem was, fosiul01 prompted me to look at several other things which would have definately caused me problems with recognising the hostname further down the line.

Thanks guys!
0
 
LVL 29

Expert Comment

by:fosiul01
ID: 24203558
so what what the problem??
can you just explain little bit ??

i understand from your comments is /etc/hostname

but i thought you have check those before ?? so where exactualy was teh probelm ??
0
 

Author Comment

by:aapjzz
ID: 24203561
It turns out that it was in the samba.conf file. I had set the netbios to "webserver" way back when and forgot about it, it seemed to override everything else.

It was something silly in the end, but if nothing else, I know more about fedora network management!
0
 
LVL 29

Expert Comment

by:fosiul01
ID: 24203578
God I never seen this before that smb.conf file is giving trouble with pc host name!!!

hahahaahahahahahaha

Good  job aj_nai_ja!!!
0
 
LVL 16

Expert Comment

by:ai_ja_nai
ID: 24203663
lol thanks :)
holy grep, how could we do without it?
0
 
LVL 29

Expert Comment

by:fosiul01
ID: 24203685
I sent you one more email @aj_ja_nai

thats another wired problemm.. and i am running out of idea

have a look
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you’re involved with your company’s wide area network (WAN), you’ve probably heard about SD-WANs. They’re the “boy wonder” of networking, ostensibly allowing companies to replace expensive MPLS lines with low-cost Internet access. But, are they …
This article will show how Aten was able to supply easy management and control for Artear's video walls and wide range display configurations of their newsroom.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
Suggested Courses

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question