Sometimes ping command errors occur on Linux servers. Let’s summarize them today
If a Linux server cannot ping the domain name, the following prompts:
[root@localhost ~]# ping www.pythontab.com
ping: unknown host www.pythontab.com
First make sure the router is connected and the router can access the external network. You can confirm by accessing the gateway
[root@localhost ~]# ping 192.168.1.1
PING 192.168. 1.1 (192.168.1.1) 56(84) bytes of data.
64 bytes from 192.168.1.1: icmp_seq=1 ttl=64 time=2.96 ms
64 bytes from 192.168.1.1: icmp_seq=2 ttl=64 time= 1.75 ms
If you are sure that there is no problem with the network, you can find a solution through the following steps:
1) Make sure the domain name server is set up. If not, it is recommended to set up Google’s public DNS service. It should not go out. The problem is
[root@localhost ~]# cat /etc/resolv.conf
search localdomain
Because my DNS is not set up, pinging from the external network is blocked. Add dns to the file
[root@localhost ~]# vi /etc/resolv.conf
search localdomain
nameserver 202.98.96.68
nameserver 61.139.2.69
~
2) Make sure the gateway is set
# grep GATEWAY /etc/sysconfig/network-scripts/ifcfg*
--------------------- ---------------------------------------------
/etc/ sysconfig/network-scripts/ifcfg-eth0:GATEWAY=192.168.40.1
--------------------------------- ----------------------------------
If it is not set, add the gateway as follows:
# route add default gw 192.168.40.1
Or manually write the /etc/sysconfig/network-scripts/ifcfg* file, restart the network service:
# service network restart
3) Make sure dns resolution is available
# grep hosts /etc/nsswitch.conf
---------------------------------- ------------------------------------
hosts: files dns
------ -------------------------------------------------- -----------
If there is a problem with any of the above, correct it and test again, it should be fine:

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

SublimeText3 English version
Recommended: Win version, supports code prompts!

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

Dreamweaver Mac version
Visual web development tools

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.
