Sunday, August 26, 2018

Connection timed out; no servers could be reached - CentOS - Solved

For some reason, could not connect access internet in CentOS, although my network shows connected. 
$ nslookup google.com
;; connection timed out; no servers could be reached
 
$ ping www.google.com
ping: www.google.com: Name or service not known

$ ping 8.8.8.8

From XX.XX.X.X icmp_seq=1 Destination Net Unreachable
From XX.XX.X.X icmp_seq=2 Destination Net Unreachable
From XX.XX.X.X icmp_seq=3 Destination Net Unreachable
From XX.XX.X.X icmp_seq=4 Destination Net Unreachable
 
then, from an online post, I understand that /etc/sysconfig/network should have following:  
$ cat /etc/sysconfig/network
NETWORKING=yes
 
When I checked my /etc/sysconfig/network, it was empty. Soon, I updated it with   
NETWORKING=yes 
GATEWAY=XX.XX.X.X (filled with my IP address)
and restarted my system again, which works now without problem!! 
$ ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=117 time=27.6 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=117 time=39.6 ms
64 bytes from 8.8.8.8: icmp_seq=3 ttl=117 time=29.8 ms
64 bytes from 8.8.8.8: icmp_seq=4 ttl=117 time=62.9 ms
64 bytes from 8.8.8.8: icmp_seq=5 ttl=117 time=35.4 ms
64 bytes from 8.8.8.8: icmp_seq=6 ttl=117 time=18.7 ms
^C
--- 8.8.8.8 ping statistics ---
6 packets transmitted, 6 received, 0% packet loss, time 5009ms

No comments:

Post a Comment