When we find that we cannot ping in kali, there will be a temporary failure in domain name resolution. In fact, this is because
The DNS domain name in kali settings does not resolve to IP
Solution: First open the terminal in kali and use the sudo su command to enter root privileges
sudo su
Then enter the vim /etc/resolv.conf command to enter editing
vim /etc/resolv.conf
At first there is only one explanation word and we have to add DNS ourselves.
Complete the following steps as shown in the picture
Add after nameserver xxx.xxx.xxx.xxx
nameserver 192.168.0.1 (enter your local gateway here)
nameserver 8.8.8.8
nameserver 114.114.114.114
nameserver 192.168.0.1
nameserver 8.8.8.8
nameserver 114.114.114.114
Finally, click ESC to exit, click:wq to save and finally restart.
The restart command is put last.
reboot