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个字节以内?

相关推荐
hh.h.1 天前
无网络也能用!Flutter+开源鸿蒙构建轻量级应急通信系统
网络·flutter·开源
橘子真甜~1 天前
C/C++ Linux网络编程14 - 传输层TCP协议详解(保证可靠传输)
linux·服务器·网络·网络协议·tcp/ip·滑动窗口·拥塞控制
真正的醒悟1 天前
图解网络34
网络
IT·小灰灰2 天前
告别“翻墙“烦恼:DMXAPI让Gemini-3-pro-thinking调用快如闪电
网络·人工智能·python·深度学习·云计算
任子菲阳2 天前
学Java第五十六天——网络编程
网络
程序员zgh2 天前
常用通信协议介绍(CAN、RS232、RS485、IIC、SPI、TCP/IP)
c语言·网络·c++
小汐睡着了2 天前
解决虚拟机VMware与宿主机网络不通的问题-error
linux·网络·redhat
Heart_to_Yang2 天前
Telnet 调试屏幕输出信息卡死问题解决
网络·windows·经验分享
资料库012 天前
华为OSPF详解
网络·华为
yenggd2 天前
锐捷路由器nat上网+ipsec配置案例
网络