我试图在本地网络上嗅探所有IGMP消息(出于不可讨论的疯狂原因;-)。我有一些与此相关的问题,因为我并不是一个IGMP/路由专家。
有可能吗?我知道我可以从原始的套接字中读取IGMP,我知道您可以使用Wireshark来监视到达本地计算机的IGMP消息,但让我困惑的是:
我在另一台计算机上使用一个程序(从运行Wireshark的计算机中分离出来),它将加入一个多播地址--但是--我甚至不总是在Wireshark中看到成员报告/加入。现在,有没有人知道是否保证每个IGMP连接都分布在整个本地网络上?有时我看到Wireshark的加入,有时我没有。
假设所有IGMP连接消息总是发送到网络上的每个站点,难道不应该监视哪些站点是这样做的多播组的成员(posix c++代码):
int rawSock = ::socket(AF_INET, SOCK_RAW, IPPROTO_IGMP);
uint8_t buf[10*1024];
while(true)
{
ssize_t rval = ::recv(rawSock, buf, sizeof(buf), 0);
iphdr *iph = (iphdr*)buf;
printf("Received %d bytes - protocol %d\n", rval, iph->protocol);
/*do whatever needed to the IGMP message*/
} 发布于 2011-10-26 11:28:55
你的问题可能是..。每个IGMP数据包都必须有一个IP TTL=1,这意味着IGMP永远不会跨越路由边界(例如vlan)。
来自RFC 2236 - IGMP版本2
Like ICMP, IGMP is a integral part of IP. It is required to be
implemented by all hosts wishing to receive IP multicasts. IGMP
messages are encapsulated in IP datagrams, with an IP protocol number
of 2. All IGMP messages described in this document are sent with IP
TTL 1, and contain the IP Router Alert option [RFC 2113] in their IP
header.这意味着您不能在任何地方看到IGMP;您应该检查上面的IGMP接收器是否在与发送方相同的IP子网上。您还可以检查您的机器是否正在使用tshark或wireshark接收IGMP .
https://stackoverflow.com/questions/7899471
复制相似问题