Change default DNS server in Arch Linux

Posted by AntoineG on Super User See other posts from Super User or by AntoineG
Published on 2012-06-27T10:33:44Z Indexed on 2013/10/29 10:02 UTC
Read the original article Hit count: 472

Filed under:
|
|
|

I'm in Viet Nam and most social websites (Facebook, Twitter and the likes - even reddit) are blocked by the ISP DNS server.

I tried to change the DNS server of my Arch box using the resolv.conf file, but it failed miserably since dhcpd generates this file automatically everytime I connect to the LAN. I've been looking around to try and find out how to fix this, without success. Either I s*ck at Googling, either it is non-trivial to do so.

EDIT 1:

Meh, apparently posting it here made me feel guilty and I had to push my search a bit more. I found the same article than Ankur post below. This is what I made, if anybody ever faces the same problem:

$ sudo gvim /etc/dhcpcd.conf 

Add "nohook resolv.conf" at the tail of the file.

$ sudo gvim /etc/resolv.conf

Add to the file (OpenDNS servers):

nameserver 208.67.222.222
nameserver 208.67.220.220

Or (Google DNS):

nameserver 8.8.8.8
nameserver 8.8.4.4

Then, verify it worked (need package dnsutils):

$ dig www.facebook.com

; <<>> DiG 9.9.1-P1 <<>> www.facebook.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 16994
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;www.facebook.com.      IN  A

;; ANSWER SECTION:
www.facebook.com.   89  IN  A   69.171.224.53

;; Query time: 87 msec
;; SERVER: 208.67.222.222#53(208.67.222.222)
;; WHEN: Thu Jun 28 00:43:23 2012
;; MSG SIZE  rcvd: 61

See ;; SERVER: 208.67.222.222#53(208.67.222.222), it worked.

© Super User or respective owner

Related posts about linux

Related posts about dns