Linux 使用 smcroute 加入组播
1 min read

Linux 使用 smcroute 加入组播

Ubuntu 18.04 下试了几个程序加入组播,最后发现 smcroute 有效,按以下步骤:

apt install smcroute
smcroute -j enp4s0f1np1 232.8.0.10

enp4s0f1np1 是组播所在的网卡,232.8.0.10 是要加入的组播地址。

查看当前加入的组:

netstat -g

通过 tcpdump 抓包验证:

tcpdump -i enp4s0f1np1 -nn udp

若要离开组播:

smcroute -l enp4s0f1np1 232.8.0.10

如需要重启后仍然生效,创建 /etc/smcroute.conf 并添加如下内容:

mgroup from enp4s0f1np1 group 232.8.0.10

并设置 smcroute 开机启动:

systemctl enable smcroute