http://blog.chinaunix.net/uid-27105712-id-3792255.html
2013
混雜模式在一些網(wǎng)絡(luò)嗅探工具很常見,本文以“如何探測某臺機器是否開啟混雜模式?”這個問題出發(fā),逐漸展開對混雜模式的介紹。
首先,linux下如何開啟混雜模式? 我所知道的有兩種方式:
1、ifconfig . 使用man ifconfig 幫助可以看到
[-]promisc
Enable or disable the promiscuous mode of the interface. If selected, all packets on the network will be received by the interface.
ip link set DEVICE { up | down | arp { on | off } |
promisc { on | off } |
allmulticast { on | off } |
dynamic { on | off } |
multicast { on | off } |
txqueuelen PACKETS |
name NEWNAME |
address LLADDR | broadcast LLADDR |
mtu MTU |
netns PID |
alias NAME |
vf NUM [ mac LLADDR ] [ vlan VLANID [ qos VLAN-QOS ] ] [ rate TXRATE ] }
eth1: <BROADCAST,MULTICAST,PROMISC,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:0c:29:78:9c:1d brd ff:ff:ff:ff:ff:ff
Iface MTU Met RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg
eth1 1500 0 246689 0 0 0 87535 0 0 0 BMPRU
lo 16436 0 40 0 0 0 40 0 0 0 LRU
struct pack
{
unsigned char h_dest[ETH_ALEN];//目標mac地址,填寫FF:FF:FF:FF:FF:FE
unsigned char h_source[ETH_ALEN];//源mac地址,及發(fā)送者本機mac
unsigned short h_proto;//以太網(wǎng)包的類型,0x0806 arp或者 0x0800 ip包
..... //arp 或 ip 包內(nèi)容
}