问题描述
(base) itaken:~$ ping mysql-xxx.local
ping: mysql-xxx.local: 未知的名称或服务
解决方案
查看/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/