【问题标题】:ffmpeg with double ethernet interfaces works wrong具有双以太网接口的 ffmpeg 工作错误
【发布时间】:2012-05-22 08:38:33
【问题描述】:

具有双接口的服务器。

  1. One(eht0) 用于为互联网用户提供 http/ssh 服务的 WAN。

  2. other(eth1)用于接收内网组播数据。

218.108.132.177是公网网关。

125.210.198.1 是私网网关。

233.49.3.*/24 是多播地址。

10.0.11.*/24 是组播数据的来源。

当路由表如下图时,ffmpeg无法从eth1读取udp数据,ffmpeg挂了:

rrca@rcasnap02:~$ route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
218.108.132.176 *               255.255.255.252 U     0      0        0 eth0
125.210.198.0   *               255.255.255.240 U     0      0        0 eth1
default         218.108.132.177 0.0.0.0         UG    100    0        0 eth0
default         125.210.198.1   0.0.0.0         UG    100    0        0 eth1

rrca@rcasnap02:~$ route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
218.108.132.176 *               255.255.255.252 U     0      0        0 eth0
125.210.198.0   *               255.255.255.240 U     0      0        0 eth1
default         218.108.132.177 0.0.0.0         UG    100    0        0 eth0
10.0.11.0       125.210.198.1   0.0.0.0         UG    100    0        0 eth1

rrca@rcasnap02:~$ route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
218.108.132.176 *               255.255.255.252 U     0      0        0 eth0
125.210.198.0   *               255.255.255.240 U     0      0        0 eth1
default         218.108.132.177 0.0.0.0         UG    100    0        0 eth0
233.49.3.0      125.210.198.1   255.255.255.0   UG    100    0        0 eth1

我想让ffmpeg正常工作,但是现在我认为路由表中的两个默认路由互相干扰,我试试,当公共网关路由被删除,或者私有网关路由在公共的头部默认网关路由,ffmpeg 运行良好,我认为它从 eth1 读取多播。但路由表不是这样,ffmpeg 无法从 eth1 读取数据,我认为它读取 eth0(不是私有网络接口)上的数据。

如何做到ffmpeg同时与两个接口很好的工作?

【问题讨论】:

    标签: linux ffmpeg multicast


    【解决方案1】:

    您需要为多播流量配置正确的路由。内核对所有传入的多播流量进行来源检查:如果它到达与用于发送此类流量的接口不同的接口,则将其丢弃。

    只需在 eth1 接口上设置多播路由即可:

    # route add -net 224.0.0.0/8 dev eth1
    

    或者,禁用原点检查:

    # echo 0 > /proc/sys/net/ipv4/conf/eth1/rp_filter
    

    【讨论】:

    • 感谢您的回答。我添加了路由,并将值回显到 rp_filter,但效果不佳。
    • 我修好了。我需要删除默认路由 125.0.0.0 并同时添加 10.0.0.0 和 233.0.0.0。
    【解决方案2】:

    虽然答案是正确的,因为需要路由,但我必须路由 224.0.0.0/4(最多包括 239.255.255.255),因为我的设备正在将视频流发送到 239.255 .42.42

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-08-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多