当我使用此命令在我的 KVM 虚拟机(CentOS 8)中挖掘 dns 时:
[root@k8sslave1 ~]# dig www.stackoverflow.com
; <<>> DiG 9.11.13-RedHat-9.11.13-3.el8 <<>> www.stackoverflow.com
;; global options: +cmd
;; connection timed out; no servers could be reached
这是我的 resolv.conf vim /etc/resolv.conf
:
# Generated by NetworkManager
nameserver 114.114.115.115
当我 ping 互联网 IP 时,它工作正常。例如:
[root@k8sslave1 ~]# ping 114.114.115.115
PING 114.114.115.115 (114.114.115.115) 56(84) bytes of data.
64 bytes from 114.114.115.115: icmp_seq=1 ttl=89 time=21.2 ms
64 bytes from 114.114.115.115: icmp_seq=2 ttl=91 time=20.5 ms
64 bytes from 114.114.115.115: icmp_seq=3 ttl=83 time=20.8 ms
如果没有 DNS 解析,我就无法在虚拟机中工作,无法访问任何资源,也无法安装软件。那么问题出在哪里?我该怎么做才能解决这个问题?这是我的 KVM 虚拟机防火墙状态:
[root@k8sslave1 ~]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
Active: inactive (dead)
Docs: man:firewalld(1)