Windows下傳統的抓包工具如Wireshark/Ethereal不能對本地程式之間的網路通訊抓包,一些商業抓包工具使用Winsock LSP (Layered Service Provider)技術實現了本地程式之間的網路通訊抓包。如果即想要對本地通訊進行抓包又要使用Wireshark/Ethereal就要費一番周折了。
http://wiki.wireshark.org/CaptureSetup/Loopback
詳細介紹了如何操作。實際操作其實很簡單,共分5步:
1 按照這個http://support.microsoft.com/kb/839013
網址中介紹安裝loopback網卡驅動。
2 3 給新網卡設定IP地址,比如設定為192.168.0.100,子網路遮罩設定為255.255.255.0
3 在命令列中查看新網卡的MAC地址 ipconfig /all
Ethernet adapter 本地串連 2:
Connection-specific DNS Suffix . :
Description . . . . . . . . . . . : Microsoft Loopback Adapter
Physical Address. . . . . . . . . : 02-00-4C-4F-4F-50
Dhcp Enabled. . . . . . . . . . . : No
IP Address. . . . . . . . . . . . : 192.168.0.100
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . :
4 添加ARP綁定,比如 arp –s 192.168.0.100 02-00-4C-4F-4F-50
5 添加路由,比如 route add 192.168.0.100 mask 255.255.255.255 192.168.0.100
然後在ping 192.168.0.100的同時抓包,抓包的時候選擇新安裝的loopback網卡。就這麼簡單!