尊龙凯时人生就是博

ÔõÑùÔÚ Linux ÉÏÉó²éºÍˢРDNS »º´æ

ͨ¹ýË¢ÐÂÍâµØ dns »º´æ £¬Äú¿ÉÒÔ½â¾ö http ¹ýʧ²¢±£»¤×Ô¼ºÃâÊÜ dns ÓÕÆ­µÄÓ°Ïì¡£ÒÔÏÂÊÇÔÚ linux ÉÏÖ´Ðд˲Ù×÷µÄÒªÁì¡£

µ±ÄúʹÓÃÓòÃû»á¼ûÍøվʱ £¬ÄúµÄϵͳ»áÏò DNS ЧÀÍÆ÷·¢ËÍÇëÇóÒÔ»ñÈ¡¸ÃÓòµÄ IP µØµã¡£´ËÓò IP µØµã¶ÔÉúÑÄÔÚ DNS »º´æÖй©ÒÔºóʹÓà £¬Òò´ËÄú²»±Øÿ´Î¶¼Ïò DNS ЧÀÍÆ÷·¢ËÍÇëÇóÒÔ½¨ÉèÅþÁ¬¡£

µ«ÓÐʱ £¬ÍâµØ DNS »º´æ»áË𻵲¢µ¼Ö HTTP ¹ýʧ¡£ÖµµÃÇìÐÒµÄÊÇ £¬ÔÚ Linux ²Ù×÷ϵͳÖÐˢкÍÖØÐÞ DNS »º´æºÜÊÇÈÝÒס£ÕâÊÇÔõÑù×öµ½µÄ¡£

ΪʲôҪÔÚ Linux ÉÏˢРDNS »º´æ£¿

Äú¿ÉÄÜÏëÒªÖØÐÞ´æ´¢ÔÚϵͳÉ쵀 DNS »º´æµÄÔµ¹ÊÔ­ÓÉÓжàÖÖ¡£ÈôÊÇÄúµÄDNS¼Í¼¹ýʱÁË £¬Äú¿ÉÄÜÏëÒª´ÓDNSЧÀÍÖØÊÓлñÈ¡Ëü¡£ÁíÍâ £¬ÈôÊÇÄúµ£ÐÄϵͳÊܵ½ÍþвÁË £¬Äú¿ÉÄÜÐèҪȷ±£DNS»º´æδ±»¸Ä¶¯ £¬Ò²±»³ÆΪDNSÓÕÆ­¡£

µ±ÄúˢРDNS »º´æʱ £¬ÏµÍ³±ØÐèÔÙ´Î ping DNS ЧÀÍÆ÷²¢´ÓÖлñȡеÄÓò IP µØµã¼Í¼ £¬´Ó¶øÔÚ´ËÀú³ÌÖÐɾ³ýÈκιýʱ»òÊÜËðµÄÊý¾Ý¡£

ÔõÑùÔÚ Linux ÉÏÉó²éÍâµØ DNS »º´æ

ÔÚsystemd֮ǰ £¬´ó´ó¶¼Linux¿¯Ðа涼ûÓÐϵͳ¹æÄ£µÄDNS»º´æ £¬³ý·ÇÏñdnsmasq»ònscdÕâÑùµÄ³ÌÐòÊÇÊÖ¶¯ÉèÖõÄ¡£systemd ¸½´ø systemd-solved £¬ÕâÊÇÒ»ÏÓòÃûÆÊÎöΪ IP µØµã²¢»º´æ DNS ÌõÄ¿µÄЧÀÍ¡£

ÒÔϸ÷½Ú½«Ö¸µ¼ÄúÔõÑùÉó²éÓÉ systemd ÆÊÎö¡¢nscd ºÍ dnsmasq ÌìÉúµÄ DNS »º´æÄÚÈÝ £¬ÒÔ±ãÄúÔÚ¾öÒéˢлº´æÊý¾Ý֮ǰÏàʶ»º´æµÄÊý¾Ý¡£

Éó²éϵͳÆÊÎöµÄ DNS »º´æ

ÒªÉó²é systemd ÆÊÎöµÄ»º´æ¼Í¼ £¬ÄúÐèÒªÏÈÔÝʱÖÕֹЧÀÍ £¬È»ºó½«ÆäÈÕÖ¾µ¼³öµ½ÎļþÖС£

Ê×ÏÈ·¢ËÍ SIGUSR1 ÐźÅÒÔÖÕÖ¹ systemd ÆÊÎöµÄЧÀÍ£º

linuxmi@linuxmi ~/www.linuxmi.com % sudo killall -USR1 systemd-resolved[sudo] linuxmi µÄÃÜÂ룺 

µÇ¼ºó¸´ÖÆ

ʹÓàjournalctl ÏÂÁîºÍ±ê×¼Êä³öÔËËã·û½«Êä³öÉúÑĵ½Îı¾Îļþ£º

linuxmi@linuxmi ~/www.linuxmi.com % sudo journalctl -u systemd-resolved > ~/cache.txtlinuxmi@linuxmi ~/www.linuxmi.com

µÇ¼ºó¸´ÖÆ

È»ºó £¬Äú¿ÉÒÔʹÓà Vim µÈÎı¾±à¼­Æ÷Éó²éÎļþµÄÄÚÈÝ£º

ÔÚÎļþÖÐ £¬ËÑË÷¡°CACHE£º¡± £¬ÒªÁìÊÇ°´ Escape £¬¼üÈë¡°/CACHE£º¡± £¬È»ºó°´ Enter ¼ü¡£ÔÚ¡°CACHE£º¡±Ï·½ÁгöµÄËùÓÐ DNS ¼Í¼¶¼°üÀ¨ÔÚÍâµØ DNS »º´æÖС£ÈôÄúÔÚʹÓà Vim £¬Çë°´Ï n ¼üÒÔÌøתÖÁÏÂÒ»×é DNS ÌõÄ¿¡£

Éó²é nscd µÄÍâµØ DNS »º´æ

ÒªÉó²é nscd ÌìÉúµÄÍâµØ»º´æ £¬ÄúÐèҪʹÓà string ÏÂÁî¶ÁÈ¡ nscd Ö÷»úÊý¾Ý¿âµÄÄÚÈÝ¡£

ÔÚ»ùÓÚ Debian ºÍ Ubuntu µÄ¿¯ÐаæÉÏ £¬´ËÎļþλÓÚ /var/cache/nscd/hosts¡£ÔËÐÐÒÔÏÂÏÂÁîÒÔÉó²éÎļþ£º

linuxmi@linuxmi ~/www.linuxmi.com % sudo strings /var/cache/nscd/hosts | uniq

µÇ¼ºó¸´ÖÆ

ÔõÑùÔÚ Linux ÉÏÉó²éºÍˢРDNS »º´æ

ÒªÉó²éÓÐ¹Ø nscd DNS ¸ßËÙ»º´æµÄÒ»Ñùƽ³£Í³¼ÆÐÅÏ¢ £¬ÇëʹÓà-g ±ê¼Ç£º

linuxmi@linuxmi ~/www.linuxmi.com % sudo nscd -g

µÇ¼ºó¸´ÖÆ

ÔõÑùÔÚ Linux ÉÏÉó²éºÍˢРDNS »º´æ

ÏÔʾÓÉ dnsmasq ÌìÉúµÄ DNS »º´æ

»ñÈ¡È·Çеļͼ²¢½ûÖ¹Ò× £¬ÓÉÓÚ dnsmasq ÔÚÄÚ´æÖд洢 DNS »º´æ¡£Äú¿ÉÒÔ·¢ËÍÖÕÖ¹ÐźŸø dnsmasq ²¢¼Í¼ÆäÊä³ö £¬ÒÔ»ñÈ¡´¦ÀíµÄ DNS ÅÌÎÊÊýÄ¿¡£

Ϊ´Ë £¬Ê×ÏÈ £¬Ê¹Óàsystemctl ÏÂÁîÈ·±£ dnsmasq ÒÑÆô¶¯²¢ÕýÔÚÔËÐУº

linuxmi@linuxmi ~/www.linuxmi.com % sudo systemctl status dnsmasq

µÇ¼ºó¸´ÖÆ

ÔõÑùÔÚ Linux ÉÏÉó²éºÍˢРDNS »º´æ

ÈôÊÇ״̬ÏÔʾ¡°Ô˶¯ Active¡± £¬ÇëÔËÐÐÒÔÏÂÏÂÁîÒÔÖÕÖ¹¸ÃЧÀÍ£º

linuxmi@linuxmi ~/www.linuxmi.com % sudo pkill -USR1 dnsmasq

µÇ¼ºó¸´ÖÆ

ÔõÑùÔÚ Linux ÉÏÉó²éºÍˢРDNS »º´æ

ʹÓà journalctl ÏÂÁî £¬ÌáÈ¡ dnsmasq ÈÕÖ¾²¢½«ËüÃÇÉúÑĵ½Îı¾ÎļþÖУº

linuxmi@linuxmi ~/www.linuxmi.com % sudo journalctl -u dnsmasq > ~/cache.txt

µÇ¼ºó¸´ÖÆ

×îºó £¬Ê¹ÓÃÎļþÉó²éÊÊÓóÌÐò£¨Èç cat »ò¸üÉÙ£©Éó²éÎļþµÄÄÚÈÝ£º

linuxmi@linuxmi ~/www.linuxmi.com % cat ~/cache.txt

µÇ¼ºó¸´ÖÆ

ÔõÑùÔÚ Linux ÉÏÉó²éºÍˢРDNS »º´æ

ÔõÑùÔÚ Linux ÉÏˢРDNS »º´æ

ˢРDNS »º´æÒâζ×Å´ÓÅÌËã»úÖÐɾ³ý»º´æµÄ DNS ¼Í¼¡£Õ⽫ÆÈʹËüÏòDNSЧÀÍÆ÷·¢ËÍÇëÇó £¬ÒÔ»ñȡеÄDNSÌõÄ¿¡£

ÒÔÏÂÊÇÔÚ Linux ÉÏˢРDNS »º´æµÄÒªÁ죺

ʹÓà systemd ÆÊÎö

Äú¿ÉÒÔʹÓà resolvectl ÏÂÁîˢРsystemd ÆÊÎö´æ´¢µÄ DNS »º´æ£º

linuxmi@linuxmi ~/www.linuxmi.com % sudo resolvectl flush-caches

µÇ¼ºó¸´ÖÆ

ÔõÑùÔÚ Linux ÉÏÉó²éºÍˢРDNS »º´æ

ÈôÊÇÄúÔËÐеÄÊÇ Ubuntu 17.04 »ò 18.04 £¬ÇëʹÓà systemd ÆÊÎöµÄÏÂÁîˢлº´æ£º

sudo systemd-resolved --flush-caches

µÇ¼ºó¸´ÖÆ

ÔÚ Linux ÉÏˢРnscd DNS »º´æ

ɾ³ý nscd µÄ DNS »º´æµÄ×î±ã½ÝÒªÁìÊÇÖØÐÂÆô¶¯Ð§ÀÍ¡£Äú¿ÉÒÔͨ¹ýÔËÐÐÒÔÏÂÏÂÁîÀ´Ö´Ðд˲Ù×÷£º

linuxmi@linuxmi ~/www.linuxmi.com % sudo /etc/init.d/nscd restart

µÇ¼ºó¸´ÖÆ

ÔõÑùÔÚ Linux ÉÏÉó²éºÍˢРDNS »º´æ

ÈôÊÇÕâ²»Æð×÷Óà £¬Ê×ÏÈ £¬¼ì²é´æ´¢ÔÚPCÉϵÄÍâµØ»º´æÊÇ·ñ³¤ÆÚ¡£Äú¿ÉÒÔʹÓà-g ±ê¼Ç¾ÙÐÐÑéÖ¤£º

sudo nscd -g

µÇ¼ºó¸´ÖÆ

ÈôÊÇÊÇÕâÖÖÇéÐÎ £¬ÇëʹÓôøÓÐ nscd ÏÂÁîµÄ ¨Ci ±ê¼ÇÀ´É¨³ý¼Í¼£¨i ´ú±í invalidate£©£º

linuxmi@linuxmi ~/www.linuxmi.com % sudo nscd -i hosts

µÇ¼ºó¸´ÖÆ

ɾ³ý dnsmasq DNS »º´æ

ˢРdnsmasq ÌìÉúµÄ DNS »º´æºÜ¼òÆÓ¡£ÓÉÓÚ»º´æ´æ´¢ÔÚÄÚ´æÖÐ £¬Òò´ËÖØÐÂÆô¶¯Ð§ÀÍ»áɾ³ýËùÓд洢µÄÌõÄ¿¡£

ÒªÖØÐÂÆô¶¯ dnsmasq £¬ÇëÔËÐÐÒÔÏ systemctl ÏÂÁ

sudo systemctl restart dnsmasq

µÇ¼ºó¸´ÖÆ

»òÕß £¬·¢³öÒÔÏÂÏÂÁ

service dnsmasq restart

µÇ¼ºó¸´ÖÆ

ÈôÊÇ·ºÆðÌáÐÑ £¬ÇëÊäÈëÖÎÀíÔ±ÃÜÂë¡£ÏÖÔÚÒªÖØÐÂÆô¶¯ dnsmasq £¬ËùÓлº´æÖб£´æµÄ DNS ÌõÄ¿½«±»É¨³ý¡£

½¨ÒéˢРDNS »º´æºó £¬¼ì²éÍâµØ»º´æÌõÄ¿ÒÔÈ·ÈÏÊý¾ÝÒѾ­ÀÖ³Éɾ³ý¡£Äú¿ÉÒÔʹÓà Linux ÏÂÁîÖ®Ò»µÄ dig À´¾ÙÐÐÍøÂç¹ÊÕÏɨ³ý £¬²¢Éó²éÊä³öÖеġ°ÅÌÎÊʱ¼ä¡±Öµ¡£ÈôÊÇÁè¼Ý 0 ºÁÃë £¬Ôò˵Ã÷»º´æÒѾ­ÀÖ³Éɨ³ý£¨ÈôΪ 0 ºÁÃë £¬ÔòÌåÏÖÓò¼Í¼ÈÔ±£´æÓÚ»º´æÖУ©¡£

dig google.com

µÇ¼ºó¸´ÖÆ

ɨ³ý¹È¸èä¯ÀÀÆ÷µÄDNS»º´æ

Äú¾­³£Ê¹ÓÃµÄ Web ä¯ÀÀÆ÷Ò²»á»º´æ DNS ¼Í¼¡£ÊäÈë URL ʱ £¬ÏµÍ³»áÔÚÍâµØä¯ÀÀÆ÷»º´æÖÐËÑË÷»º´æÌõÄ¿¡£ÈôÊÇδÕÒµ½ £¬Ëü½«¼ì²éÍâµØϵͳ»º´æÖеļͼ¡£É¨³ý Web ä¯ÀÀÆ÷µÄ DNS »º´æºÜÊÇÖ÷Òª £¬ÓÉÓÚËüÓÅÏÈÓÚϵͳ¹æÄ£µÄ»º´æ¡£

ΪÁËÑÝʾ £¬ÈÃÎÒÃÇˢйȸèä¯ÀÀÆ÷ÖеÄDNS»º´æ¡£ÔÚÆäËûä¯ÀÀÆ÷ÉÏÒ²ÓÐһЩҪÁì¿ÉÒÔ×öµ½ÕâÒ»µã £¬ÒÔÊÇ×îºÃ Google Ò»ÏÂÔõÑùʹÓÃÄãʹÓõÄä¯ÀÀÆ÷×öµ½ÕâÒ»µã¡£

Ê×ÏÈ £¬ÔÚURLÀ¸ÖмüÈë¡°chrome://net-internals/#dns¡±²¢°´Enter¼ü£º

ÔõÑùÔÚ Linux ÉÏÉó²éºÍˢРDNS »º´æ

µã»÷¡°É¨³ýÖ÷»ú»º´æ¡±°´Å¥À´É¨³ý¹È¸èä¯ÀÀÆ÷Öд洢µÄDNSÌõÄ¿¡£

LinuxÊÇѧϰÍøÂçµÄ×î¼Ñ²Ù×÷ϵͳ

Linux Õ§Ò»¿´¿ÉÄÜ¿´ÆðÀ´ºÜÖØ´ó £¬µ«ÈôÊÇÄ㻨һЩʱ¼äÀ´Ñ§Ï°ËüÊÇÔõÑùÊÂÇéµÄ £¬ÄãºÜ¿ì¾Í»áÒâʶµ½ËüºÜ°ô £¬ÉõÖÁ¿ÉÄÜ±È Windows »ò macOS ¸üºÃ¡£

´ó´ó¶¼ÔÚÏßЧÀÍÆ÷¶¼ÔËÐÐ Linux £¬ÈôÊÇÄúÏëѧϰÍøÂç»òÏëÖªµÀÅÌËã»úͨ³£ÔõÑùÊÂÇé £¬ÕâÒ²ÊÇ Linux ÀíÏëÑ¡ÔñµÄÔµ¹ÊÔ­ÓÉÖ®Ò»¡£

ÒÔÉϾÍÊÇÔõÑùÔÚ Linux ÉÏÉó²éºÍˢРDNS »º´æµÄÏêϸÄÚÈÝ £¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

ÃâÔð˵Ã÷£ºÒÔÉÏչʾÄÚÈÝȪԴÓÚÏàÖúýÌå¡¢ÆóÒµ»ú¹¹¡¢ÍøÓÑÌṩ»òÍøÂçÍøÂçÕûÀí £¬°æȨÕùÒéÓë±¾Õ¾ÎÞ¹Ø £¬ÎÄÕÂÉæ¼°¿´·¨Óë¿´·¨²»´ú±í尊龙凯时人生就是博ÂËÓÍ»úÍø¹Ù·½Ì¬¶È £¬Çë¶ÁÕß½ö×ö²Î¿¼¡£±¾ÎĽӴýתÔØ £¬×ªÔØÇë˵Ã÷À´ÓÉ¡£ÈôÄúÒÔΪ±¾ÎÄÇÖÕ¼ÁËÄúµÄ°æȨÐÅÏ¢ £¬»òÄú·¢Ã÷¸ÃÄÚÈÝÓÐÈκÎÉæ¼°ÓÐÎ¥¹«µÂ¡¢Ã°·¸Ö´·¨µÈÎ¥·¨ÐÅÏ¢ £¬ÇëÄúÁ¬Ã¦ÁªÏµ尊龙凯时人生就是博ʵʱÐÞÕý»òɾ³ý¡£

Ïà¹ØÐÂÎÅ

ÁªÏµ尊龙凯时人生就是博

18523999891

¿É΢ÐÅÔÚÏß×Éѯ

ÊÂÇéʱ¼ä£ºÖÜÒ»ÖÁÖÜÎå £¬9:30-18:30 £¬½ÚãåÈÕÐÝÏ¢

QR code
sitemap¡¢ÍøÕ¾µØͼ