域名dig通,但是ping不通


问题描述

(base) itaken:~$ ping mysql-xxx.local
ping: mysql-xxx.local: 未知的名称或服务

dig

解决方案

查看/etc/nsswitch.conf文件 hosts的内容:

(base) itaken:~$ cat /etc/nsswitch.conf
# /etc/nsswitch.conf
#
# Example configuration of GNU Name Service Switch functionality.
# If you have the `glibc-doc-reference' and `info' packages installed, try:
# `info libc "Name Service Switch"' for information about this file.

passwd:         compat
group:          compat
shadow:         compat
gshadow:        files

hosts:          files mdns4_minimal [NOTFOUND=return] dns myhostname
networks:       files

protocols:      db files
services:       db files
ethers:         db files
rpc:            db files

netgroup:       nis

hosts修改为hosts: files dns myhostname可行.^1

更多详细的分析,可以前往https://maciek.lasyk.info/sysop/2013/05/11/dns-resolution-problem-dig-working-ping-not/


Author: Itaken
Reprint policy: All articles in this blog are used except for special statements CC BY 4.0 reprint polocy. If reproduced, please indicate source Itaken !
  TOC目录