-2

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 ?

2
  • This is better suited for SuperUser. For this site it's off-topic.
    – Tonny
    Nov 11, 2013 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, 2013 at 17:39

2 Answers 2

2

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.

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.

Not the answer you're looking for? Browse other questions tagged .