大网数据广告活动
服务器运维问答

Ubuntu 20.04 cannot ping local zone

· 52CE 我爱测

I have a server where ping command cannot resolve a local DNS record. I'm stumped. Here is my lab setup. DNS Zone - mydomain.local x.x.x.117 - CentOS 8 Primary DNSserver x.x.x.118 - Ubuntu 20.04 Desktop x.x.x.119 - Ubuntu 20.04 S…

问题原文

原帖链接 · manit · CC BY-SA 4.0

I have a server where ping command cannot resolve a local DNS record. I'm stumped.

Here is my lab setup.

DNS Zone  - mydomain.local

x.x.x.117 - CentOS 8 Primary DNSserver
x.x.x.118 - Ubuntu 20.04 Desktop
x.x.x.119 - Ubuntu 20.04 Server

I created a new zone for mydomain.local

mydomain.local A 192.168.5.118
*.mydomain.local A 192.168.5.118

ISSUE:

When I SSH into .118, I cannot ping mydomain.local. PING command comes up dead and cannot resolve an IP address.

How can I trouble shoot why .118 ping command cannot resolve an IP address for my domain.local? ping: mydomain.local: Name or service not known

I TRIED:

  • When I log into .119, .117, or through a VPN, I can ping mydomain.local with no issues.
  • On .118, I used dig, nslookup all report good responses.
  • On .118, Ping resolves wild card aliases such as www.mydomain.local, anyalias.mydomain.local.
  • on .118, Ping x.x.x.118 and 127.0.0.1 are good.
  • rebooting the server does not work.
  • clearing DNS cache does not work.

This is very strange behavior. Thanks for the help.

已采纳解答

原帖链接 · Guss · CC BY-SA 4.0

The problem you are describing is not with the ping command itself (nor with traceroute) - it is a name resolution problem: when ping issues gethostbyname() to the name resolution service, it does not get a good answer and aborts.

using dig (or you could have also tried the host command) may not be able to detect the problem as these access the DNS name service directly while the problem is likely not in the DNS service but in the configuration of the kernel name services (libnss).

you might want to check your /etc/nsswitch.conf file and compare the hosts: line to the other server where things are working. Check how libnss resolves names by using getent ahosts mydomain.local and you'd probably find the answer.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2020-12-21)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。