在具有多个接口的服务器上接收多播(Linux) [英] receiving multicast on a server with multiple interfaces (linux)

查看:106
本文介绍了在具有多个接口的服务器上接收多播(Linux)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

要在非默认NIC(dvb)上接收多播,请执行以下操作:

To receive a multicast on my not default NIC (dvb) I do the following:

  • 打开一个套接字(AF_INET,SOCK_DGRAM)
  • 在dvb接口上通过IP_ADD_MEMBERSHIP加入多播地址
  • 绑定多播地址(请注意,常见的错误是绑定"0.0.0.0",然后在该套接字上接收甚至不感兴趣的多播)和端口

这时,接收所需多播数据包的唯一方法是在路由表中添加一条规则,以通过dvb到达发件人所在的网络(另一个网络),就像dvb需要回复多播一样发件人假设一种源发送方多播模式.有人知道发生了什么吗?这个问题使我很烦,因为原则上我不知道发件人的ip.

at this point the only way to receive the needed multicast packets is to add in the routing table a rule to reach the network where the sender is (another network) trough the dvb, as if the dvb needs to reply to the multicast sender; let say a sort of source sender multicast mode. Anyone knows what is going on? The problem is annoying to me because in principle I don't know the ip of sender.

推荐答案

您似乎被rp_filter反向路径过滤所困扰.如果数据包到达没有源地址路由的接口,则会丢弃数据包.

You appear to be being stung by rp_filter reverse-path filtering. This drops packets if they arrive on an interface that doesn't have a route for the source address.

您可以使用sysctl /proc/sys/net/ipv4/conf/<if>/rp_filter在每个接口上禁用它.

You can disable it on a per-interface basis with the sysctl /proc/sys/net/ipv4/conf/<if>/rp_filter.

这篇关于在具有多个接口的服务器上接收多播(Linux)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆