ѧ»áʹÓÃLinuxÏÂÁî²éÕÒDHCP°üµÄÒªÁì¡£
[ÎÊÌâ]£ºÑ§»áʹÓÃLinuxÏÂÁî²éÕÒDHCP°üµÄÒªÁì
DHCP£¨¶¯Ì¬Ö÷»úÉèÖÃÐÒ飩ÊÇÒ»ÖÖÍøÂçÐÒ飬ÓÃÓÚÔÊÐí×°±¸×Ô¶¯»ñÈ¡IPµØµãºÍÆäËûÍøÂçÉèÖÃÐÅÏ¢¡£ÔÚÍøÂç¹ÊÕÏÅŲé»òÍøÂçÇå¾²ÎÊÌâÆÊÎöÖУ¬²éÕÒºÍÆÊÎöDHCP°üÊÇÒ»ÏîÖ÷ÒªµÄÊÂÇé¡£±¾ÎĽ«ÏÈÈÝÔõÑùʹÓÃLinuxÏÂÁîÀ´²éÕÒDHCP°üµÄÒªÁ죬²¢ÌṩÏêϸµÄ´úÂëʾÀý¡£
1. ʹÓÃtcpdumpÏÂÁî²éÕÒDHCP°ü
tcpdumpÊÇÒ»¸öÍøÂç°üÆÊÎö¹¤¾ß£¬¿ÉÒÔ²¶»ñÍøÂçÊý¾Ý°ü²¢ÏÔʾÆäÄÚÈÝ¡£Òª²éÕÒDHCP°ü£¬¿ÉÒÔʹÓÃÈçÏÂÏÂÁ
sudo tcpdump -i [½Ó¿ÚÃû] udp port 67 or udp port 68
µÇ¼ºó¸´ÖÆ
ÆäÖУ¬-i²ÎÊýÖ¸¶¨Òª¼àÌýµÄÍøÂç½Ó¿Ú£¬udp port 67ÌåÏÖ¼àÌýÄ¿µÄ¶Ë¿ÚΪ67µÄudpÊý¾Ý°ü£¨DHCPЧÀÍÆ÷ʹÓõĶ˿ڣ©£¬udp port 68ÌåÏÖ¼àÌýÄ¿µÄ¶Ë¿ÚΪ68µÄudpÊý¾Ý°ü£¨DHCP¿Í»§¶ËʹÓõĶ˿ڣ©¡£
ʾÀý£º
sudo tcpdump -i eth0 udp port 67 or udp port 68
µÇ¼ºó¸´ÖÆ
ÒÔÉÏÏÂÁÔÚ½Ó¿Úeth0ÉϼàÌýDHCP°üµÄ´«ÊäÇéÐΣ¬²¶»ñµ½µÄ°ü½«ÏÔʾÔÚÖÕ¶ËÉÏ¡£¿ÉÒÔƾ֤²¶»ñµ½µÄ°üÄÚÈÝÀ´ÆÊÎöDHCPÇëÇóºÍÓ¦´ðÇéÐΡ£
2. ʹÓÃWiresharkͼÐνçÃ湤¾ß²éÕÒDHCP°ü
³ýÁËÏÂÁîÐй¤¾ßtcpdump£¬WiresharkÊÇÒ»¸ö¹¦Ð§Ç¿Ê¢µÄͼÐνçÃæÍøÂç°üÆÊÎö¹¤¾ß£¬ÌṩÁ˸üÖ±¹ÛµÄÆÊÎö½çÃæºÍ¹¦Ð§¡£
·¿ªWireshark£¬Ñ¡ÕªÒª¼àÌýµÄÍøÂç½Ó¿Ú£¬È»ºóÔÚ¹ýÂËÆ÷ÖÐÊäÈë”udp.port==67 or udp.port==68″£¬µã»÷×îÏȲ¶»ñ°´Å¥£¬¾Í¿ÉÒÔ×îÏȲ¶»ñDHCP°üµÄÄÚÈÝ¡£
ͨ¹ýWireshark£¬¿ÉÒÔ¸üÇåÎúµØÉó²é²¶»ñµ½µÄDHCP°üµÄÏêϸÐÅÏ¢£¬ÈçÔ´IPµØµã¡¢Ä¿µÄIPµØµã¡¢DHCPÐÂÎÅÀàÐ͵ȣ¬²¢¿ÉÒÔ¾ÙÐиüÖØ´óµÄ°üÆÊÎöºÍ¹ýÂ˲Ù×÷¡£
3. ¿ÉÄÜÓöµ½µÄÎÊÌâ¼°½â¾öÒªÁì
ÔÚʹÓÃÉÏÊöÒªÁì²éÕÒDHCP°üʱ£¬¿ÉÄÜ»áÓöµ½Ò»Ð©ÎÊÌ⣬ºÃ±ÈÎÞ·¨²¶»ñµ½ÆÚÍûµÄDHCP°ü¡¢²¶»ñµ½µÄ°üÄÚÈݲ»ÇåÎúµÈ¡£Õë¶ÔÕâЩÎÊÌ⣬¿ÉÒÔʵÑéÒÔϽâ¾öÒªÁ죺
È·±£ÍøÂç½Ó¿ÚÕý³£ÊÂÇ飺¼ì²éÍøÂç½Ó¿ÚÊÇ·ñÕý³£ÅþÁ¬£¬ÊÇ·ñÕý³£ÊÂÇ飻
È·±£È¨ÏÞ׼ȷ£ºÔÚʹÓÃtcpdumpÏÂÁîʱ£¬ÐèÒªÒÔroot»ò¾ßÓÐÏìӦȨÏÞµÄÓû§ÔËÐУ»
µ÷½â¹ýÂ˹æÔò£ºÆ¾Ö¤ÏêϸÇéÐε÷½â¹ýÂ˹æÔò£¬°üÀ¨¶Ë¿ÚºÅ¡¢Ä¿µÄIPµØµãµÈ£»
ÆÊÎö²¶»ñµ½µÄ°üÄÚÈÝ£º×ÐϸÆÊÎö²¶»ñµ½µÄ°üÄÚÈÝ£¬Éó²éÊÇ·ñÇкÏÔ¤ÆÚ£¬²¢ÆÊÎöÆäÖеÄÎÊÌâ¡£
ͨ¹ýÉÏÊöÒªÁìÏ¢Õù¾ö¼Æ»®£¬¿ÉÒÔÓÐÓõØʹÓÃLinuxÏÂÁî²éÕÒDHCP°ü£¬²¢¾ÙÐÐÍøÂç¹ÊÕÏÅŲéºÍÆÊÎöÊÂÇé¡£ÕÆÎÕÕâЩҪÁì¹ØÓÚÍøÂçÖÎÀíºÍÇå¾²ÆÊÎöºÜÊÇÖ÷Òª£¬Ï£Íû±¾ÎÄÄÜ×ÊÖú¶ÁÕ߸üºÃµØÃ÷È·ºÍÓ¦Óá£
ÒÔÉϾÍÊÇѧ»áʹÓÃLinuxÏÂÁî²éÕÒDHCP°üµÄÒªÁì¡£µÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡