Difference between revisions of "Package:Dnsmasq"

(Created page with "{{Ebuild |Summary=Small forwarding DNS server |CatPkg=net-dns/dnsmasq |Homepage=http://www.thekelleys.org.uk/dnsmasq/ }} {{PageNeedsUpdates}} {{EbuildFooter}}")
 
m
 
(10 intermediate revisions by the same user not shown)
Line 4: Line 4:
 
|Homepage=http://www.thekelleys.org.uk/dnsmasq/
 
|Homepage=http://www.thekelleys.org.uk/dnsmasq/
 
}}
 
}}
 +
{{warning|As this page deals with DNS it has the potential to break your internet access!  Ensure you have stable live media that can restore your system.}}
 +
Dnsmasq is a dns cache, dhcp, and pxe server.  This package is lightweight, and will work well for individual computers, or small lans.
 +
 +
=== Installation ===
 +
{{console|body=###i## emerge net-dns/dnsmasq}}
 +
 +
=== Configuration ===
 +
{{note|When using NetworkManager with dhcp use dhcp for addresses only, and tell it 127.0.0.1 is your dns}}
 +
{{c|/etc/dnsmasq.conf}} is where most of dnsmasq's configuration is done.  It's file is well commented, and ready for several scenarios.
 +
 +
==== DNS only ====
 +
 +
{{important|place other upstream dns servers in /etc/resolv.dnsmasq.conf with your preferred DNS server at the top of the list.  The first console command in the block will wipe out existing /etc/resolv.dnsmasq.conf settings, back them up if you have anything important in them.}}
 +
{{console|body=###i## echo "nameserver 8.8.8.8" > /etc/resolv.dnsmasq.conf}}
 +
 +
{{file|name=/etc/dnsmasq.conf|lang=|desc=insert local dns only configs at the bottom of the dnsmasq.conf file.|body=
 +
...
 +
resolv-file=/etc/resolv.dnsmasq.conf
 +
listen-address=127.0.0.1
 +
}}
 +
 +
To listen to a DNS server on an alternate port:
 +
In this example we'll install {{package|net-dns/dnscrypt-proxy}}:
 +
{{file|name=/etc/dnsmasq.conf|lang=|desc=insert local dns only configs at the bottom of the dnsmasq.conf file.|body=
 +
...
 +
#resolv-file=/etc/resolv.dnsmasq.conf
 +
server=127.0.0.1#2053
 +
listen-address=127.0.0.1
 +
}}
 +
 +
Now your localhost / 127.0.0.1 is your primary DNS to point net connection scripts to.  This is the point of no return command.  Start the service before you run this, and be prepaired to test with dig that it's pulling up servers through dnsmasq.
 +
{{console|body=###i## echo "nameserver 127.0.0.1" > /etc/resolv.conf}}
 +
 +
This is the revert to known working DNS servers command:
 +
{{console|body=###i## echo "nameserver 8.8.8.8" > /etc/resolv.conf}}
 +
 +
=== Runtime ===
 +
{{console|body=###i## rc-update add dnsmasq default
 +
###i## rc}}
 +
 +
=== Testing ===
 +
==== DNS only ====
 +
{{package|net-dns/bind-tools}} contains dns testing utilities.  To verify that dns requests are returned from the local server:  emerge bind-tools, then run:
 +
{{console|body=###i## dig google.com}}
 +
 +
Make sure it returns something similar, the ip address for googles upstream server(s) will probably be different.
 +
{{console|body=
 +
...
 +
;; ANSWER SECTION:
 +
google.com. 299 IN A 216.58.216.206
 +
...
 +
;; SERVER: 127.0.0.1#53(127.0.0.1)}}
 +
 +
=== Hosts ===
 +
winhelp2002.mvps.org has a hosts file that blocks advertisements and malicious domains.  The hosts file is updated periodically so you may wish to make a cronjob to fetch the hosts file.
 +
 +
To install mvps' host file:
 +
{{console|body=
 +
###i## mkdir /etc/dnsmasq.d
 +
###i## echo "conf-dir=/etc/dnsmasq.d" >> /etc/dnsmasq.conf
 +
###i## curl http://winhelp2002.mvps.org/hosts.txt | sed -e 's/#.*$//' -e '/localhost/d' -e 's/\o015/\n/g' | awk '{print $2}' | sed '/^$/d' | sed 's@^@address=/@' | sed 's@$@/127.0.0.1@' > /etc/dnsmasq.d/hosts.txt}}
 +
 
{{PageNeedsUpdates}}
 
{{PageNeedsUpdates}}
 
{{EbuildFooter}}
 
{{EbuildFooter}}

Latest revision as of 09:51, July 12, 2015

net-dns/dnsmasq


Source Repository:Repository:Gentoo Portage Tree

http://www.thekelleys.org.uk/dnsmasq/

Summary: Small forwarding DNS server

Use Flags

auth-dns
Add support for acting as an authorative DNS server.
conntrack
Add support for Linux conntrack connection marking.
dhcp-tools
Install extra command line tools for manually managing DHCP leases.
dhcp
Enable support for acting as a DHCP server.
dnssec
Enable support DNSSEC validation and caching.
script
Enable support for calling scripts when leases change.
tftp
Enables built in TFTP server for netbooting.

News

Oleg

PHP and Kernel Updates

PHP and Kernel Updates
2016-04-01 by Oleg
Oleg

OpenSSL Update

OpenSSL Update
2016-03-04 by Oleg
Oleg

Python Updates

Python Updates
2016-02-12 by Oleg
More...

Dnsmasq

Tip

We welcome improvements to this page. To edit this page, Create a Funtoo account. Then log in and then click here to edit this page. See our editing guidelines to becoming a wiki-editing pro.

Warning

As this page deals with DNS it has the potential to break your internet access! Ensure you have stable live media that can restore your system.

Dnsmasq is a dns cache, dhcp, and pxe server. This package is lightweight, and will work well for individual computers, or small lans.

Installation

# emerge net-dns/dnsmasq

Configuration

Note

When using NetworkManager with dhcp use dhcp for addresses only, and tell it 127.0.0.1 is your dns

/etc/dnsmasq.conf is where most of dnsmasq's configuration is done. It's file is well commented, and ready for several scenarios.

DNS only

Important

place other upstream dns servers in /etc/resolv.dnsmasq.conf with your preferred DNS server at the top of the list. The first console command in the block will wipe out existing /etc/resolv.dnsmasq.conf settings, back them up if you have anything important in them.

# echo "nameserver 8.8.8.8" > /etc/resolv.dnsmasq.conf

/etc/dnsmasq.conf - insert local dns only configs at the bottom of the dnsmasq.conf file.
...
resolv-file=/etc/resolv.dnsmasq.conf
listen-address=127.0.0.1

To listen to a DNS server on an alternate port: In this example we'll install Package:Dnscrypt:

/etc/dnsmasq.conf - insert local dns only configs at the bottom of the dnsmasq.conf file.
...
#resolv-file=/etc/resolv.dnsmasq.conf
server=127.0.0.1#2053
listen-address=127.0.0.1

Now your localhost / 127.0.0.1 is your primary DNS to point net connection scripts to. This is the point of no return command. Start the service before you run this, and be prepaired to test with dig that it's pulling up servers through dnsmasq.

# echo "nameserver 127.0.0.1" > /etc/resolv.conf
This is the revert to known working DNS servers command:

# echo "nameserver 8.8.8.8" > /etc/resolv.conf

Runtime

# rc-update add dnsmasq default
# rc

Testing

DNS only

Package:Bind-tools contains dns testing utilities. To verify that dns requests are returned from the local server: emerge bind-tools, then run:

# dig google.com
Make sure it returns something similar, the ip address for googles upstream server(s) will probably be different.

...
;; ANSWER SECTION:
google.com.		299	IN	A	216.58.216.206
...
;; SERVER: 127.0.0.1#53(127.0.0.1)

Hosts

winhelp2002.mvps.org has a hosts file that blocks advertisements and malicious domains. The hosts file is updated periodically so you may wish to make a cronjob to fetch the hosts file.

To install mvps' host file:

# mkdir /etc/dnsmasq.d
# echo "conf-dir=/etc/dnsmasq.d" >> /etc/dnsmasq.conf
# curl http://winhelp2002.mvps.org/hosts.txt