Linux 添加组播

时间:2025-03-01 16:54:43
Looks to me like multicast isn't enabled properly.

First, check using "ifconfig -a" that multicast is enabled on your network interfaces.

eth0 Link encap:Ethernet HWaddr 00:E0:81:51:41:39
inet addr:192.168.0.6 Bcast:192.168.255.255 Mask:255.255.0.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:14003 errors:0 dropped:0 overruns:0 frame:0
TX packets:13294 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:10695433 (10.1 Mb) TX bytes:1728797 (1.6 Mb)
Interrupt:16 Base address:0x3000 Memory:c2220000-c2240000

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:1398 errors:0 dropped:0 overruns:0 frame:0
TX packets:1398 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:174382 (170.2 Kb) TX bytes:174382 (170.2 Kb)

Then, do "route -n" and make sure you have something like this line:

224.0.0.0 0.0.0.0 240.0.0.0 U 0 0 0 eth0

If that's missing, you need to add a route. Su to root and do:

route add -net 224.0.0.0 netmask 240.0.0.0 dev eth0

Or similar, depending on what name your network device has.