未配置组播地址,网卡会收到数据

未配置组播地址,网卡会收到数据,第1张

不会。在Linux下没有添加对应组播路由的情况时,是无法用程序收到组播数据的,所以未配置组播地址,网卡是不会收到数据。网卡是什么计算机与外界局域网的连接是通过主机箱内插入一块网络接口板。

What does "IP_ADD_MEMBERSHIP: No such device" mean?

It means that the tool is trying to use multicast but the network interface doesn't support it There are two likely causes:

·Your machine doesn't have multicast support enabled. For example, on Linux and FreeBSD it is possible to compile a kernel which doesn't support multicast.

·You don't have a route for multicast traffic. Some systems don't add this by default, and you need to run:

route add -net 224.0.0.0 netmask 224.0.0.0 eth0(or similar). If you wish to use RAT in unicast mode only, it is possible to add the multicast route on the loopback interface.

我一般都这样写:

mreq.imr_interface.s_addr = htonl(localIP)

因为你用route命令添加的路由表不会保存到一次重启,虽然你查看得到,你可以写到启动脚本里去。

编辑/etc/init.d/network,在未尾加上下面几行:

# Add non interface-specific static-routes.

if [ -f /etc/sysconfig/static-routes ]then

grep "^any" /etc/sysconfig/static-routes | while read ignore args do

/sbin/route add -$args

done

fi

编辑/etc/sysconfig/static-routes:

any net 224.0.0.101 netmask 255.255.255.255 dev eth0

any net 224.0.0.110 netmask 255.255.255.255 dev eth1

any net 244.0.0.111 netmask 255.255.255.255 dev eth3

any net 244.14.0.112 netmask 255.255.255.255 dev eth2


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/yw/8719815.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-20
下一篇 2023-04-20

发表评论

登录后才能评论

评论列表(0条)

保存