PDA

View Full Version : [Q] DNS Linux



cache_bdg
02-11-2002, 12:06
Chào bác, Tôi là thành viên mới của diễn đàn. Tôi vừa học về HĐH linux ( tôi tham khảo sách thôi) nhưng tôi không hiểu nhiều lắm. Tôi đang cài DNS cho nó và dung công cụ Bind 9. Nhưng mà DNS của tôi vẫn không chạy.
Tôi làm theo sách thì tôi có các file nhu sau :
//etc/named.conf
## named.conf - configuration for bind
#
# Generated automatically by bindconf, alchemist et al.
options {
directory "/var/named/";
};

zone "." {
type hint;
file "named.ca";
};


zone "0.0.127.in-addr.arpa" {
type master;
file "0.0.127.in-addr.arpa.zone";
};


zone "mydomain.test" {
type master;
file "mydomain.test.zone";
};

};

zone "0.168.192.in-addr.arpa" {
type master;
file "0.168.192.in-addr.arpa.zone";
/* This file is the reverse file for your
* local network, it is essential that this
* is in place or dns may be flakey.
*/
};


/var/named/0.0.127.in-addr.arpa.zone
$TTL 86400
@ IN SOA dns1.mydomain.test administrator.mydomain.test (
1 ; ******
28800 ; refresh
7200 ; retry
604800 ; expire
86400 ; ttk
)


@ IN NS dns1.mydomain.test

192.168.0.235 IN PTR localhost
//0.168.192.in-addr.arpa.zone
$TTL 86400
@ IN SOA @ administrator.mydomain.test (
3 ; ******
28800 ; refresh
7200 ; retry
604800 ; expire
86400 ; ttk
)

@ IN NS dns1.mydomain.test.
235 IN PTR dns1.mydomain.test.
3 IN PTR pop.mydomain.test.
4 IN PTR dns2.mydomain.test.
5 IN PTR smtp.mydomain.test.
6 IN PTR www.mydomain.test.
7 IN PTR ftp.mydomain.test.
8 IN PTR webhosting.mydomain.test.

//localhost.zone
$TTL 86400
$ORIGIN localhost.
@ 1D IN SOA @ root (
42 ; ****** (d. adams)
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum

1D IN NS @
1D IN A 127.0.0.1

//named.ca
; This file holds the information on root name servers needed to
; initialize cache of Internet domain name servers
; (e.g. reference this file in the "cache . <file>"
; configuration file of BIND domain name servers).
;
; This file is made available by InterNIC registration services
; under anonymous FTP as
; file /domain/named.root
; on server FTP.RS.INTERNIC.NET
; -OR- under Gopher at RS.INTERNIC.NET
; under menu InterNIC Registration Services (NSI)
; submenu InterNIC Registration Archives
; file named.root
;
; last update: Aug 22, 1997
; related version of root zone: 1997082200
;
;
; formerly NS.INTERNIC.NET
;
. 3600000 IN NS A.ROOT-SERVERS.NET.
A.ROOT-SERVERS.NET. 3600000 A 198.41.0.4
;
; formerly NS1.ISI.EDU
;
. 3600000 NS B.ROOT-SERVERS.NET.
B.ROOT-SERVERS.NET. 3600000 A 128.9.0.107
;
; formerly C.PSI.NET
;
. 3600000 NS C.ROOT-SERVERS.NET.
C.ROOT-SERVERS.NET. 3600000 A 192.33.4.12
;
; formerly TERP.UMD.EDU
;
. 3600000 NS D.ROOT-SERVERS.NET.
D.ROOT-SERVERS.NET. 3600000 A 128.8.10.90
;
; formerly NS.NASA.GOV

//named.local
$TTL 86400
@ IN SOA localhost. root.localhost. (
1997022700 ; ******
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
IN NS localhost.

1 IN PTR localhost.

//mydomain.test.zone
$TTL 86400
@ IN SOA @ administrator.mydomain.test (
2 ; ******
28800 ; refresh
7200 ; retry
604800 ; expire
86400 ; ttl
)


@ IN NS dns1.mydomain.test.
@ IN MX 10 smtp.mydomain.test.
@ IN MX 100 pop.mydomain.test.

@ IN A 127.0.0.1
dns1 IN A 192.168.0.235
dns2 IN A 192.168.0.4
smtp IN A 192.168.0.5
pop IN A 192.168.0.3
pop3 IN CNAME pop.mydomain.test.
www IN A 192.168.0.6
mail IN A 192.168.0.5
webhosting IN A 192.168.0.8
////////////////////////////////
Không biết la có sai hay thiếu gì nữa không, nhờ các bác chỉ giúp cho

chuotluoi
03-11-2002, 01:46
Tui chưa đọc kĩ lắm nhưng có lẽ không sai đâu. u hãy vào /etc/resolv.conf để sửa thêm 1 domain nữa là cái mydomain.test vào .
Tui góp ý chút là u nên làm đơn giản thôi, chừng nào nó chạy rồi thì mới add thêm mấy cái pop... vào, vậy sẽ dễ hơn.

cache_bdg
03-11-2002, 12:28
Ok, cam on anh Choutluoi da gop y, toi se lam lai xem sao, nhung co ranh thi anh doc va gop y cho toi nhe !

cache_bdg
03-11-2002, 12:33
Ah, Tôi không biết nó đã sai thế nào nhưng tôi thấy bó báo [FAILED] khi stop và [OK] khi start.

chuotluoi
03-11-2002, 17:23
Ủa, vậy thì đâu có gì với cái file zone đó?!?!? Nó start được tức là file zone không bị lỗi cú pháp.:-/
Vậy u đã dùng cái gì để thử?!?!?!?

cache_bdg
04-11-2002, 22:28
nhưng khổ nổi là no không chịu chạy mới chết tui chứ. Anh làm ơn xem kỹ lại và giúp tui với.Start thi nó báo [OK], còn stop thì[FAILED], status thì nó báo Named not running. Chịu khó giúp tui với.

GiangVu
05-11-2002, 05:19
ba.n du`ng thu*? command
ls /etc/sysconfig/network-scripts/ song paste result ... xem sao?

GiangVu
05-11-2002, 05:21
vie^.c quan tro.ng khi setup dns la` pha?i make sure...nhu*~ng ips ma` ca^`n du`ng ddang online...

anhbahanoi
13-10-2005, 02:14
[QUÓTâE=cache_bdg]nhứng khổ nổi là no khổng chịu chạy mới chết tui chứ. Anah làm ơn xem kỹ lại và giúp tui với.Start thi nó báo [OK], còn stop thì[FAILED], status thì nó báo Named not running. Chịu khó giúp tui với.[/QUOTE]

Minh cung bi giong nhu bac cache_bdg dung nhu vay. Minh lam theo bac
GiangVu thi duoc cai mess nay

[root@bind /]# ls /etc/sysconfig/network-scripts
ifcfg-eth0 ifdown-ipv6 ifup ifup-isdn ifup-sit
ifcfg-lo ifdown-isdn ifup-aliases ifup-plip ifup-sl
ifdown ifdown-post ifup-cipcb ifup-plusb ifup-wireless
ifdown-aliases ifdown-ppp ifup-ippp ifup-post init.ipv6-global
ifdown-cipcb ifdown-sit ifup-ipv6 ifup-ppp network-functions
ifdown-ippp ifdown-sl ifup-ipx ifup-routes network-functions-ipv6

vay bay gio phai lam cai gi de no ok het tron vay mong cac pa' help cho cai'

|2[][]T
13-10-2005, 16:03
hehe, "ls /etc/sysconfig/network-scripts" thi lam duoc cai gi?

bac "cat /etc/init.d/named" voi lai "/sbin/ifconfig" cho to xem nao?

anhbahanoi
13-10-2005, 19:48
[]T']hehe, "ls /etc/sysconfig/network-scripts" thi lam duoc cai gi?

bac "cat /etc/init.d/named" voi lai "/sbin/ifconfig" cho to xem nao?

[root@bind]# cat /etc/init.d/named
#!/bin/bash
#
# named This shell script takes care of starting and stopping
# named (BIND DNS server).
#
# chkconfig: - 55 45
# description: named (BIND) is a Domain Name Server (DNS) \
# that is used to resolve host names to IP addresses.
# probe: true

# Source function library.
. /etc/rc.d/init.d/functions

# Source networking configuration.
. /etc/sysconfig/network

RETVAL=0
prog="named"

# Check that networking is up.
[ "${NETWORKING}" = "no" ] && exit 0

[ -r /etc/sysconfig/named ] && . /etc/sysconfig/named

[ -x /usr/sbin/named ] || exit 0

[ -r ${ROOTDIR}/etc/named.conf ] || exit 0


start() {
# Start daemons.
if [ -n "`/sbin/pidof named`" ]; then
echo -n $"$prog: already running"
return 1
fi
echo -n $"Starting $prog: "
if [ -n "${ROOTDIR}" -a "x${ROOTDIR}" != "x/" ]; then
OPTIONS="${OPTIONS} -t ${ROOTDIR}"
fi
daemon /usr/sbin/named -u named ${OPTIONS}
RETVAL=$?
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/named
return $RETVAL
}
stop() {
# Stop daemons.
echo -n $"Stopping $prog: "
/usr/sbin/rndc stop
RETVAL=$?
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/named || {
killproc named
RETVAL=$?
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/named
}
echo
return $RETVAL
}
rhstatus() {
/usr/sbin/rndc status
return $?
}
restart() {
stop
# wait a couple of seconds for the named to finish closing down
sleep 2
start
}
reload() {
echo -n $"Reloading $prog: "
/usr/sbin/rndc reload >/dev/null 2>&1 || /usr/bin/killall -HUP `/sbin/pidof -o %PPID named`
[ "$?" -eq 0 ] && success $"$prog reload" || failure $"$prog reload"
echo
return $?
}
probe() {
# named knows how to reload intelligently; we don't want linuxconf
# to offer to restart every time
/usr/sbin/rndc reload >/dev/null 2>&1 || echo start
return $?
}

# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
status)
rhstatus
;;
restart)
restart
;;
condrestart)
[ -e /var/lock/subsys/named ] && restart
;;
reload)
reload
;;
probe)
probe
;;
*)
echo $"Usage: $0 {start|stop|status|restart|condrestart|reload|prob e}"
exit 1
esac

exit $?
/************************************************** ************************************/

[root@bind]# /sbin/ifconfig
eth0 Link encap:Ethernet HWaddr 00:08:54:04:B2:28
inet addr:192.168.0.10 Bcast:192.168.0.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:155178 errors:0 dropped:0 overruns:0 frame:0
TX packets:3507 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:204019226 (194.5 Mb) TX bytes:462293 (451.4 Kb)
Interrupt:11 Base address:0xe000

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:743 errors:0 dropped:0 overruns:0 frame:0
TX packets:743 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:53529 (52.2 Kb) TX bytes:53529 (52.2 Kb)

|2[][]T
13-10-2005, 20:49
Hehe,



Chào bác, Tôi là thành viên mới của diễn đàn. Tôi vừa học về HĐH linux ( tôi tham khảo sách thôi) nhưng tôi không hiểu nhiều lắm. Tôi đang cài DNS cho nó và dung công cụ Bind 9. Nhưng mà DNS của tôi vẫn không chạy.
Tôi làm theo sách thì tôi có các file nhu sau :
//etc/named.conf
## named.conf - configuration for bind
#
# Generated automatically by bindconf, alchemist et al.
options {
directory "/var/named/";
};

zone "." {
type hint;
file "named.ca";
};


zone "0.0.127.in-addr.arpa" {
type master;
file "0.0.127.in-addr.arpa.zone";
};


zone "mydomain.test" {
type master;
file "mydomain.test.zone";
};

};


Cho nay sai roi, du 1 cai "};"



zone "0.168.192.in-addr.arpa" {
type master;
file "0.168.192.in-addr.arpa.zone";
/* This file is the reverse file for your
* local network, it is essential that this
* is in place or dns may be flakey.
*/
};


/var/named/0.0.127.in-addr.arpa.zone
$TTL 86400
@ IN SOA dns1.mydomain.test administrator.mydomain.test (
1 ; ******
28800 ; refresh
7200 ; retry
604800 ; expire
86400 ; ttk
)


@ IN NS dns1.mydomain.test

192.168.0.235 IN PTR localhost
//0.168.192.in-addr.arpa.zone
$TTL 86400
@ IN SOA @ administrator.mydomain.test (
3 ; ******
28800 ; refresh
7200 ; retry
604800 ; expire
86400 ; ttk
)

@ IN NS dns1.mydomain.test.
235 IN PTR dns1.mydomain.test.
3 IN PTR pop.mydomain.test.
4 IN PTR dns2.mydomain.test.
5 IN PTR smtp.mydomain.test.
6 IN PTR www.mydomain.test.
7 IN PTR ftp.mydomain.test.
8 IN PTR webhosting.mydomain.test.

//localhost.zone
$TTL 86400
$ORIGIN localhost.
@ 1D IN SOA @ root (
42 ; ****** (d. adams)
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum

1D IN NS @
1D IN A 127.0.0.1

//named.ca
; This file holds the information on root name servers needed to
; initialize cache of Internet domain name servers
; (e.g. reference this file in the "cache . <file>"
; configuration file of BIND domain name servers).
;
; This file is made available by InterNIC registration services
; under anonymous FTP as
; file /domain/named.root
; on server FTP.RS.INTERNIC.NET
; -OR- under Gopher at RS.INTERNIC.NET
; under menu InterNIC Registration Services (NSI)
; submenu InterNIC Registration Archives
; file named.root
;
; last update: Aug 22, 1997
; related version of root zone: 1997082200
;
;
; formerly NS.INTERNIC.NET
;
. 3600000 IN NS A.ROOT-SERVERS.NET.
A.ROOT-SERVERS.NET. 3600000 A 198.41.0.4
;
; formerly NS1.ISI.EDU
;
. 3600000 NS B.ROOT-SERVERS.NET.
B.ROOT-SERVERS.NET. 3600000 A 128.9.0.107
;
; formerly C.PSI.NET
;
. 3600000 NS C.ROOT-SERVERS.NET.
C.ROOT-SERVERS.NET. 3600000 A 192.33.4.12
;
; formerly TERP.UMD.EDU
;
. 3600000 NS D.ROOT-SERVERS.NET.
D.ROOT-SERVERS.NET. 3600000 A 128.8.10.90
;
; formerly NS.NASA.GOV

//named.local
$TTL 86400
@ IN SOA localhost. root.localhost. (
1997022700 ; ******
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
IN NS localhost.

1 IN PTR localhost.

//mydomain.test.zone
$TTL 86400
@ IN SOA @ administrator.mydomain.test (
2 ; ******
28800 ; refresh
7200 ; retry
604800 ; expire
86400 ; ttl
)


@ IN NS dns1.mydomain.test.
@ IN MX 10 smtp.mydomain.test.
@ IN MX 100 pop.mydomain.test.

@ IN A 127.0.0.1
dns1 IN A 192.168.0.235
dns2 IN A 192.168.0.4
smtp IN A 192.168.0.5
pop IN A 192.168.0.3
pop3 IN CNAME pop.mydomain.test.
www IN A 192.168.0.6
mail IN A 192.168.0.5
webhosting IN A 192.168.0.8
////////////////////////////////
Không biết la có sai hay thiếu gì nữa không, nhờ các bác chỉ giúp cho


khong biet bac anhbahanoi co dung chung cai named.conf khong, neu khong thi bac lam cai nay cho to nhe:

# named-checkconf /etc/bind.conf
# named-checkzone /var/named/*.zone
# named -g

Cheers