• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1079
  • Last Modified:

Fedora hostname change not taking effect

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
aapjzz
Asked:
aapjzz
  • 10
  • 7
  • 3
  • +1
2 Solutions
 
fosiul01Commented:
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
 
brittonvCommented:
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
 
aapjzzAuthor Commented:
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
Improve Your Query Performance Tuning

In this FREE six-day email course, you'll learn from Janis Griffin, Database Performance Evangelist. She'll teach 12 steps that you can use to optimize your queries as much as possible and see measurable results in your work. Get started today!

 
fosiul01Commented:
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
 
fosiul01Commented:
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
 
brittonvCommented:
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
 
aapjzzAuthor Commented:
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
 
fosiul01Commented:
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
 
aapjzzAuthor Commented:
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
 
fosiul01Commented:
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
 
aapjzzAuthor Commented:
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
 
fosiul01Commented:
hmm, problem ..

in the fedora server itself
if you try to ping

ping webserver1

does it ping ??
or does it say timeout ???
0
 
ai_ja_naiCommented:
how about restarting the machine? So that the new name surely takes effect

BTW, what is the output of

sysctl kernel.hostname

?
0
 
fosiul01Commented:
@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
 
aapjzzAuthor Commented:
"sysctl kernel.hostname" returns the correct "webserver1"
0
 
ai_ja_naiCommented:
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
 
aapjzzAuthor Commented:
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
 
fosiul01Commented:
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
 
aapjzzAuthor Commented:
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
 
fosiul01Commented:
God I never seen this before that smb.conf file is giving trouble with pc host name!!!

hahahaahahahahahaha

Good  job aj_nai_ja!!!
0
 
ai_ja_naiCommented:
lol thanks :)
holy grep, how could we do without it?
0
 
fosiul01Commented:
I sent you one more email @aj_ja_nai

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

have a look
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

  • 10
  • 7
  • 3
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now