2012年6月5日 星期二

[Linux] DNS Relay

1. Download BIND
http://www.bind9.net/download

2. Cross compile ./configure --host=mips --disable-static --prefix=$(TOOLCHAIN) --includedir=$(INC_GPL_HEADER_PATH) --libdir=$(INC_GPL_LIB_PATH) --with-openssl=no --with-pkcs11=no --with-gssapi=no --with-randomdev=no --without-iconv --without-libiconv --without-docbook-xsl --with-libxml2=no --with-purify=no --with-docbook-xsl=no --with-libiconv=no --with-iconv=no --with-idnlib=no --with-atf=no --with-dlopen=no --with-dlz-mysql=no --with-dlz-postgres=no --with-dlz-bdb=no --with-dlz-filesystem=no --with-dlz-ldap=no --with-dlz-odbc=no --with-dlz-stub=no --disable-developer --disable-devpoll --disable-epoll --disable-largefile --disable-backtrace --disable-isc-spnego --disable-chroot
3. to fix gen issue (bind-tools-BJA-gen-HOSTCC.diff) : modify configure
if test "$cross_compiling" = "yes"; then
        if test -z "$BUILD_CC"; then
               as_fn_error $? "BUILD_CC not set" "$LINENO" 5
        fi
        BUILD_CFLAGS="$BUILD_CFLAGS"
        BUILD_CPPFLAGS="$BUILD_CPPFLAGS"
        BUILD_LDFLAGS="$BUILD_LDFLAGS"
        BUILD_LIBS="$BUILD_LIBS"
else

to

if test "$cross_compiling" = "yes"; then
        #if test -z "$BUILD_CC"; then
        #       as_fn_error $? "BUILD_CC not set" "$LINENO" 5
        #fi
        BUILD_CC="$CC"
        BUILD_CFLAGS="$BUILD_CFLAGS"
        BUILD_CPPFLAGS="$BUILD_CPPFLAGS"
        BUILD_LDFLAGS="$BUILD_LDFLAGS"
        BUILD_LIBS="$BUILD_LIBS"
else

4. to fix epoll issue (or compile it with "--disable-epoll" in step 2.)
bind-tools-BJA-epoll-AC_TRY_RUN-cross.diff

5. /var/named.conf
#Disable query logging
logging {
        category default { null; };
        category lame-servers { null; };
        category edns-disabled { null; };
}

options {
        directory "/var/named";
        version "not currently available";
        listen-on { 192.168.0.1; };
        avoid-v4-udp-ports { range 1 32767; };
        avoid-v6-udp-ports { range 1 32767; };
        forwarders { 168.95.1.1;168.95.192.1; };
        forward only;
        max-ncache-ttl 3;
        allow-transfer { none; };
        allow-update-forwarding { none; };
        allow-notify { none; };
};

6. run named
mkdir /var/named
named -c /var/named.conf -d 10 -p 53

7. messages and logs
/var/log/messages  (if syslogd exists.)
/var/log/named.run

References:
DNS BIND - Operations Statements
DNS HOWTO
bind - DNS 設定
example 1
example 2

沒有留言:

張貼留言