Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm using Ubuntu 12.04 on PC. when the PC is configured to use DHCP, the pc is accessable through it's hostname. but when I set static ip, I can't reach the PC through the hostname. What is the problem, and how can it be fixed ?

share|improve this question

closed as off-topic by Tonny, voretaq7 Nov 11 '13 at 17:37

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions must demonstrate a minimal understanding of the problem being solved. Try including attempted solutions, why they didn't work, and the expected results. See How can I ask better questions on Server Fault? for further guidance." – voretaq7
If this question can be reworded to fit the rules in the help center, please edit the question.

    
This is better suited for SuperUser. For this site it's off-topic. –  Tonny Nov 11 '13 at 7:43
    
The problem is you're speaking in generalities and have performed no troubleshooting beyond "IT DOESN'T WORK! HELP!" -- Please take the time to actually troubleshoot and tell us what you've tried. We cannot diagnose a problem with no data... –  voretaq7 Nov 11 '13 at 17:39

2 Answers 2

The way you describe it your DHCP server updates your DNS server when a lease is handed out. In that case, if you're not using DHCP you need to manually configure the hostname in your DNS server.

share|improve this answer

It seems that DHCP server is also the DNS server (your router probably).
When it gives a DHCP ip-address to the PC it will also register the name/ip-address combination in its own DNS system.
That DNS is what helps the other computers in your LAN to find the machine by name.

When you give it a static address it will NOT be registered in the DNS.
The only way other computers will know which ip-address to use for the Linux machine is by:

  1. Put it in DNS manually (if your router supports that).
  2. Put manually a entry in the hosts file of each PC.
  3. Make sure the Linux machine broadcasts it's name on the network so other PC's will see it come by. This can be done in several ways: Enabling ipv6 on all your computers will do this. If the other machines are Windows and/or OSX systems running Samba on the Linux machine (even if you don't use Samba to share things) will also enable a broadcasting mechanism.

Why are you using a static ip-address by the way ? If you want the address to be a fixed value it is better to have the DHCP server assign a reserved address to this Linux machine. And in that case you still profit from the DHCP servers DNS handling.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.