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 ?

- 187
- 1
- 8
-
This is better suited for SuperUser. For this site it's off-topic. – Tonny Nov 11 '13 at 07: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
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.

- 1,837
- 11
- 14
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:
- Put it in DNS manually (if your router supports that).
- Put manually a entry in the hosts file of each PC.
- 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.

- 6,332
- 1
- 18
- 31