Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

After I freshly installed a Centos, I can not get yum, wget or curl to work. All I get is :

$ curl http://www.google.com
curl: (6) Couldn't resolve host 'www.google.com

The most surprising part is that ping actually seems to work.

ping www.google.com

First reaction, checking iptables : I've got no rule at all. As I said, fresh install.

resolve.conf

nameserver 127.0.0.1

nameserver 8.8.8.8
nameserver 8.8.4.4

PS : Tried both with http:// and without.

share|improve this question
    
what is in /etc/resolv.conf? –  Mike Pennington Aug 1 '12 at 9:11
    
@MikePennington tried to change the DNS to google's dns. Didn't change –  Zenklys Aug 1 '12 at 9:13

1 Answer 1

up vote 2 down vote accepted

Remove the entry for nameserver 127.0.0.1 and it should at least start working.

Next fix your local resolver


$ dig @8.8.8.8 www.google.com

; <<>> DiG 9.7.3 <<>> @8.8.8.8 www.google.com
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 47139
;; flags: qr rd ra; QUERY: 1, ANSWER: 6, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;www.google.com.            IN  A

;; ANSWER SECTION:
www.google.com.     43199   IN  CNAME   www.l.google.com.
www.l.google.com.   299 IN  A   74.125.227.146
www.l.google.com.   299 IN  A   74.125.227.145
www.l.google.com.   299 IN  A   74.125.227.144
www.l.google.com.   299 IN  A   74.125.227.148
www.l.google.com.   299 IN  A   74.125.227.147

;; Query time: 73 msec
;; SERVER: 8.8.8.8#53(8.8.8.8)
;; WHEN: Wed Aug  1 04:14:14 2012
;; MSG SIZE  rcvd: 132

$ 

$ dig @8.8.4.4 www.google.com

; <<>> DiG 9.7.3 <<>> @8.8.4.4 www.google.com
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 46533
;; flags: qr rd ra; QUERY: 1, ANSWER: 6, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;www.google.com.            IN  A

;; ANSWER SECTION:
www.google.com.     43152   IN  CNAME   www.l.google.com.
www.l.google.com.   252 IN  A   74.125.227.146
www.l.google.com.   252 IN  A   74.125.227.145
www.l.google.com.   252 IN  A   74.125.227.144
www.l.google.com.   252 IN  A   74.125.227.148
www.l.google.com.   252 IN  A   74.125.227.147

;; Query time: 32 msec
;; SERVER: 8.8.4.4#53(8.8.4.4)
;; WHEN: Wed Aug  1 04:15:02 2012
;; MSG SIZE  rcvd: 132

$
share|improve this answer
    
Damn, I'm impressed. That works. Great job, thanks. –  Zenklys Aug 1 '12 at 9:14
    
Glad to assist... when dig @localhost www.google.com works you can add it back in /etc/resolv.conf –  Mike Pennington Aug 1 '12 at 9:16

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.