ping can resolve hostname, while dig is unable to resolve the same hostname?
0
votes
1
answer
2936
views
>ping can resolve hostname, while dig is unable to resolve the same hostname?
I'm experiencing a strange issue, where
ping
is able to resolve some DNS hostname, while dig
cannot.
I've tried to dig +search
to use the search entries in /etc/resolv.conf
, or dig @
to set the nameserver explicitly, but that didn't help.
How can I understand why ping
resolves the hostnames, while dig
is unable?
kube@ctf-k8s-deploy-647d66b697-lxqkl:~$ cat /etc/resolv.conf
nameserver 100.64.0.10
search default.svc.cluster.local svc.cluster.local cluster.local eu-central-1.compute.internal
options ndots:5
kube@ctf-k8s-deploy-647d66b697-lxqkl:~$ dig +search ctf-k8s-deploy-647d66b697-lxqkl
; > DiG 9.11.5-P4-5.1-Debian > +search ctf-k8s-deploy-647d66b697-lxqkl
;; global options: +cmd
;; Got answer:
;; ->>HEADER> DiG 9.11.5-P4-5.1-Debian > @100.64.0.10 +search ctf-k8s-deploy-647d66b697-lxqkl
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 47568
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;ctf-k8s-deploy-647d66b697-lxqkl. IN A
;; Query time: 0 msec
;; SERVER: 100.64.0.10#53(100.64.0.10)
;; WHEN: Mon Mar 23 14:46:53 UTC 2020
;; MSG SIZE rcvd: 60
kube@ctf-k8s-deploy-647d66b697-lxqkl:~$ ping ctf-k8s-deploy-647d66b697-lxqkl
PING ctf-k8s-deploy-647d66b697-lxqkl (100.96.1.8) 56(84) bytes of data.
64 bytes from ctf-k8s-deploy-647d66b697-lxqkl (100.96.1.8): icmp_seq=1 ttl=64 time=0.019 ms
64 bytes from ctf-k8s-deploy-647d66b697-lxqkl (100.96.1.8): icmp_seq=2 ttl=64 time=0.019 ms
64 bytes from ctf-k8s-deploy-647d66b697-lxqkl (100.96.1.8): icmp_seq=3 ttl=64 time=0.021 ms
^C
--- ctf-k8s-deploy-647d66b697-lxqkl ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 40ms
rtt min/avg/max/mdev = 0.019/0.019/0.021/0.005 ms
**Update**:
/etc/hosts
:
kube@ctf1-deploy1-89b48b46-zkqld:~$ cat /etc/hosts
# Kubernetes-managed hosts file.
127.0.0.1 localhost
::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
fe00::0 ip6-mcastprefix
fe00::1 ip6-allnodes
fe00::2 ip6-allrouters
100.96.3.22 ctf1-deploy1-89b48b46-zkqld
/etc/resolv.conf
:
kube@ctf1-deploy1-89b48b46-zkqld:~$ cat /etc/resolv.conf
nameserver 100.64.0.10
search ctf1-ns.svc.cluster.local svc.cluster.local cluster.local eu-central-1.compute.internal
options ndots:5
Asked by Shuzheng
(4931 rep)
Mar 23, 2020, 02:53 PM
Last activity: Jul 8, 2023, 09:01 AM
Last activity: Jul 8, 2023, 09:01 AM