Unbound è una convalida, ricorsiva e la memorizzazione nella cache del resolver DNS, rilasciato sotto licenza BSD. Versione 1.0.0 è stata rilasciata il 20 maggio 2008. Questo tutorial spiega come installare e utilizzare su Debian Etch, compresa la creazione di zone per i propri domini.
Questo documento viene fornito senza garanzia di alcun tipo! Voglio dire che questo non è l’unico modo di impostazione di un tale sistema. Ci sono molti modi per raggiungere questo obiettivo, ma questo è il modo di che prendere. Io non rilasciano alcuna garanzia che questo funziona per voi!
1 installare Unbound
Poiché non esiste alcun pacchetto Debian disponibile ancora, dobbiamo installare Unbound dalle fonti. In primo luogo abbiamo installare i prerequisiti:
apt-get install build-essential libssl-dev
Quindi scaricare e installare Unbound come segue:
CD/tmp
wget http://www.unbound.net/downloads/unbound-latest.tar.gz
tar xvfz unbound-latest.tar.gz
CD unbound-1.0.0/
. /Configure
fare
fare installare
Successivamente creiamo un utente e un gruppo chiamato non associato:
groupadd unbound
useradd -d /var/unbound -m -g unbound -s /bin/false unbound
Useremo la directory /var/unbound come home directory del server dei nomi Unbound – conterrà la configurazione Unbound e Unbound eseguirà chroot in esso per motivi di sicurezza.
Successivamente scarichiamo l’elenco dei server dei nomi principale:
CD/var/unbound
wget ftp://ftp.internic.net/domain/named.cache
Poi creiamo la directory /var/unbound/var/run che terrà il file PID non associato, unbound.pide creare un link simbolico /var/run/unbound.pid ad esso:
mkdir -p /var/unbound/var/run
chown -R unbound: unbound/var/unbound
ln -s /var/unbound/var/run/unbound.pid /var/run/unbound.pid
Di start/stop/restart Unbound, abbiamo bisogno di un init script come questo:
vi /etc/init.d/unbound
#!/bin/sh # # unbound This shell script takes care of starting and stopping # unbound (DNS server). exec="/usr/local/sbin/unbound" prog="unbound" config="/var/unbound/unbound.conf" pidfile="/var/run/unbound.pid" rootdir="/var/unbound" case "$1" in start) [ -x $exec ] || exit 5 [ -f $config ] || exit 6 echo -n $"Starting $prog: " # setup root jail if [ -s /etc/localtime ]; then [ -d ${rootdir}/etc ] || mkdir -p ${rootdir}/etc ; if [ ! -e ${rootdir}/etc/localtime ] || /usr/bin/cmp -s /etc/localtime ${rootdir}/etc/localtime; then cp -fp /etc/localtime ${rootdir}/etc/localtime fi; fi; if [ -s /etc/resolv.conf ]; then [ -d ${rootdir}/etc ] || mkdir -p ${rootdir}/etc ; if [ ! -e ${rootdir}/etc/resolv.conf ] || /usr/bin/cmp -s /etc/resolv.conf ${rootdir}/etc/resolv.conf; then cp -fp /etc/resolv.conf ${rootdir}/etc/resolv.conf fi; fi; if ! egrep -q '^/[^[:space:]]+[[:space:]]+'${rootdir}'/dev/log' /proc/mounts; then [ -d ${rootdir}/dev ] || mkdir -p ${rootdir}/dev ; [ -e ${rootdir}/dev/log ] || touch ${rootdir}/dev/log mount --bind -n /dev/log ${rootdir}/dev/log >/dev/null 2>&1; fi; if ! egrep -q '^/[^[:space:]]+[[:space:]]+'${rootdir}'/dev/random' /proc/mounts; then [ -d ${rootdir}/dev ] || mkdir -p ${rootdir}/dev ; [ -e ${rootdir}/dev/random ] || touch ${rootdir}/dev/random mount --bind -n /dev/random ${rootdir}/dev/random >/dev/null 2>&1; fi; # if not running, start it up here start-stop-daemon --start --quiet --pidfile $pidfile --exec $exec -- -c $config echo ;; stop) echo -n $"Stopping $prog: " start-stop-daemon --stop --quiet --oknodo --pidfile $pidfile echo if egrep -q '^/[^[:space:]]+[[:space:]]+'${rootdir}'/dev/log' /proc/mounts; then umount ${rootdir}/dev/log >/dev/null 2>&1 fi; if egrep -q '^/[^[:space:]]+[[:space:]]+'${rootdir}'/dev/random' /proc/mounts; then umount ${rootdir}/dev/random >/dev/null 2>&1 fi; ;; restart) start-stop-daemon --stop --quiet --oknodo --pidfile $pidfile start-stop-daemon --start --quiet --pidfile $pidfile --exec $exec -- -c $config ;; reload) start-stop-daemon --stop --signal 1 --quiet --oknodo --pidfile $pidfile --exec $exec ;; force_reload) start-stop-daemon --stop --signal 1 --quiet --oknodo --pidfile $pidfile --exec $exec ;; *) echo $"Usage: $0 {start|stop|restart|reload|force-reload}" exit 2 ;; esac exit 0 |
Rendere lo script eseguibile e creare i collegamenti di avvio del sistema per esso:
chmod 755 /etc/init.d/unbound
Update-RC. d non associato defaults
Questo è tutto per l’installazione.
2 configurazione non associato
Ora creiamo il file di configurazione di Unbound, /var/unbound/unbound.conf. Troverete un file di configurazione di esempio in/tmp/unbound-1.0.0/doc/example.conf , che ha un sacco di spiegazioni in esso. È anche possibile visitare http://www.unbound.net/documentation/unbound.conf.html per ulteriori informazioni sulla configurazione di Unbound.
Nella seguente configurazione, aggiungere due zone per i domini (example.com ed example.net) che voglio host sul server dei nomi non associato. Se si ha familiarità con il server di nome BIND, si può imparare la sintassi di Unbound molto veloce. Regolare le zone per le vostre esigenze, o lasciarli se avete solo bisogno di un resolver locale:
vi /var/unbound/unbound.conf
server: verbosity: 1 interface: 0.0.0.0 port: 53 do-ip4: yes do-ip6: yes do-udp: yes do-tcp: yes do-daemonize: yes access-control: 0.0.0.0/0 allow #access-control: 0.0.0.0/0 refuse #access-control: 127.0.0.0/8 allow chroot: "/var/unbound" username: "unbound" directory: "/var/unbound" use-syslog: yes pidfile: "/var/run/unbound.pid" root-hints: "/var/unbound/named.cache" local-zone: "example.com." static local-data: "example.com. 86400 IN NS ns1.hostingcompany.com." local-data: "example.com. 86400 IN NS ns2.hostingcompany.com." local-data: "example.com. 86400 IN SOA ns1.hostingcompany.com. hostmaster.hostingcompany.com. 2008052201 28800 7200 604800 86400" local-data: "example.com. 86400 IN A 1.2.3.4" local-data: "www.example.com. 86400 IN CNAME example.com." local-data: "mail.example.com. 86400 IN A 1.2.3.4" local-data: "example.com. 86400 IN MX 10 mail.example.com." local-data: "example.com. 86400 IN TXT v=spf1 a mx ~all" local-zone: "example.net." static local-data: "example.net. 86400 IN NS ns1.hostingcompany.com." local-data: "example.net. 86400 IN NS ns2.hostingcompany.com." local-data: "example.net. 86400 IN SOA ns1.hostingcompany.com. hostmaster.hostingcompany.com. 2008052201 28800 7200 604800 86400" local-data: "example.net. 86400 IN A 1.2.3.4" local-data: "www.example.net. 86400 IN CNAME example.net." local-data: "mail.example.net. 86400 IN A 1.2.3.4" local-data: "example.net. 86400 IN MX 10 mail.example.net." local-data: "example.net. 86400 IN TXT v=spf1 a mx ~all" |
Ho usato interfaccia: 0.0.0.0 qui che significa che non associato è in ascolto su tutte le interfacce di rete, e controllo di accesso: Consenti 0.0.0.0/0 che significa che chiunque può connettersi Unbound. Se si desidera solo localhost per essere autorizzati a connettersi, ad esempio, si utilizzerà
[...] access-control: 0.0.0.0/0 refuse access-control: 127.0.0.0/8 allow [...] |
invece.
Per verificare se la sintassi della configurazione Unbound è corretta, è possibile utilizzare il comando di unbound-checkconf :
unbound-checkconf /var/unbound/unbound.conf
Server1: ~ # unbound-checkconf /var/unbound/unbound.conf
Unbound-checkconf: senza errori in /var/unbound/unbound.conf
Server1: ~ #
Se la sintassi è ok, si può finalmente iniziare Unbound:
/etc/init.d/unbound start
Per ulteriori informazioni su Unbound, consultare la documentazione di Unbound.
3 collegamenti
- Non associati: http://www.unbound.net/index.html
- Debian: http://www.debian.org