Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

linux ÖдDNS³öÏÖµÄÎÊÌâ¡££¨Ë­À´°ï°ïÎÒ£©

linuxÏ´DNSʱ ÊäÈënslookup¼ì²éʱºò£¬³öÏÖ

server can't find www.test.com£»servfail
server can't find 12.36.168.192.in-addr.arpa£»servfail
ÊÇʲôÒâ˼¡£  ÎÒµÄÕýÏò½âÎöºÍ·´Ïò½âÎö¶¼²»ÐС£¡£

ÁíÍâÎÒµÄÅäÖÃÎļþÓÃnamed -g È¥¼ì²â£¬³öÏÖ
starting BIND 9.2.1 -g
using 1 CPU
loading configuration from 'etc/named.conf'
no IPv6 interfaces found
listening on IPv4 interface lo, 127.0.0.1#53
binding TCP socket:address in use
/etc/named.conf:20: couldn't add command channel 127.0.0.1#9
53: address in use
ignoring config file logging starement due to -g option
couldn't open pid file '/var/run/named/named.pid':File exists
exiting (due to early fatal error)
Çë½Ì¸ßÊÖÎÒÄÄÀï³ö´íÁË¡£¡£¡£
ÎÒµÄÅäÖÃÎļþÊDzÎÕÕÁ˺ܶàÍøÂçÉϵÄÎĵµ×öµÄ¡£
ÎÒÓõÄÊÇVMÐéÄâ»ú£¬Ïë´î½¨Ò»¸öwww.test.comµÄÓò¡£bind°æ±¾ÊÇRedHat 9.×Ô´øµÄ9.2.1µÄ°æ±¾
'/var/run/named/named.pid' Õâ¸öÎļþÎÒȥĿ¼ÏÂÕÒÁË¡£ËüÆäʵ´æÔÚ¡£ÎªÊ²Ã´»áÌáʾ²»´æÔÚ¡£

ÄãÓиü¸Äetc/resolv.confÎļþÖеÄÓòÃû·þÎñÆ÷ΪÄãbindÓòÃû·þÎñÆ÷ËùÔÚÖ÷»úµÄIPµØÖ·Âð?ÀýÈçnameserver 192.168.1.2£¬ÆäÖÐÕâ¸öµØÖ·¼«ÎªbindËùÒÔÖ÷»úµÄIPµØÖ·


¸ÄÁËß¹¡£¡£
 
nameserver 192.168.36.12
domain test.com
search www.test.com test.com


¸ùvar/run/named/named.pidÕâ¸öÎļþûÓйØÏµ£¬°ÑÅäÖÃÎļþÌùÉÏÀ´¿´¿´

Ò»°ãÅäÖÃDNS³ö´í ¶¼ÊDz»Ï¸ÐÄÔì³ÉµÄ ½¨ÒéÂ¥


Ïà¹ØÎÊ´ð£º

linux»·¾³ÏÂgethostbynameº¯ÊýÎÊÌâ - C/C++ / CÓïÑÔ

дÁ˸ö²âÊÔ³ÌÐòÈçÏÂ
   
  struct hostent *hp; 
char AlarmDevIP[20];  
  int x2;

hp = gethostbyname("www.google.com");
if (hp)
{ ......

linux 2.6 Äں˵ÄÅäÖÃÎļþÔÚÄÄÀï

Á½Ì¨»úÆ÷ÐͺÅÍêȫһÑù

ÏëÒª°Ñһ̨»úÆ÷µÄÄÚºËÅäÖÃÎļþ¿½±´¸øÁíÍâһ̨

RT


3Q
...

.config Òþ²ØµÄ ÔÚÄãÅäÖùýÄں˺ó¾ÍÉú³ÉÁË

lsÕý½â£¬ÔÚkernelÔ´Âë¶¥²ãĿ¼ÖÐÓиö.configÎļþ£¬ÅäÖ ......

½ñÌì·¢Ïֺܶà³ÌÐòËÀÔÚlinux ·þÎñ½øÖÐ

ÎʸöÎÊÌâ ½ñÌì·¢Ïֺܶà³ÌÐòËÀÔÚlinux ·þÎñ½øÖÐ
ÒѾ­ËÀÁ˺öàÌìÁË¡£ÓÃcrontab ¶¼¶¨ÔÚ Á賿0µãÅÜ¡£
ÏëÖªµÀÈçºÎ²é¿´ ·þÎñÆ÷ÄÄ·½ÃæµÄ×ÊÔ´Ì«ÉÙµ¼Ö½ø³ÌËÀÔÚÀïÃæ£¿
³ÌÐò±¾ÉíÊÇ·ñ¾Í´æÔÚÎÊÌâ

ÒýÓÃ
ÎʸöÎÊÌâ ½ñÌ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ