I have 2 PCs running CentOS 7 and they're both connected to a wireless repeater/AP. I have statically set both the IP addresses of the 2 PCs, and they are able to ping each other via IP. I have also manually set the hostname of each pc, and each PC is also able to ping itself via hostname. However, they are not able to ping each other by hostname.

I have set the DNS server to be the same as the default gateway, which is the router IP address. Is this correct? If not, what should I do?



You will also need to propagate your hostnames + IP to your local DNS. By default it will not be able to resolve hostnames without, as it is most likely only some kind of a proxy for your provider's DNS. As I cannot say, waht you are running as router, I'd recommend to check manual how to do it.

Also you could put your hosts to the hosts-file (Windows should be something like c:\windows\system32\drivers\etc\hosts). Wikipedia is having a article about. However, this would need to update the hosts file on every system trying to connect via hostname.

Anoter way could be to use some pseudo static approach: Chenge the configuration of the router's DHCP it a way, hosts getting same IP on ever DHCP-Request. This can be done by pinning MAC-Adresse... but also need some lookup on manual.

  • Hi, does that mean I would have to modify the router DNS configuration to manually assign the hostnames of the 2 PCs via their IP addresses? – user1118764 Aug 28 '14 at 7:11
  • Yes. From my best knowledge. – frlan Aug 28 '14 at 7:15
  • @user1118764: Many home gateways have that as a built-in feature -- they take the name from DHCP requests, and update an internal ".home" or similar domain. – grawity Aug 28 '14 at 8:11
  • There is also a fourth option; to use one of the several local name resolution protocols, e.g. mDNS. They usually need no configuration beyond installing and starting the service. – grawity Aug 28 '14 at 8:13

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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