DNS Server - BIND9 no Iomega StorCenter IX2-200 Cloud Edition


Primeiramente gostaria de salientar que não sou o autor principal do conteúdo deste artigo. A minha intenção é de mostrar o que outros autores tem realizado (referenciando links para o conteúdo original) neste blog até como um guia pessoal para uso próprio e ainda compartilhar minhas anotações e pequenas modificações que realizo no conteúdo, desejando que possa ajudar mais alguém em algum lugar.
First and foremost, I take no credit for any of this post’s content. I am really just taking what others have done (which I have links to bellow) and am putting it on my blog for a personal reference and hopefully the small changes that I made to their guides will help someone somewhere.


Link: http://www.nslu2-linux.org/wiki/HowTo/BuildPrimaryDNSServer

Primeiramente acesse o equipamento com uma sessão SSH.

Ative esta opção no site do seu equipamento na página abaixo:

Utilizando o putty ou terminal do linux: 
ssh root@192.168.1.13

Usuário: root
Senha: soho + a senha do admin

Instale os aplicativos optware com o comando ipkg, configurando do seguinte forma ((já vem pré instalado):
cat <<EOF > /etc/ipkg.conf 
src cross http://ipkg.nslu2-linux.org/feeds/optware/cs08q1armel/cross/unstable 
src native http://ipkg.nslu2-linux.org/feeds/optware/cs08q1armel/native/unstable 
EOF

Atualize com o comando:
ipkg update

Liste as opções com o comando:
ipkg list

Ou acesse os sites:

E instale o que quiser com o comando abaixo:
ipkg install <nome do app>


O pacote optware a ser instalado é o pacote abaixo:
Package: bind Version: 9.6.1.3-4 Depends: openssl, psmisc Section: net Architecture: arm Maintainer: Louis Lagendijk <louis.lagendijk@gmail.com> MD5Sum: 1f1734572717ab0f4511a83a3b0af3c3 Size: 1209855 Filename: bind_9.6.1.3-4_arm.ipk Source: ftp://ftp.isc.org/isc/bind9/9.6.1-P3/bind-9.6.1-P3.tar.gz Description: Bind provides a full name server package, including zone masters, slaves, zone transfers, security multiple views. This is THE reference implementation from ISC, which has roots all the way back to the TOPS-20 original. It is over-kill, unless you have a complex environment. Other utilities (for debugging, remote management) are also included. Full documentation and developers' files are included in this kit, though you may wish they weren't.

Vamos tentar configurar o bind9
ipkg install bind

Resultado:
Installing bind (9.6.1.3-4) to root...
Downloading http://ipkg.nslu2-linux.org/feeds/optware/cs08q1armel/cross/unstable/bind_9.6.1.3-4_arm.ipk
Installing psmisc (22.13-1) to root...
Downloading http://ipkg.nslu2-linux.org/feeds/optware/cs08q1armel/cross/unstable/psmisc_22.13-1_arm.ipk
Installing ncurses (5.7-1) to root...
Downloading http://ipkg.nslu2-linux.org/feeds/optware/cs08q1armel/cross/unstable/ncurses_5.7-1_arm.ipk
Configuring bind
sh: //opt/ipkg/info/bind.postinst: /bin/ash: bad interpreter: No such file or directory
postinst script returned status 126
ERROR: bind.postinst returned 126
Configuring dovecot
Configuring ncurses
mkdir: cannot create directory `/usr/lib/ipkg': Read-only file system
postinst script returned status 1
ERROR: ncurses.postinst returned 1
Configuring psmisc
mkdir: cannot create directory `/usr/lib/ipkg': Read-only file system
mkdir: cannot create directory `/usr/lib/ipkg': Read-only file system
postinst script returned status 1
ERROR: psmisc.postinst returned 1
Successfully terminated.

Ajuste o arquivo /opt/ipkg/info/bind.postinst
nano /opt/ipkg/info/bind.postinst

Troque: #! /bin/ash
Por: #! /bin/sh

Execute novamente:
ipkg install bind
Package bind (9.6.1.3-4) installed in root is up to date.
Configuring bind
Running post-install
You must now create your named.conf file
When it is installed in /opt/etc/named/named.conf, execute
              /opt/etc/init.d/S09named start
to start service
You will probably also want to create rndc.conf by running
rndc-confgen.  Of course, you may want to set your name server
in the GUI to 127.0.0.1 or your local ip-address
Configuring dovecot
Configuring ncurses
mkdir: cannot create directory `/usr/lib/ipkg': Read-only file system
postinst script returned status 1
ERROR: ncurses.postinst returned 1
Configuring psmisc
mkdir: cannot create directory `/usr/lib/ipkg': Read-only file system
mkdir: cannot create directory `/usr/lib/ipkg': Read-only file system
postinst script returned status 1
ERROR: psmisc.postinst returned 1
Successfully terminated.

o arquivo ncurses.postinst utiliza o comando abaixo:
update-alternatives
Usage: update-alternatives --install <link> <name> <path> <priority>
       update-alternatives --remove <name> <path>
       update-alternatives --help
<link> is the link pointing to the provided path (ie. /usr/bin/foo).
<name> is the name in $ad/alternatives (ie. foo)
<path> is the name referred to (ie. /usr/bin/foo-extra-spiffy)
<priority> is an integer; options with higher numbers are chosen.

 cat psmisc.postinst
#!/bin/sh
/opt/bin/update-alternatives --install /opt/bin/killall killall /opt/bin/psmisc-killall 70
/opt/bin/update-alternatives --install /opt/bin/pidof pidof /opt/bin/psmisc-killall 70


Inclua ":/opt/bin:/opt/sbin" ao path do arquivo /etc/profile
nano /etc/profile
# /etc/profile: system-wide .profile file for the Bourne shell (sh(1))
# and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).

if [ "`id -u`" -eq 0 ]; then
  PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin:/opt/sbin"
else
  PATH="/usr/local/bin:/usr/bin:/bin:/usr/games:/opt/bin:/opt/sbin"
fi

if [ "$PS1" ]; then
  if [ "$BASH" ]; then
    PS1='\u@\h:\w\$ '
  else
    if [ "`id -u`" -eq 0 ]; then
      PS1='# '
    else
      PS1='$ '
    fi
  fi
fi

export PATH

umask 022
if [ -e ~/.bashrc ];then
        . ~/.bashrc
fi

Crie um link da seguinte forma:
cd /opt/bin
ln -s /usr/bin/update-alternatives

Faça /mnt/apps/usr ser passível de escrita para rodar os programas de instalação:
mkdir /mnt/pools/A/A0/tmp
cp -a /mnt/apps/usr/* /mnt/pools/A/A0/tmp/
mount --bind /mnt/pools/A/A0/tmp /mnt/apps/usr

Inclua um link temporário:
cd /mnt/pools/A/A0/tmp/lib
mkdir /opt/lib/ipkg
ln -s /opt/lib/ipkg

Reinstale os programas:
ipkg -force-reinstall install ncurses psmisc

Reinstalling ncurses (5.7-1) on root...
Downloading http://ipkg.nslu2-linux.org/feeds/optware/cs08q1armel/cross/unstable/ncurses_5.7-1_arm.ipk
Reinstalling psmisc (22.13-1) on root...
Downloading http://ipkg.nslu2-linux.org/feeds/optware/cs08q1armel/cross/unstable/psmisc_22.13-1_arm.ipk
Configuring ncurses
update-alternatives: Linking //opt/bin/clear to /opt/bin/ncurses-clear
Configuring psmisc
update-alternatives: Linking //opt/bin/killall to /opt/bin/psmisc-killall
update-alternatives: Linking //opt/bin/pidof to /opt/bin/psmisc-killall
Successfully terminated.


Desfaça o mapeamento falso:
umount /mnt/apps/usr

Se aparecer Device is Busy voce pode:
umount -l /mnt/apps/usr

Crie o arquivo de configuração e de zonas:

tee /opt/etc/named/named.conf <<EOF
// Bind9 configuration file
include "/opt/etc/named/named.conf.options";
include "/opt/etc/named/named.conf.local";
include "/opt/etc/named/named.conf.default-zones";
key rndc-key {
algorithm hmac-md5;
secret "nDhtoGDpLH4lkTjjHD45iw==";
};
controls {
inet 127.0.0.1 port 953 allow { 127.0.0.1; } keys { rndc-key; };
};
EOF

tee /opt/etc/named/named.conf.options <<EOF
// Bind9 options file
options {
directory "/opt/var/cache/named";
forwarders {
  201.6.0.115;
  201.6.0.43;
  201.6.0.113;
  201.6.0.101;
  201.6.2.44;
  201.6.0.106;
  201.6.2.152;
  201.6.0.112;
  201.6.0.100;
  4.6.0.113;
  200.250.77.87;
  200.250.77.85;
  8.8.8.8;
  8.8.4.4;
  };
auth-nxdomain no;    # conform to RFC1035
listen-on-v6 { any; };
};
EOF

tee /opt/etc/named/named.conf.default-zones <<EOF
// Bind9 Default Zones file
zone "." {
type hint;
file "/opt/etc/named/db.root";
};
zone "localhost" {
type master;
file "/opt/etc/named/db.local";
};
zone "127.in-addr.arpa" {
type master;
file "/opt/etc/named/db.127";
};
zone "0.in-addr.arpa" {
type master;
file "/opt/etc/named/db.0";
};
zone "255.in-addr.arpa" {
type master;
file "/opt/etc/named/db.255";
};
EOF

tee /opt/etc/named/named.conf.local <<EOF
// Bind9 Local Zones 
file
include "/opt/etc/named/zones.rfc1918";
key DHCP_UPDATER {
algorithm HMAC-MD5.SIG-ALG.REG.INT;
secret "dmY5cRTBAENrkhHqqbebrg==";
};
key TRANSFER {
algorithm hmac-md5;
secret "Awqs063pgba4yibzYpaHvQ==";
};
zone "casa.lan" IN {
    type master;
    file "/opt/etc/named/casa.lan.db";
    allow-update { key DHCP_UPDATER; };
};
zone "0.168.192.in-addr.arpa" {
    type master;
    file "/opt/etc/named/rev.0.168.192.in-addr.arpa";
    allow-update { key DHCP_UPDATER; };
};
EOF

mkdir -p /opt/var/cache/named
/opt/etc/init.d/S09named start



Para tornar o optware um serviço que se inicia automaticamente quando o NAS for reiniciado, precisa alterar a imagem original da seguinte forma:

mknod -m0660 /dev/loop3 b 7 3
chown root.disk /dev/loop3 
mkdir /tmp/apps 
mount -o loop /boot/images/apps /tmp/apps
cp /tmp/apps/usr/local/cfg/sohoProcs.xml /tmp/apps/usr/local/cfg/sohoProcs.xml.original
nano /tmp/apps/usr/local/cfg/sohoProcs.xml 

Inclua um novo <Program> dentro de <Group Level=”1″>:
<Program Name="init-opt.sh" Path="/opt/etc/init-opt.sh"> 
       <SysOption Restart="-1"/> 
</Program>
 
umount /tmp/apps 
rm /dev/loop3

Crie o script abaixo:

tee /opt/etc/init-opt.sh <<EOF
#!/bin/sh
rm /opt/var/log/boot
if [ -d /opt/etc/init.d ]; then
for f in /opt/etc/init.d/S* ; do
#[ -x $f ] && $f start
$f start | tee -a /opt/var/log/boot
done
fi
EOF
chmod +x /opt/etc/init-opt.sh
mkdir /opt/var/log



Para configurar o ubuntu para sempre utilizar o DNS server do storage veja o link abaixo:

sudo gedit /etc/dhcp3/dhclient.conf

prepend domain-name-servers 192.168.1.13,127.0.0.1;
prepend domain-name "casa.lan ";

O URL específico do gadget não foi encontrado



ċ
bindzonesfiles.zip
(5k)
Ademar Arvati Filho,
29 de nov de 2011 16:25
Comments