ºìÁªLinuxÃÅ»§
Linux°ïÖú

¹ØÓÚÍøÂçÊý¾Ý±¨£¨skb£©ÖеÄÄ¿µÄipµØÖ·µÄÎÊÌâ

·¢²¼Ê±¼ä:2009-09-01 12:05:14À´Ô´:ºìÁª×÷Õß:sihu123
ÎÒ×Ô¼ºÐ´Á˸öÔÚkvmÐéÄâ»úÖÐÔËÐеÄÇý¶¯£¬Õâ¸öÇý¶¯¿ÉÒÔαװ³ÉÒ»¿éÍø¿¨ÏòÍâ½ç·¢Ëͱ¨ÎÄ£¬Á½¸ölinuxÐéÄâ»ú¿ÉÒÔͨ¹ýÕâ¸öÇý¶¯À´Ï໥ͨÐÅ£¬Á½¸öÐéÄâ»úÏ໥ͨÐÅÊÇûÓÐÎÊÌâµÄ£¨ping£¬sshÃüÁÊÇ¿ÉÒԵģ©£¬ÕâÁ½¸öÐéÄâ»ú×é³ÉÒ»¸öÐéÄâ¾ÖÓòÍø£¬¶þÕßͨ¹ýÔÚÄÚ´æÖп½±´Êý¾ÝÀ´Ä£ÄâÊý¾ÝÔÚÍøÂçÉϵĴ«µÝ¡£
ÏÖÔÚÎÒÓöµ½Ò»¸öÎÊÌ⣺A £¨192.168.111.1£©ping B(192.168.111.2)£¬ÔÚA·¢Ëͱ¨ÎÄ֮ǰÎÒʹÓÃip_hdr(skb)->daddr(saddr) »ñµÃ±¨ÎÄÖеÄÄ¿µÄ(Ô´)ipµØÖ·£¬ÊÇÕýÈ·µÄ£»ÔÚBÖн«Êý¾ÝÖØ×é³Éskbºó£¬netif_rx_ni()֮ǰÓÃͬÑùµÄ·½Ê½»ñµÃ±¨ÎÄÖеÄÄ¿µÄ£¨Ô´£©ipµØÖ·£¬·¢ÏÖÊÇÀïÃæµÄµØÖ·ÊDz»ÕýÈ·µÄ£¬µ«ÊÇÓÃwiresharkµÈ¹¤¾ß½Ø»ñµÄ±¨ÎÄÖеÄÄ¿µÄipµØÖ·¶¼ÊÇÕýÈ·µÄ£¬ÓôÃÆ£¡
ÔÚAºÍBÖÐÌáÈ¡Ä¿µÄipµØÖ·µÄ·½·¨¶¼ÊÇÒ»ÑùµÄ£¬ÊÇÎÒÔÚBÖÐÌáÈ¡ipµØÖ·µÄλÖò»¶ÔÂ𣬵«ÊÇnetif_rx_niÒѾ­ÊÇÄں˺¯ÊýÁË£¬ÕæÕýµÄÓ²¼þÍø¿¨½ÓÊÕµ½Êý¾Ý»¹Òª³ÉskbºóÒ²Êǽ»¸ønetif_rx ´¦ÀíµÄ°¢¡£²»ÖªµÀÄÄλ¸ßÈË¿ÉÒÔ°ïÎÒ½â¾öÕâ¸öÎÊÌâ¡£
»¹ÓÐÒ»¸öÎÊÌ⣺Èç¹ûA ping 192.168.111.3£¨²»´æÔÚµÄipµØÖ·£©µÄ»°£¬ÄÇôÎÒËù½â³öÀ´µÄÄ¿µÄipµØÖ·Ò²²»ÊÇ192.168.111.3£¬¶øÊÇÆäËûµÄÊý¾Ý£¬²»ÖªµÀÊÇÔõô»ØÊ£¿
¼±ÇÐÑ°Çó°ïÖú
ÎÄÕÂÆÀÂÛ

¹²ÓÐ 1 ÌõÆÀÂÛ

  1. sihu123 ÓÚ 2009-09-03 14:14:33·¢±í:

    ÓÐûÓÐÕâ·½ÃæµÄ¸ßÊÖ°¢£¬´ó¼ÒË­À´°ï°ïÎÒ°¢£¡