#!/bin/sh # named a network name service. # chkconfig: - 65 37 # description: a name server #if [ `id -u` -ne 0 ] # #then # #echo "ERROR:For bind to port 53,must run as root." # #exit 1 #fi # Source function library. . /etc/rc.d/init.d/functions . /etc/sysconfig/network prog="named" exec="/usr/local/bind9/sbin/named" config="/usr/local/bind9/etc/name.conf" pid="/usr/local/bind9/var/run/named.pid" case "$1" in start) named_run_status=0 RESPONSE=$(/usr/local/bind9/sbin/rndc status 2>&1) echo "$RESPONSE" | grep -q "connect failed" && named_run_status=1 if [ $named_run_status -eq 1 ]; then $exec -4 -c $config -f & action "$prog is running" /bin/true else action "$prog already running" /bin/false fi ;; stop) if [ -e $pid ]; then kill `cat $pid` && action "$prog already stoping" /bin/true else action 'named already stoping' /bin/false fi ;; restart) $0 stop sleep 1 $0 start ;; reload) /usr/local/bind9/sbin/rndc reload ;; status) /usr/local/bind9/sbin/rndc status ;; *) echo "$0 start | stop | restart |reload |status" ;; esac
bind 防火墙通过规则
-A INPUT -p tcp -m tcp --dport 53 -j ACCEPT -A INPUT -p udp -m udp --dport 53 -j ACCEPT
原文链接:linux,bind,named开机启动脚本,转载请注明来源!