16 November 2008

OpenDNS - Treoir Gearr do Usáideorí Gentoo

Nóta: Glacaim go bhaineann tú úsáid as dhcpcd. (Mura rinne tú rud speisialta nuair a shuiteáil tú Gentoo, is dócha go fíor sin. Le fanacht amach ón bhaoil, seiceáil é mar seo: ps -ef | grep dhcpcd. D'fheicfeá /sbin/dhcpcd sa liosta.)

ROGHNACH: Mura rinne tú é cheana féin, is fiú duit emerge-áil bind-tools dá bhrí dig agat. Níl sé de dhíth ort le húsáid OpenDNS, ach beidh sé níos éasca bheith cinnte go bhfuil DNS ag dul chuig na freastalaí ceart.

1. Socraigh é. Cuir /etc/conf.d/net in eagair agus ionsaigh/eagair an abairt seo:

dhcpcd_eth0="-R"

Beidh an mír i gceist mar seo:

config_eth0=( "dhcp" )
dhcp_eth0="nodns nontp nonis"
dhcpcd_eth0="-R"

Cuir /etc/resolv.conf in eagair agus ionsaigh/eagair na habairtí seo:

nameserver 208.67.222.222
nameserver 208.67.220.220

2. Tósaigh é. Mar root, cuir isteach an abairt seo:

/etc/init.d/net.eth0 restart

3. Scrúdaigh é. Seo an cúis a mhól mé suiteáil bind-tools. Thug an ordú dig níos mó eolais ná nslookup.

dig www.opendns.com

Beidh a toradh mar seo:

; <<>> DiG 9.4.2-P2 <<>> www.opendns.com
;; global options: printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 7419
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

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

;; ANSWER SECTION:
www.opendns.com. 30 IN A 208.67.219.101

;; Query time: 927 msec
;; SERVER: 208.67.220.220#53(208.67.220.220)
<-- freastalaí OpenDNS
;; WHEN: Sat Nov 15 18:46:44 2008
;; MSG SIZE rcvd: 49

4. (OPTIONAL) ROGHNACH. Is féidir leat teasc áitiúil a shocrú sa dóigh nár ar do ríomhaire dul ar ais chuig OpenDNS le athcheistiú. Bain mé úsáid as dnsmasq.

emerge dnsmasq

Cuir na sainroghanna seo i /etc/dnsmasq.conf (le caoinchead ó HostingFu)

domain-needed # Never forward plain names
bogus-priv # Never forward addresses in the non-routed address spaces
no-resolv # Don't use /etc/resolv.conf
no-poll # Don't poll /etc/resolv.conf
server=208.67.222.222 # Forward to OpenDNS's servers
server=208.67.220.220
listen-address=127.0.0.1 # Listen and bind to only localhost
bind-interfaces

Mar root, cuir isteach na habairtí seo:

/etc/init.d/dnsmasq start
rc-update add dnsmasq default


Ná déan dearmad inis do dhcpcd an teasc áitiúil a úsáid:

echo nameserver 127.0.0.1 > /etc/resolv.conf

5. (OPTIONAL) Scrúdaigh arís é. Eisigh an ceist céanna dig (dig www.opendns.com) faoi dhó, agus breathnaigh ar an líne ;; Query time: . An darna uair ba cheart do beagnach ar an toirt mar tá an eolas sa taisc cheana féin.


OpenDNS - Quick Start for Gentoo Users

Note: I assume you're using dhcpcd. (If you didn't do anything fancy when you installed Gentoo, then you're probably using dhcpcd. To be on the safe side, check using ps -ef | grep dhcpcd. You should see /sbin/dhcpcd in the list.)

OPTIONAL: If you haven't already done so, you really should emerge bind-tools so that you will have dig. This isn't necessary for using OpenDNS, but it will make it easier to be certain that DNS is going to the correct servers.

1. Configure it. Edit /etc/conf.d/net and insert/edit the following line:

dhcpcd_eth0="-R"

The relevant section of will look something like this:

config_eth0=( "dhcp" )
dhcp_eth0="nodns nontp nonis"
dhcpcd_eth0="-R"

Edit /etc/resolv.conf and insert/edit the following lines:

nameserver 208.67.222.222
nameserver 208.67.220.220

2. Start it. As root, enter the following command:

/etc/init.d/net.eth0 restart

3. Test it. This is why I recommended emerging bind-tools. The dig command will give you a little more information than nslookup.

dig www.opendns.com

The result should look like this:

; <<>> DiG 9.4.2-P2 <<>> www.opendns.com
;; global options: printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 7419
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

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

;; ANSWER SECTION:
www.opendns.com. 30 IN A 208.67.219.101

;; Query time: 927 msec
;; SERVER: 208.67.220.220#53(208.67.220.220)
<-- OpenDNS server
;; WHEN: Sat Nov 15 18:46:44 2008
;; MSG SIZE rcvd: 49

4. (OPTIONAL) Make it faster. You can set up a local cache so your computer doesn't have to go back to OpenDNS for subsequent queries. I used dnsmasq.

emerge dnsmasq

Use the following configuration in /etc/dnsmasq.conf (courtesy of HostingFu)

domain-needed # Never forward plain names
bogus-priv # Never forward addresses in the non-routed address spaces
no-resolv # Don't use /etc/resolv.conf
no-poll # Don't poll /etc/resolv.conf
server=208.67.222.222 # Forward to OpenDNS's servers
server=208.67.220.220
listen-address=127.0.0.1 # Listen and bind to only localhost
bind-interfaces

As root, enter the following commands:

/etc/init.d/dnsmasq start
rc-update add dnsmasq default

Don't forget to tell dhcpcd to use the local cache:

echo nameserver 127.0.0.1 > /etc/resolv.conf

5. (OPTIONAL) Make sure it got faster. Run the same dig query (dig www.opendns.com) twice in a row, and look for the ;; Query time: line. The second time it should be nearly instantaneous because the information is already in the cache.