UDP组播测试

支持组播的接口:

ip a | grep MULTICAST

环回接口虽然显示不支持组播,实际也可以用于本地测试。

添加路由(非必须?):

ip route add 239.0.0.0/24 via 10.10.10.206 dev eth0

开放防火墙:

查询:

firewall-cmd --query-port=2223/udp

添加:

firewall-cmd --permanent --add-port=2223/udp

firewall-cmd --reload

删除:

firewall-cmd --permanent --remove-port=2223/udp

或者开放iptables:

iptables -I INPUT -s ${bond} -p udp -m multiport --dport 18888 -j ACCEPT

查询已有的组播分组:

netstat -gn

ping -b 224.0.0.1

ss -u -a -n -l | grep MULTICAST

socat手册:

socat

组播绑定和接收、发送都不需要root权限。

socat接收组播:

socat -u udp-recv:2223,ip-add-membership=239.0.1.1:0.0.0.0 -

socat -u udp-recv:2223,ip-add-membership=239.0.1.1:127.0.0.1

socat发送组播:

echo "This is a multicast test" | socat STDIO udp-sendto:239.0.1.1:2223,ip-multicast-if=0.0.0.0

echo "This is a multicast test" | socat STDIO udp-sendto:239.0.1.1:2223,ip-multicast-if=127.0.0.1

echo "This is a multicast test" | socat STDIO udp-sendto:239.0.1.1:2223,broadcast,ip-multicast-if=0.0.0.0

echo "This is a multicast test" | socat STDIO udp-sendto:239.0.1.1:2223,broadcast,ip-multicast-if=127.0.0.1

组播压测:

iperf -u -c 224.0.0.1 -p 1234 -b 1M

局域网环境下的MTU:

UDP的数据长度控制在1472个字节以内?

相关推荐
一只栖枝4 小时前
网络安全 vs 信息安全的本质解析:数据盾牌与网络防线的辩证关系关系
网络·网络安全·信息安全·it·信息安全认证
CertiK5 小时前
CertiK《Hack3d:2025年第二季度及上半年Web3.0安全报告》(附报告全文链接)
网络
一只小鱼儿吖7 小时前
进程代理单窗口单IP技术:原理、应用与实现
网络·网络协议·tcp/ip
稳联技术7 小时前
Ethernet IP与Profinet共舞:网关驱动绿色工业的智慧脉动
网络·网络协议·tcp/ip
学习3人组7 小时前
CentOS配置网络
linux·网络·centos
高兴达7 小时前
RPC框架--实现一个非常简单的RPC调用
网络协议·rpc·firefox
~山有木兮8 小时前
LiteHub中间件之限流实现
网络·http·中间件
cui_win8 小时前
【网络】Linux 内核优化实战 - net.core.flow_limit_table_len
linux·运维·网络
BD_Marathon9 小时前
虚拟机网络检查
网络
游戏开发爱好者89 小时前
iOS App首次启动请求异常调试:一次冷启动链路抓包与初始化流程修复
websocket·网络协议·tcp/ip·http·网络安全·https·udp