我的ISP提供IPTV功能,流示例:udp://@239.255.2.97:5500
。我想在 macOS 上观看 IPTV,所以我使用了 VLC。
最初,IPTV根本不起作用。起初我以为它以某种方式锁定到 ISP 的媒体盒。然后我在各种设备上进行了测试,它在任何地方都可以工作:运行 Windows 的同一台 Mac、Apple TV、Redmi 手机和各种 iOS 设备。经过一番谷歌搜索后我发现解决方案:sudo sysctl net.inet.igmp.sendra=0
在终端中执行使VLC播放流。 (不需要强制默认版本为 2)
但后来我注意到流在 04:20 ±1 秒后停止,只有重新启动流才能再次播放。在上述任何其他设备/平台上都不会发生这种情况。我有 2 台 Mac - mbp 运行 Mojave(SIP 关闭)和 mini 运行 Catalina(SIP 打开)——两者都发生,有线/无线连接以及使用的软件没有区别(尝试过 VLC 和 Kodi)。
我完全不知道如何解决这个问题,而且在互联网上也找不到任何相关信息,非常感谢您的帮助。
我会提供您需要的任何信息,最好请发布必要的命令来获取所需的信息。
两台 Mac 上的默认 IGMP 设置相同:
❯ sysctl net.inet.igmp
net.inet.igmp.recvifkludge: 1
net.inet.igmp.sendra: 1
net.inet.igmp.sendlocal: 1
net.inet.igmp.v1enable: 1
net.inet.igmp.v2enable: 1
net.inet.igmp.legacysupp: 0
net.inet.igmp.default_version: 3
net.inet.igmp.gsrdelay: 10
net.inet.igmp.debug: 0
ifconfig -a
如果有帮助的话,这是我的 Mac:
无线 MBP:
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
options=1203<RXCSUM,TXCSUM,TXSTATUS,SW_TIMESTAMP>
inet 127.0.0.1 netmask 0xff000000
inet6 ::1 prefixlen 128
inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1
nd6 options=201<PERFORMNUD,DAD>
gif0: flags=8010<POINTOPOINT,MULTICAST> mtu 1280
stf0: flags=0<> mtu 1280
EHC250: flags=0<> mtu 0
EHC253: flags=0<> mtu 0
en0: flags=8963<UP,BROADCAST,SMART,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
options=b<RXCSUM,TXCSUM,VLAN_HWTAGGING>
ether 58:b0:35:f4:e6:de
nd6 options=201<PERFORMNUD,DAD>
media: autoselect (none)
status: inactive
en1: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
ether 58:b0:35:7a:2f:13
inet6 fe80::108d:a3b7:c229:4e24%en1 prefixlen 64 secured scopeid 0x7
inet 192.168.1.69 netmask 0xffffff00 broadcast 192.168.1.255
inet6 2a00:1370:8131:b399:803:904:7e51:a50b prefixlen 64 autoconf secured
inet6 2a00:1370:8131:b399:7944:3d6c:3303:58b prefixlen 64 autoconf temporary
inet6 2a00:1370:8131:b399:f628:52b3:28ae:8d54 prefixlen 64 dynamic
nd6 options=201<PERFORMNUD,DAD>
media: autoselect
status: active
fw0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 4078
lladdr d8:30:62:ff:fe:f0:e9:aa
nd6 options=201<PERFORMNUD,DAD>
media: autoselect <full-duplex>
status: inactive
p2p0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 2304
ether 0a:b0:35:7a:2f:13
media: autoselect
status: inactive
utun0: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 2000
inet6 fe80::83e0:2ce2:8c0d:e1a7%utun0 prefixlen 64 scopeid 0xa
nd6 options=201<PERFORMNUD,DAD>
bridge100: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
options=3<RXCSUM,TXCSUM>
ether 5a:b0:35:4f:b0:64
inet 192.168.2.1 netmask 0xffffff00 broadcast 192.168.2.255
inet6 fe80::58b0:35ff:fe4f:b064%bridge100 prefixlen 64 scopeid 0xb
Configuration:
id 0:0:0:0:0:0 priority 0 hellotime 0 fwddelay 0
maxage 0 holdcnt 0 proto stp maxaddr 100 timeout 1200
root id 0:0:0:0:0:0 priority 0 ifcost 0 port 0
ipfilter disabled flags 0x2
member: en0 flags=3<LEARNING,DISCOVER>
ifmaxaddr 0 port 6 priority 0 path cost 0
nd6 options=201<PERFORMNUD,DAD>
media: <unknown type>
status: inactive
迷你有线:
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
options=1203<RXCSUM,TXCSUM,TXSTATUS,SW_TIMESTAMP>
inet 127.0.0.1 netmask 0xff000000
inet6 ::1 prefixlen 128
inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1
nd6 options=201<PERFORMNUD,DAD>
gif0: flags=8010<POINTOPOINT,MULTICAST> mtu 1280
stf0: flags=0<> mtu 1280
en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
options=50b<RXCSUM,TXCSUM,VLAN_HWTAGGING,AV,CHANNEL_IO>
ether 14:9d:99:7c:63:cc
inet6 fe80::ee:83f2:5357:c607%en0 prefixlen 64 secured scopeid 0x4
inet6 2a00:1370:8131:b399:4b6:9a5b:7712:e480 prefixlen 64 autoconf secured
inet6 2a00:1370:8131:b399:b837:ed92:a5dc:5859 prefixlen 64 autoconf temporary
inet6 2a00:1370:8131:b399:2846:2489:ad80:fc9b prefixlen 64 dynamic
inet 192.168.1.65 netmask 0xffffff00 broadcast 192.168.1.255
nd6 options=201<PERFORMNUD,DAD>
media: autoselect (1000baseT <full-duplex,flow-control>)
status: active
en6: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
ether ac:de:48:00:11:22
inet6 fe80::aede:48ff:fe00:1122%en6 prefixlen 64 scopeid 0x5
nd6 options=201<PERFORMNUD,DAD>
media: autoselect (100baseTX <full-duplex>)
status: active
ap1: flags=8802<BROADCAST,SIMPLEX,MULTICAST> mtu 1500
options=400<CHANNEL_IO>
ether 3e:22:fb:a8:1b:69
media: autoselect
status: inactive
en1: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
options=400<CHANNEL_IO>
ether 3c:22:fb:a8:1b:69
inet6 fe80::805:ed7:b180:94c0%en1 prefixlen 64 secured scopeid 0x7
inet 169.254.31.79 netmask 0xffff0000 broadcast 169.254.255.255
nd6 options=201<PERFORMNUD,DAD>
media: autoselect (<unknown type>)
p2p0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 2304
options=400<CHANNEL_IO>
ether 0e:22:fb:a8:1b:69
media: autoselect
status: inactive
awdl0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1484
options=400<CHANNEL_IO>
ether a6:cb:ac:da:de:6b
inet6 fe80::a4cb:acff:feda:de6b%awdl0 prefixlen 64 scopeid 0x9
nd6 options=201<PERFORMNUD,DAD>
media: autoselect
status: active
llw0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
options=400<CHANNEL_IO>
ether a6:cb:ac:da:de:6b
inet6 fe80::a4cb:acff:feda:de6b%llw0 prefixlen 64 scopeid 0xa
nd6 options=201<PERFORMNUD,DAD>
media: autoselect
status: active
en2: flags=8963<UP,BROADCAST,SMART,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
options=460<TSO4,TSO6,CHANNEL_IO>
ether 82:fa:d0:e2:c0:01
media: autoselect <full-duplex>
status: inactive
en3: flags=8963<UP,BROADCAST,SMART,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
options=460<TSO4,TSO6,CHANNEL_IO>
ether 82:fa:d0:e2:c0:00
media: autoselect <full-duplex>
status: inactive
en4: flags=8963<UP,BROADCAST,SMART,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
options=460<TSO4,TSO6,CHANNEL_IO>
ether 82:fa:d0:e2:c0:05
media: autoselect <full-duplex>
status: inactive
en5: flags=8963<UP,BROADCAST,SMART,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
options=460<TSO4,TSO6,CHANNEL_IO>
ether 82:fa:d0:e2:c0:04
media: autoselect <full-duplex>
status: inactive
bridge0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
options=63<RXCSUM,TXCSUM,TSO4,TSO6>
ether 82:fa:d0:e2:c0:01
Configuration:
id 0:0:0:0:0:0 priority 0 hellotime 0 fwddelay 0
maxage 0 holdcnt 0 proto stp maxaddr 100 timeout 1200
root id 0:0:0:0:0:0 priority 0 ifcost 0 port 0
ipfilter disabled flags 0x0
member: en2 flags=3<LEARNING,DISCOVER>
ifmaxaddr 0 port 11 priority 0 path cost 0
member: en3 flags=3<LEARNING,DISCOVER>
ifmaxaddr 0 port 12 priority 0 path cost 0
member: en4 flags=3<LEARNING,DISCOVER>
ifmaxaddr 0 port 13 priority 0 path cost 0
member: en5 flags=3<LEARNING,DISCOVER>
ifmaxaddr 0 port 14 priority 0 path cost 0
nd6 options=201<PERFORMNUD,DAD>
media: <unknown type>
status: inactive
utun0: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 1380
inet6 fe80::93a6:b158:9d1a:86ee%utun0 prefixlen 64 scopeid 0x10
nd6 options=201<PERFORMNUD,DAD>
utun1: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 2000
inet6 fe80::fef3:61fc:6994:82c4%utun1 prefixlen 64 scopeid 0x11
nd6 options=201<PERFORMNUD,DAD>
en8: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
options=400<CHANNEL_IO>
ether da:1c:79:6f:03:9d
inet6 fe80::18db:f66f:c81d:54d0%en8 prefixlen 64 secured scopeid 0x14
inet 169.254.172.225 netmask 0xffff0000 broadcast 169.254.255.255
nd6 options=201<PERFORMNUD,DAD>
media: autoselect (100baseTX <full-duplex>)
status: active
答案1
解决方案。将以下规则添加到/etc/pf.conf
:
anchor "multicast" {
pass proto igmp allow-opts
pass quick from any to { 224.0.0.0/4 ff00::/8 } allow-opts
}
(也可以将规则放在单独的文件中并将它们附加到锚点,请参阅 PF 手册)
sudo sysctl net.inet.igmp.sendra=0
不再需要 hack。
问题来源。私人互联网访问应用程序启用 PF 防火墙并加载其自己的规则,这些规则显然禁用 IGMP/多播。即使 PIA 应用程序未运行,也会发生这种情况。我已联系 PIA 支持人员希望他们能解决这个问题。
调查详情。
tcpdump
据透露,Mac 不响应来自路由器的 IGMP 请求。- 神奇的 04:20 时间是 125 * 2 + 10,其中 125 是查询间隔,10 是在我的路由器上的 IGMP 代理中设置的查询响应超时。
- 我发现 macOS 有 PF 防火墙,默认情况下是禁用的,但两台机器上都启用了它。通过
sudo pfctl -d
固定 IPTV 和 IGMP 响应禁用它。 - 禁用
/etc/pf.conf
(Apple 默认规则)中找到的规则没有任何效果,然后我通过以下方式发现了 PIA 的规则sudo pfctl -sr
:anchor "com.privateinternetaccess.vpn/*" all
。 - 从 Murus(PF 的 UI)获取 IGMP + 多播规则(在解决方案中列出),瞧!